Shorten printful/webflow naming convention

This commit is contained in:
Dominic Ferrando
2026-07-04 15:28:59 -04:00
parent afdc8de77c
commit a7b8dd0bea
7 changed files with 231 additions and 231 deletions
+10 -10
View File
@@ -75,14 +75,14 @@ class ProductsClient {
return payload.result;
}
async update(printfulProductId: number, printfulProduct: DeepPartial<Printful.Products.Product>) {
const res = await fetch(`${this.creds.apiUrl}/store/products/${printfulProductId}`, {
async update(pProductId: number, pProduct: DeepPartial<Printful.Products.Product>) {
const res = await fetch(`${this.creds.apiUrl}/store/products/${pProductId}`, {
method: "PUT",
headers: {
"Content-Type": "application/json",
...this.creds.authHeaders,
},
body: JSON.stringify(printfulProduct),
body: JSON.stringify(pProduct),
});
if (!res.ok) throw new PrintfulError("Failed to update Printful product", res.status, await parsePayload(res));
}
@@ -91,20 +91,20 @@ class ProductsClient {
class OrdersClient {
constructor(private creds: Credentials) { }
async create(printfulOrder: Printful.Orders.Order) {
async create(pOrder: Printful.Orders.Order) {
const res = await fetch(`${this.creds.apiUrl}/orders`, {
method: "POST",
headers: {
"Content-Type": "application/json",
...this.creds.authHeaders,
},
body: JSON.stringify(printfulOrder),
body: JSON.stringify(pOrder),
});
if (!res.ok) throw new PrintfulError("Failed to create Printful order", res.status, await parsePayload(res));
}
async list(opt: PagingOptions = {}): Promise<Printful.Orders.Order[]> {
const allPrintfulOrders: Printful.Orders.Order[] = [];
const allPOrders: Printful.Orders.Order[] = [];
let offset = opt.offset ?? 0;
do {
const res = await fetch(`${this.creds.apiUrl}/orders?offset=${offset}&limit=${opt.limit ?? 100}`, {
@@ -113,11 +113,11 @@ class OrdersClient {
});
if (!res.ok) throw new PrintfulError("Failed to list Printful orders", res.status, await parsePayload(res));
const payload = (await res.json()) as Printful.MetaDataMulti<Printful.Orders.Order>;
allPrintfulOrders.push(...payload.result);
offset = allPrintfulOrders.length;
if (allPrintfulOrders.length >= payload.paging.total) break;
allPOrders.push(...payload.result);
offset = allPOrders.length;
if (allPOrders.length >= payload.paging.total) break;
} while (opt.forceAll);
return allPrintfulOrders;
return allPOrders;
}
}