type Shopify = {
token: string;
store_name: string;
};
/**
* Retrieves a list of orders
* Retrieves a list of orders. Note: As of version 2019-10, this endpoint implements pagination by using links that are provided in the response header. Sending the page parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
*/
export async function main(
auth: Shopify,
api_version: string = "2023-10",
ids: string | undefined,
name: string | undefined,
limit: string | undefined,
since_id: string | undefined,
created_at_min: string | undefined,
created_at_max: string | undefined,
updated_at_min: string | undefined,
updated_at_max: string | undefined,
processed_at_min: string | undefined,
processed_at_max: string | undefined,
attribution_app_id: string | undefined,
status: string | undefined,
financial_status: string | undefined,
fulfillment_status: string | undefined,
fields: string | undefined
) {
const url = new URL(
`https://${auth.store_name}.myshopify.com/admin/api/${api_version}/orders.json`
);
for (const [k, v] of [
["ids", ids],
["name", name],
["limit", limit],
["since_id", since_id],
["created_at_min", created_at_min],
["created_at_max", created_at_max],
["updated_at_min", updated_at_min],
["updated_at_max", updated_at_max],
["processed_at_min", processed_at_min],
["processed_at_max", processed_at_max],
["attribution_app_id", attribution_app_id],
["status", status],
["financial_status", financial_status],
["fulfillment_status", fulfillment_status],
["fields", fields],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
"X-Shopify-Access-Token": auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 43 days ago
type Shopify = {
token: string;
store_name: string;
};
/**
* Retrieves a list of orders
* Retrieves a list of orders. Note: As of version 2019-10, this endpoint implements pagination by using links that are provided in the response header. Sending the page parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
*/
export async function main(
auth: Shopify,
api_version: string = "2023-10",
ids: string | undefined,
name: string | undefined,
limit: string | undefined,
since_id: string | undefined,
created_at_min: string | undefined,
created_at_max: string | undefined,
updated_at_min: string | undefined,
updated_at_max: string | undefined,
processed_at_min: string | undefined,
processed_at_max: string | undefined,
attribution_app_id: string | undefined,
status: string | undefined,
financial_status: string | undefined,
fulfillment_status: string | undefined,
fields: string | undefined
) {
const url = new URL(
`https://${auth.store_name}.myshopify.com/admin/api/${api_version}/orders.json`
);
for (const [k, v] of [
["ids", ids],
["name", name],
["limit", limit],
["since_id", since_id],
["created_at_min", created_at_min],
["created_at_max", created_at_max],
["updated_at_min", updated_at_min],
["updated_at_max", updated_at_max],
["processed_at_min", processed_at_min],
["processed_at_max", processed_at_max],
["attribution_app_id", attribution_app_id],
["status", status],
["financial_status", financial_status],
["fulfillment_status", fulfillment_status],
["fields", fields],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
"X-Shopify-Access-Token": auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 57 days ago
type Shopify = {
token: string;
store_name: string;
};
/**
* Retrieves a list of orders
* Retrieves a list of orders. Note: As of version 2019-10, this endpoint implements pagination by using links that are provided in the response header. Sending the page parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
*/
export async function main(
auth: Shopify,
api_version: string = "2023-10",
ids: string | undefined,
name: string | undefined,
limit: string | undefined,
since_id: string | undefined,
created_at_min: string | undefined,
created_at_max: string | undefined,
updated_at_min: string | undefined,
updated_at_max: string | undefined,
processed_at_min: string | undefined,
processed_at_max: string | undefined,
attribution_app_id: string | undefined,
status: string | undefined,
financial_status: string | undefined,
fulfillment_status: string | undefined,
fields: string | undefined
) {
const url = new URL(
`https://${auth.store_name}.myshopify.com/admin/api/${api_version}/orders.json`
);
for (const [k, v] of [
["ids", ids],
["name", name],
["limit", limit],
["since_id", since_id],
["created_at_min", created_at_min],
["created_at_max", created_at_max],
["updated_at_min", updated_at_min],
["updated_at_max", updated_at_max],
["processed_at_min", processed_at_min],
["processed_at_max", processed_at_max],
["attribution_app_id", attribution_app_id],
["status", status],
["financial_status", financial_status],
["fulfillment_status", fulfillment_status],
["fields", fields],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
"X-Shopify-Access-Token": auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 603 days ago