rutter-ts 0.3.5 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/api.cjs CHANGED
@@ -166,12 +166,16 @@ var RutterAccountingApi = class {
166
166
  }
167
167
  return result.data;
168
168
  }
169
- async createInvoice(accessToken, params, idempotencyKey) {
169
+ async createInvoice(accessToken, params, options) {
170
170
  const endpoint = "/accounting/invoices";
171
+ const body = { invoice: params };
172
+ if (options?.responseMode) {
173
+ body.response_mode = options.responseMode;
174
+ }
171
175
  const response = await this.client.post(
172
176
  `${endpoint}?access_token=${encodeURIComponent(accessToken)}`,
173
- params,
174
- idempotencyKey ? { idempotencyKey } : void 0
177
+ body,
178
+ options?.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : void 0
175
179
  );
176
180
  const result = chunkJCJXW7AE_cjs.zCreateInvoiceResponse.safeParse(response);
177
181
  if (!result.success) {
@@ -182,11 +186,15 @@ var RutterAccountingApi = class {
182
186
  }
183
187
  return result.data;
184
188
  }
185
- async createCustomer(accessToken, params) {
189
+ async createCustomer(accessToken, params, options) {
186
190
  const endpoint = "/accounting/customers";
191
+ const body = { customer: params };
192
+ if (options?.responseMode) {
193
+ body.response_mode = options.responseMode;
194
+ }
187
195
  const response = await this.client.post(
188
196
  `${endpoint}?access_token=${encodeURIComponent(accessToken)}`,
189
- { customer: params }
197
+ body
190
198
  );
191
199
  const result = chunkJCJXW7AE_cjs.zCreateAccountingCustomerResponse.safeParse(response);
192
200
  if (!result.success) {
package/dist/api.d.cts CHANGED
@@ -176,8 +176,13 @@ declare class RutterAccountingApi {
176
176
  getAccount(accessToken: string, id: string): Promise<TAccountResponse>;
177
177
  listInvoices(accessToken: string, params?: RutterPaginationParams & RutterQueryParams): Promise<TListInvoicesResponse>;
178
178
  getInvoice(accessToken: string, id: string): Promise<TInvoiceResponse>;
179
- createInvoice(accessToken: string, params: CreateInvoice, idempotencyKey?: string): Promise<TCreateInvoiceResponse>;
180
- createCustomer(accessToken: string, params: CreateAccountingCustomer): Promise<TCreateCustomerResponse>;
179
+ createInvoice(accessToken: string, params: CreateInvoice, options?: {
180
+ idempotencyKey?: string;
181
+ responseMode?: 'async' | 'prefer_sync';
182
+ }): Promise<TCreateInvoiceResponse>;
183
+ createCustomer(accessToken: string, params: CreateAccountingCustomer, options?: {
184
+ responseMode?: 'async' | 'prefer_sync';
185
+ }): Promise<TCreateCustomerResponse>;
181
186
  }
182
187
 
183
188
  export { RutterAccountingApi, RutterConnectionsApi };
package/dist/api.d.ts CHANGED
@@ -176,8 +176,13 @@ declare class RutterAccountingApi {
176
176
  getAccount(accessToken: string, id: string): Promise<TAccountResponse>;
177
177
  listInvoices(accessToken: string, params?: RutterPaginationParams & RutterQueryParams): Promise<TListInvoicesResponse>;
178
178
  getInvoice(accessToken: string, id: string): Promise<TInvoiceResponse>;
179
- createInvoice(accessToken: string, params: CreateInvoice, idempotencyKey?: string): Promise<TCreateInvoiceResponse>;
180
- createCustomer(accessToken: string, params: CreateAccountingCustomer): Promise<TCreateCustomerResponse>;
179
+ createInvoice(accessToken: string, params: CreateInvoice, options?: {
180
+ idempotencyKey?: string;
181
+ responseMode?: 'async' | 'prefer_sync';
182
+ }): Promise<TCreateInvoiceResponse>;
183
+ createCustomer(accessToken: string, params: CreateAccountingCustomer, options?: {
184
+ responseMode?: 'async' | 'prefer_sync';
185
+ }): Promise<TCreateCustomerResponse>;
181
186
  }
182
187
 
183
188
  export { RutterAccountingApi, RutterConnectionsApi };
package/dist/api.js CHANGED
@@ -160,12 +160,16 @@ var RutterAccountingApi = class {
160
160
  }
161
161
  return result.data;
162
162
  }
163
- async createInvoice(accessToken, params, idempotencyKey) {
163
+ async createInvoice(accessToken, params, options) {
164
164
  const endpoint = "/accounting/invoices";
165
+ const body = { invoice: params };
166
+ if (options?.responseMode) {
167
+ body.response_mode = options.responseMode;
168
+ }
165
169
  const response = await this.client.post(
166
170
  `${endpoint}?access_token=${encodeURIComponent(accessToken)}`,
167
- params,
168
- idempotencyKey ? { idempotencyKey } : void 0
171
+ body,
172
+ options?.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : void 0
169
173
  );
170
174
  const result = zCreateInvoiceResponse.safeParse(response);
171
175
  if (!result.success) {
@@ -176,11 +180,15 @@ var RutterAccountingApi = class {
176
180
  }
177
181
  return result.data;
178
182
  }
179
- async createCustomer(accessToken, params) {
183
+ async createCustomer(accessToken, params, options) {
180
184
  const endpoint = "/accounting/customers";
185
+ const body = { customer: params };
186
+ if (options?.responseMode) {
187
+ body.response_mode = options.responseMode;
188
+ }
181
189
  const response = await this.client.post(
182
190
  `${endpoint}?access_token=${encodeURIComponent(accessToken)}`,
183
- { customer: params }
191
+ body
184
192
  );
185
193
  const result = zCreateAccountingCustomerResponse.safeParse(response);
186
194
  if (!result.success) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rutter-ts",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "TypeScript SDK for the Rutter API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",