type Shopify = {
token: string;
store_name: string;
};
/**
* Receive a list of all FulfillmentServices
* Receive a list of all FulfillmentServices
*/
export async function main(
auth: Shopify,
api_version: string = "2023-10",
scope: string | undefined
) {
const url = new URL(
`https://${auth.store_name}.myshopify.com/admin/api/${api_version}/fulfillment_services.json`
);
for (const [k, v] of [["scope", scope]]) {
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 337 days ago
type Shopify = {
token: string;
store_name: string;
};
/**
* Receive a list of all FulfillmentServices
* Receive a list of all FulfillmentServices
*/
export async function main(
auth: Shopify,
api_version: string = "2023-10",
scope: string | undefined
) {
const url = new URL(
`https://${auth.store_name}.myshopify.com/admin/api/${api_version}/fulfillment_services.json`
);
for (const [k, v] of [["scope", scope]]) {
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 883 days ago