| appliedPromotions |
array |
This array contains information about one or more sales promotions or discounts applied to the line item. It is always returned, but will be returned as an empty array if no special sales promotions o |
| deliveryCost |
object |
This container consists of a breakdown of all costs associated with the fulfillment of the line item. |
| discountedLineItemCost |
object |
The cost of the line item after applying any discounts. This container is only returned if the order line item was discounted through a promotion. |
| ebayCollectAndRemitTaxes |
array |
This container will be returned if the order line item is subject to a 'Collect and Remit' tax that eBay will collect and remit to the proper taxing authority on the buyer's behalf.
'Collect an |
| ebayCollectedCharges |
object |
This container consists of a breakdown of costs that are collected by eBay from the buyer for this order.
Note: Currently, this container is returned o |
| giftDetails |
object |
This container consists of information that is needed by the seller to send a digital gift card to the buyer, or recipient of the digital gift card. This container is only returned and applicable for |
| itemLocation |
object |
This container field describes the physical location of the order line item. |
| legacyItemId |
string |
The eBay-generated legacy listing item ID of the listing. Note that the unique identifier of a listing in REST-based APIs is called the listingId instead. |
| legacyVariationId |
string |
The unique identifier of a single variation within a multiple-variation listing. This field is only returned if the line item purchased was from a multiple-variation listing. |
| lineItemCost |
object |
The selling price of the line item before applying any discounts. The value of this field is calculated by multiplying the single unit price by the number of units purchased (value of the quantity< |
| lineItemFulfillmentInstructions |
object |
This container consists of information related to shipping dates and expectations, including the 'ship-by date' and expected delivery windows that are based on the seller's stated handling time and th |
| lineItemFulfillmentStatus |
string |
This enumeration value indicates the current fulfillment status of the line item. For implementation help, refer to
|
| properties |
object |
Contains information about the eBay programs, if any, under which the line item was listed. |
| purchaseMarketplaceId |
string |
The unique identifier of the eBay marketplace where the line item was listed. Often, the listingMarketplaceId and the purchaseMarketplaceId identifier are the same, b |
| quantity |
integer |
The number of units of the line item in the order. These are represented as a group by a single lineItemId. |
| refunds |
array |
This array is always returned, but is returned as an empty array unless the seller has submitted a partial or full refund to the buyer for the order. If a refund has occurred, the refund amount and re |
| sku |
string |
Seller-defined Stock-Keeping Unit (SKU). This inventory identifier must be unique within the seller's eBay inventory. SKUs are optional when listing in the legacy/Trading API system, but SKUs are requ |
| soldFormat |
string |
The eBay listing type of the line item. The most common listing types are AUCTION and FIXED_PRICE. 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();
}
})();
|