/*********************************************************************************************************************** * This file is auto-generated. If you have an issue, please create a GitHub issue. * ***********************************************************************************************************************/ import {Base, FindAllResponse} from '../../base'; import {ResourcePath, ResourceNames} from '../../types'; import {Session} from '../../../lib/session/session'; import {ApiVersion} from '../../../lib/types'; interface FindArgs { session: Session; id: number | string; include_financial_summaries?: unknown; include_order_reference_fields?: unknown; } interface AllArgs { [key: string]: unknown; session: Session; order_id?: number | string | null; include_financial_summaries?: unknown; include_order_reference_fields?: unknown; } interface CancelArgs { [key: string]: unknown; body?: {[key: string]: unknown} | null; } interface CloseArgs { [key: string]: unknown; message?: unknown; body?: {[key: string]: unknown} | null; } interface HoldArgs { [key: string]: unknown; fulfillment_hold?: unknown; body?: {[key: string]: unknown} | null; } interface MoveArgs { [key: string]: unknown; fulfillment_order?: unknown; body?: {[key: string]: unknown} | null; } interface OpenArgs { [key: string]: unknown; body?: {[key: string]: unknown} | null; } interface ReleaseHoldArgs { [key: string]: unknown; body?: {[key: string]: unknown} | null; } interface RescheduleArgs { [key: string]: unknown; new_fulfill_at?: unknown; body?: {[key: string]: unknown} | null; } interface SetFulfillmentOrdersDeadlineArgs { [key: string]: unknown; fulfillment_order_ids?: unknown; fulfillment_deadline?: unknown; body?: {[key: string]: unknown} | null; } export class FulfillmentOrder extends Base { public static apiVersion = ApiVersion.January25; protected static hasOne: {[key: string]: typeof Base} = {}; protected static hasMany: {[key: string]: typeof Base} = {}; protected static paths: ResourcePath[] = [ {"http_method": "get", "operation": "get", "ids": ["id"], "path": "fulfillment_orders/.json"}, {"http_method": "get", "operation": "get", "ids": ["order_id"], "path": "orders//fulfillment_orders.json"}, {"http_method": "post", "operation": "cancel", "ids": ["id"], "path": "fulfillment_orders//cancel.json"}, {"http_method": "post", "operation": "close", "ids": ["id"], "path": "fulfillment_orders//close.json"}, {"http_method": "post", "operation": "hold", "ids": ["id"], "path": "fulfillment_orders//hold.json"}, {"http_method": "post", "operation": "move", "ids": ["id"], "path": "fulfillment_orders//move.json"}, {"http_method": "post", "operation": "open", "ids": ["id"], "path": "fulfillment_orders//open.json"}, {"http_method": "post", "operation": "release_hold", "ids": ["id"], "path": "fulfillment_orders//release_hold.json"}, {"http_method": "post", "operation": "reschedule", "ids": ["id"], "path": "fulfillment_orders//reschedule.json"}, {"http_method": "post", "operation": "set_fulfillment_orders_deadline", "ids": [], "path": "fulfillment_orders/set_fulfillment_orders_deadline.json"} ]; protected static resourceNames: ResourceNames[] = [ { "singular": "fulfillment_order", "plural": "fulfillment_orders" } ]; public static async find( { session, id, include_financial_summaries = null, include_order_reference_fields = null }: FindArgs ): Promise { const result = await this.baseFind({ session: session, urlIds: {"id": id}, params: {"include_financial_summaries": include_financial_summaries, "include_order_reference_fields": include_order_reference_fields}, }); return result.data ? result.data[0] : null; } public static async all( { session, order_id = null, include_financial_summaries = null, include_order_reference_fields = null, ...otherArgs }: AllArgs ): Promise> { const response = await this.baseFind({ session: session, urlIds: {"order_id": order_id}, params: {"include_financial_summaries": include_financial_summaries, "include_order_reference_fields": include_order_reference_fields, ...otherArgs}, }); return response; } public async cancel( { body = null, ...otherArgs }: CancelArgs ): Promise { const response = await this.request({ http_method: "post", operation: "cancel", session: this.session, urlIds: {"id": this.id}, params: {...otherArgs}, body: body, entity: this, }); return response ? response.body : null; } public async close( { message = null, body = null, ...otherArgs }: CloseArgs ): Promise { const response = await this.request({ http_method: "post", operation: "close", session: this.session, urlIds: {"id": this.id}, params: {"message": message, ...otherArgs}, body: body, entity: this, }); return response ? response.body : null; } public async hold( { fulfillment_hold = null, body = null, ...otherArgs }: HoldArgs ): Promise { const response = await this.request({ http_method: "post", operation: "hold", session: this.session, urlIds: {"id": this.id}, params: {"fulfillment_hold": fulfillment_hold, ...otherArgs}, body: body, entity: this, }); return response ? response.body : null; } public async move( { fulfillment_order = null, body = null, ...otherArgs }: MoveArgs ): Promise { const response = await this.request({ http_method: "post", operation: "move", session: this.session, urlIds: {"id": this.id}, params: {"fulfillment_order": fulfillment_order, ...otherArgs}, body: body, entity: this, }); return response ? response.body : null; } public async open( { body = null, ...otherArgs }: OpenArgs ): Promise { const response = await this.request({ http_method: "post", operation: "open", session: this.session, urlIds: {"id": this.id}, params: {...otherArgs}, body: body, entity: this, }); return response ? response.body : null; } public async release_hold( { body = null, ...otherArgs }: ReleaseHoldArgs ): Promise { const response = await this.request({ http_method: "post", operation: "release_hold", session: this.session, urlIds: {"id": this.id}, params: {...otherArgs}, body: body, entity: this, }); return response ? response.body : null; } public async reschedule( { new_fulfill_at = null, body = null, ...otherArgs }: RescheduleArgs ): Promise { const response = await this.request({ http_method: "post", operation: "reschedule", session: this.session, urlIds: {"id": this.id}, params: {"new_fulfill_at": new_fulfill_at, ...otherArgs}, body: body, entity: this, }); return response ? response.body : null; } public async set_fulfillment_orders_deadline( { fulfillment_order_ids = null, fulfillment_deadline = null, body = null, ...otherArgs }: SetFulfillmentOrdersDeadlineArgs ): Promise { const response = await this.request({ http_method: "post", operation: "set_fulfillment_orders_deadline", session: this.session, urlIds: {}, params: {"fulfillment_order_ids": fulfillment_order_ids, "fulfillment_deadline": fulfillment_deadline, ...otherArgs}, body: body, entity: this, }); return response ? response.body : null; } public assigned_location: {[key: string]: unknown} | null; public assigned_location_id: string | null; public created_at: string | null; public delivery_method: {[key: string]: unknown} | null; public destination: {[key: string]: unknown} | null; public fulfill_at: string | null; public fulfill_by: string | null; public fulfillment_holds: {[key: string]: unknown}[] | null; public id: string | null; public international_duties: {[key: string]: unknown} | null; public line_items: {[key: string]: unknown}[] | null; public merchant_requests: {[key: string]: unknown}[] | null; public order_id: string | null; public request_status: string | null; public shop_id: string | null; public status: string | null; public supported_actions: string[] | null; public updated_at: string | null; }