@shopify/shopify-api
Version:
Shopify API Library for Node - accelerate development with support for authentication, graphql proxy, webhooks
87 lines (77 loc) • 2.92 kB
text/typescript
/***********************************************************************************************************************
* This file is auto-generated. If you have an issue, please create a GitHub issue. *
***********************************************************************************************************************/
import {Base} from '../../base';
import {ResourcePath, ResourceNames} from '../../types';
import {ApiVersion} from '../../../lib/types';
interface AcceptArgs {
[key: string]: unknown;
message?: unknown;
body?: {[key: string]: unknown} | null;
}
interface RejectArgs {
[key: string]: unknown;
message?: unknown;
reason?: unknown;
line_items?: unknown;
body?: {[key: string]: unknown} | null;
}
export class FulfillmentRequest extends Base {
public static apiVersion = ApiVersion.October24;
protected static hasOne: {[key: string]: typeof Base} = {};
protected static hasMany: {[key: string]: typeof Base} = {};
protected static paths: ResourcePath[] = [
{"http_method": "post", "operation": "accept", "ids": ["fulfillment_order_id"], "path": "fulfillment_orders/<fulfillment_order_id>/fulfillment_request/accept.json"},
{"http_method": "post", "operation": "post", "ids": ["fulfillment_order_id"], "path": "fulfillment_orders/<fulfillment_order_id>/fulfillment_request.json"},
{"http_method": "post", "operation": "reject", "ids": ["fulfillment_order_id"], "path": "fulfillment_orders/<fulfillment_order_id>/fulfillment_request/reject.json"}
];
protected static resourceNames: ResourceNames[] = [
{
"singular": "submitted_fulfillment_order",
"plural": "submitted_fulfillment_orders"
},
{
"singular": "fulfillment_order",
"plural": "fulfillment_orders"
}
];
public async accept(
{
message = null,
body = null,
...otherArgs
}: AcceptArgs
): Promise<unknown> {
const response = await this.request<FulfillmentRequest>({
http_method: "post",
operation: "accept",
session: this.session,
urlIds: {"fulfillment_order_id": this.fulfillment_order_id},
params: {"message": message, ...otherArgs},
body: body,
entity: this,
});
return response ? response.body : null;
}
public async reject(
{
message = null,
reason = null,
line_items = null,
body = null,
...otherArgs
}: RejectArgs
): Promise<unknown> {
const response = await this.request<FulfillmentRequest>({
http_method: "post",
operation: "reject",
session: this.session,
urlIds: {"fulfillment_order_id": this.fulfillment_order_id},
params: {"message": message, "reason": reason, "line_items": line_items, ...otherArgs},
body: body,
entity: this,
});
return response ? response.body : null;
}
public fulfillment_order_id: string | null;
}