eBay · Schema

Definition

A complex type that defines a dimension key and metrics in a traffic report.

AuctionsCommerceProductsMarketplaceFortune 500

Properties

Name Type Description
dataType string Indicates the data type of the returned dimension. For example, if the dimension is day, the data type is DATE. For implementation help, refer to ) ---- function clearSearch() { widget.querySelectorAll('mark.src-hit').forEach(function (m) { var parent = m.parentNode; while (m.firstChild) parent.insertBefore(m.firstChild, m); parent.removeChild(m); parent.normalize(); }); searchHits = []; activeHit = -1; } function runSearch() { clearSearch(); var q = (search.value || '').trim(); if (q.length < 2) return; var qLower = q.toLowerCase(); var walker = document.createTreeWalker(codeEl, NodeFilter.SHOW_TEXT, null); var nodes = []; var n; while ((n = walker.nextNode())) nodes.push(n); nodes.forEach(function (node) { var text = node.nodeValue; var lower = text.toLowerCase(); var idx = lower.indexOf(qLower); if (idx === -1) return; var frag = document.createDocumentFragment(); var cursor = 0; while (idx !== -1) { if (idx > cursor) frag.appendChild(document.createTextNode(text.slice(cursor, idx))); var mark = document.createElement('mark'); mark.className = 'src-hit'; mark.textContent = text.slice(idx, idx + q.length); frag.appendChild(mark); searchHits.push(mark); cursor = idx + q.length; idx = lower.indexOf(qLower, cursor); } if (cursor < text.length) frag.appendChild(document.createTextNode(text.slice(cursor))); node.parentNode.replaceChild(frag, node); }); if (searchHits.length) jumpToHit(0); } function jumpToHit(i) { if (!searchHits.length) return; if (activeHit >= 0 && searchHits[activeHit]) searchHits[activeHit].classList.remove('src-hit-active'); activeHit = ((i % searchHits.length) + searchHits.length) % searchHits.length; var el = searchHits[activeHit]; el.classList.add('src-hit-active'); el.scrollIntoView({ block: 'center', behavior: 'smooth' }); } // ---- Wire up ---- var debounce; search.addEventListener('input', function () { clearTimeout(debounce); debounce = setTimeout(runSearch, 100); }); search.addEventListener('keydown', function (ev) { if (ev.key === 'Enter' || ev.key === 'n') { ev.preventDefault(); jumpToHit(activeHit + 1); } else if (ev.key === 'N' || (ev.key === 'p')) { ev.preventDefault(); jumpToHit(activeHit - 1); } else if (ev.key === 'Escape') { search.value = ''; runSearch(); } }); toggles.forEach(function (b) { b.addEventListener('click', function () { tryConvert(b.dataset.target); }); }); downloadBtn.addEventListener('click', function () { var blob = new Blob([codeEl.textContent], { type: currentLang === 'json' ? 'application/json' : 'application/yaml' }); var url = URL.createObjectURL(blob); var a = document.createElement('a'); a.href = url; a.download = fileLabel.textContent; document.body.appendChild(a); a.click(); document.body.removeChild(a); setTimeout(function () { URL.revokeObjectURL(url); }, 0); }); copyBtn.addEventListener('click', function () { navigator.clipboard.writeText(codeEl.textContent).then(function () { var orig = copyBtn.textContent; copyBtn.textContent = 'Copied'; copyBtn.classList.add('src-copied'); setTimeout(function () { copyBtn.textContent = orig; copyBtn.classList.remove('src-copied'); }, 1500); }); }); // ---- Picker (provider pages with multiple specs) ---- function applySource(text, lang, filename, url, heading) { currentSourceFilename = filename || originalFilename; currentSourceUrl = url || null; if (rawLink) { if (url) { rawLink.setAttribute('href', url); rawLink.style.display = ''; } else { rawLink.style.display = 'none'; } } if (headingEl && heading) headingEl.textContent = heading; setLangContent(lang, text); } if (picker) { picker.addEventListener('change', function () { var opt = picker.options[picker.selectedIndex]; var url = opt.dataset.url; var fmt = opt.dataset.format || 'yaml'; var fname = opt.dataset.filename || ''; var heading = opt.dataset.heading || ''; if (!url) { // Original embedded source applySource(originalText, originalLang, originalFilename, picker.options[0].dataset.url || null, picker.options[0].dataset.heading || ''); return; } if (fetchedCache[url]) { applySource(fetchedCache[url], fmt, fname, url, heading); return; } codeEl.textContent = 'Loading ' + fname + '…'; codeEl.className = ''; preEl.className = ''; fetch(url).then(function (r) { if (!r.ok) throw new Error('HTTP ' + r.status); return r.text(); }).then(function (text) { fetchedCache[url] = text; applySource(text, fmt, fname, url, heading); }).catch(function (err) { codeEl.textContent = 'Could not load: ' + err.message; }); }); // Stash the default option's url so we can restore "Raw" link when reset. if (rawLink && picker.options[0]) { picker.options[0].dataset.url = rawLink.getAttribute('href') || ''; picker.options[0].dataset.heading = (headingEl ? headingEl.textContent : '') || ''; } } // Auto-fetch when initial source is empty but a remote URL is available. // This happens when the build found an external OpenAPI URL but didn't // inline the content — the widget fetches it on page load instead. if (!originalText.trim() && currentSourceUrl) { var remoteUrl = currentSourceUrl; codeEl.textContent = 'Loading…'; codeEl.className = ''; preEl.className = 'line-numbers language-' + originalLang; fetch(remoteUrl) .then(function (r) { if (!r.ok) throw new Error('HTTP ' + r.status); return r.text(); }) .then(function (text) { var ext = remoteUrl.replace(/\?.*/, '').split('.').pop().toLowerCase(); var fmt = ext === 'json' ? 'json' : 'yaml'; originalText = text; originalLang = fmt; currentLang = fmt; widget.dataset.originalLang = fmt; applySource(text, fmt, originalFilename, remoteUrl, headingEl ? headingEl.textContent : ''); }) .catch(function (err) { codeEl.textContent = 'Could not load spec: ' + err.message; }); } // Initial state setActiveToggle(); // Wait for Prism to load before highlighting / line-numbers wiring. var tries = 0; var waitPrism = setInterval(function () { if (window.Prism && window.Prism.plugins) { clearInterval(waitPrism); highlight(); } else if (++tries > 80) { clearInterval(waitPrism); } }, 50); } function initAll() { document.querySelectorAll('[data-src-widget]').forEach(initWidget); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', initAll); } else { initAll(); } })();