-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathcard-bulk-orders.ts
More file actions
189 lines (168 loc) · 5.56 KB
/
Copy pathcard-bulk-orders.ts
File metadata and controls
189 lines (168 loc) · 5.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../core/resource';
import { APIPromise } from '../core/api-promise';
import { CursorPage, type CursorPageParams, PagePromise } from '../core/pagination';
import { RequestOptions } from '../internal/request-options';
import { path } from '../internal/utils/path';
export class CardBulkOrders extends APIResource {
/**
* Create a new bulk order for physical card shipments. Cards can be added to the
* order via the POST /v1/cards endpoint by specifying the bulk_order_token. Lock
* the order via PATCH /v1/card_bulk_orders/{bulk_order_token} to prepare for
* shipment. Please work with your Customer Success Manager and card
* personalization bureau to ensure bulk shipping is supported for your program.
*
* @example
* ```ts
* const cardBulkOrder = await client.cardBulkOrders.create({
* customer_product_id: 'custom-card-design-123',
* shipping_address: {
* address1: '123 Main Street',
* city: 'NEW YORK',
* country: 'USA',
* first_name: 'Johnny',
* last_name: 'Appleseed',
* postal_code: '10001',
* state: 'NY',
* },
* shipping_method: 'BULK_EXPEDITED',
* });
* ```
*/
create(body: CardBulkOrderCreateParams, options?: RequestOptions): APIPromise<CardBulkOrder> {
return this._client.post('/v1/card_bulk_orders', { body, ...options });
}
/**
* Retrieve a specific bulk order by token
*
* @example
* ```ts
* const cardBulkOrder = await client.cardBulkOrders.retrieve(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* );
* ```
*/
retrieve(bulkOrderToken: string, options?: RequestOptions): APIPromise<CardBulkOrder> {
return this._client.get(path`/v1/card_bulk_orders/${bulkOrderToken}`, options);
}
/**
* Update a bulk order. Primarily used to lock the order, preventing additional
* cards from being added
*
* @example
* ```ts
* const cardBulkOrder = await client.cardBulkOrders.update(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* { status: 'LOCKED' },
* );
* ```
*/
update(
bulkOrderToken: string,
body: CardBulkOrderUpdateParams,
options?: RequestOptions,
): APIPromise<CardBulkOrder> {
return this._client.patch(path`/v1/card_bulk_orders/${bulkOrderToken}`, { body, ...options });
}
/**
* List bulk orders for physical card shipments
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const cardBulkOrder of client.cardBulkOrders.list()) {
* // ...
* }
* ```
*/
list(
query: CardBulkOrderListParams | null | undefined = {},
options?: RequestOptions,
): PagePromise<CardBulkOrdersCursorPage, CardBulkOrder> {
return this._client.getAPIList('/v1/card_bulk_orders', CursorPage<CardBulkOrder>, { query, ...options });
}
}
export type CardBulkOrdersCursorPage = CursorPage<CardBulkOrder>;
/**
* Represents a bulk order for physical card shipments
*/
export interface CardBulkOrder {
/**
* Globally unique identifier for the bulk order
*/
token: string;
/**
* List of card tokens associated with this bulk order
*/
card_tokens: Array<string>;
/**
* An RFC 3339 timestamp for when the bulk order was created. UTC time zone
*/
created: string;
/**
* Customer-specified product configuration for physical card manufacturing. This
* must be configured with Lithic before use
*/
customer_product_id: string | null;
/**
* Shipping address for all cards in this bulk order
*/
shipping_address: unknown;
/**
* Shipping method for all cards in this bulk order. BULK_PRIORITY, BULK_2_DAY, and
* BULK_EXPRESS are only available with Perfect Plastic Printing
*/
shipping_method: 'BULK_EXPEDITED' | 'BULK_PRIORITY' | 'BULK_2_DAY' | 'BULK_EXPRESS';
/**
* Status of the bulk order. OPEN indicates the order is accepting cards. LOCKED
* indicates the order is finalized and no more cards can be added
*/
status: 'OPEN' | 'LOCKED';
/**
* An RFC 3339 timestamp for when the bulk order was last updated. UTC time zone
*/
updated: string;
}
export interface CardBulkOrderCreateParams {
/**
* Customer-specified product configuration for physical card manufacturing. This
* must be configured with Lithic before use
*/
customer_product_id: string;
/**
* Shipping address for all cards in this bulk order
*/
shipping_address: unknown;
/**
* Shipping method for all cards in this bulk order. BULK_PRIORITY, BULK_2_DAY, and
* BULK_EXPRESS are only available with Perfect Plastic Printing
*/
shipping_method: 'BULK_EXPEDITED' | 'BULK_PRIORITY' | 'BULK_2_DAY' | 'BULK_EXPRESS';
}
export interface CardBulkOrderUpdateParams {
/**
* Status to update the bulk order to. Use LOCKED to finalize the order
*/
status: 'LOCKED';
}
export interface CardBulkOrderListParams extends CursorPageParams {
/**
* Date string in RFC 3339 format. Only entries created after the specified time
* will be included. UTC time zone.
*/
begin?: string;
/**
* Date string in RFC 3339 format. Only entries created before the specified time
* will be included. UTC time zone.
*/
end?: string;
}
export declare namespace CardBulkOrders {
export {
type CardBulkOrder as CardBulkOrder,
type CardBulkOrdersCursorPage as CardBulkOrdersCursorPage,
type CardBulkOrderCreateParams as CardBulkOrderCreateParams,
type CardBulkOrderUpdateParams as CardBulkOrderUpdateParams,
type CardBulkOrderListParams as CardBulkOrderListParams,
};
}