rutter-ts 0.3.4 → 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 +18 -6
- package/dist/api.d.cts +8 -3
- package/dist/api.d.ts +8 -3
- package/dist/api.js +18 -6
- package/dist/{client-sPbSz2i_.d.cts → client-DPjGawJr.d.cts} +2 -2
- package/dist/{client-sPbSz2i_.d.ts → client-DPjGawJr.d.ts} +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/package.json +1 -1
package/dist/api.cjs
CHANGED
|
@@ -61,7 +61,11 @@ var RutterConnectionsApi = class {
|
|
|
61
61
|
}
|
|
62
62
|
async exchangeToken(params) {
|
|
63
63
|
const endpoint = "/item/public_token/exchange";
|
|
64
|
-
const response = await this.client.post(endpoint,
|
|
64
|
+
const response = await this.client.post(endpoint, {
|
|
65
|
+
...params,
|
|
66
|
+
client_id: this.client.clientId,
|
|
67
|
+
secret: this.client.clientSecret
|
|
68
|
+
});
|
|
65
69
|
const result = chunkJCJXW7AE_cjs.zExchangeTokenResponse.safeParse(response);
|
|
66
70
|
if (!result.success) {
|
|
67
71
|
throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
|
|
@@ -162,12 +166,16 @@ var RutterAccountingApi = class {
|
|
|
162
166
|
}
|
|
163
167
|
return result.data;
|
|
164
168
|
}
|
|
165
|
-
async createInvoice(accessToken, params,
|
|
169
|
+
async createInvoice(accessToken, params, options) {
|
|
166
170
|
const endpoint = "/accounting/invoices";
|
|
171
|
+
const body = { invoice: params };
|
|
172
|
+
if (options?.responseMode) {
|
|
173
|
+
body.response_mode = options.responseMode;
|
|
174
|
+
}
|
|
167
175
|
const response = await this.client.post(
|
|
168
176
|
`${endpoint}?access_token=${encodeURIComponent(accessToken)}`,
|
|
169
|
-
|
|
170
|
-
idempotencyKey ? { idempotencyKey } : void 0
|
|
177
|
+
body,
|
|
178
|
+
options?.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : void 0
|
|
171
179
|
);
|
|
172
180
|
const result = chunkJCJXW7AE_cjs.zCreateInvoiceResponse.safeParse(response);
|
|
173
181
|
if (!result.success) {
|
|
@@ -178,11 +186,15 @@ var RutterAccountingApi = class {
|
|
|
178
186
|
}
|
|
179
187
|
return result.data;
|
|
180
188
|
}
|
|
181
|
-
async createCustomer(accessToken, params) {
|
|
189
|
+
async createCustomer(accessToken, params, options) {
|
|
182
190
|
const endpoint = "/accounting/customers";
|
|
191
|
+
const body = { customer: params };
|
|
192
|
+
if (options?.responseMode) {
|
|
193
|
+
body.response_mode = options.responseMode;
|
|
194
|
+
}
|
|
183
195
|
const response = await this.client.post(
|
|
184
196
|
`${endpoint}?access_token=${encodeURIComponent(accessToken)}`,
|
|
185
|
-
|
|
197
|
+
body
|
|
186
198
|
);
|
|
187
199
|
const result = chunkJCJXW7AE_cjs.zCreateAccountingCustomerResponse.safeParse(response);
|
|
188
200
|
if (!result.success) {
|
package/dist/api.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import z__default from 'zod';
|
|
2
|
-
import { b as RutterClient, c as RutterPaginationParams, d as RutterQueryParams } from './client-
|
|
2
|
+
import { b as RutterClient, c as RutterPaginationParams, d as RutterQueryParams } from './client-DPjGawJr.cjs';
|
|
3
3
|
import { zConnectionResponse, zListConnectionsResponse, zExchangeTokenResponse, zDeleteConnectionResponse, zCompanyInfo20240430ResponseWithConnection, zListAccountResponseWithConnection, zAccountResponseWithConnection, zListInvoiceResponseWithConnection, zInvoiceResponseWithConnection, CreateInvoice, zCreateInvoiceResponse, CreateAccountingCustomer, zCreateAccountingCustomerResponse } from './generated.cjs';
|
|
4
4
|
|
|
5
5
|
declare const zGetAccessTokenConnectionResponse: z__default.ZodObject<{
|
|
@@ -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,
|
|
180
|
-
|
|
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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import z__default from 'zod';
|
|
2
|
-
import { b as RutterClient, c as RutterPaginationParams, d as RutterQueryParams } from './client-
|
|
2
|
+
import { b as RutterClient, c as RutterPaginationParams, d as RutterQueryParams } from './client-DPjGawJr.js';
|
|
3
3
|
import { zConnectionResponse, zListConnectionsResponse, zExchangeTokenResponse, zDeleteConnectionResponse, zCompanyInfo20240430ResponseWithConnection, zListAccountResponseWithConnection, zAccountResponseWithConnection, zListInvoiceResponseWithConnection, zInvoiceResponseWithConnection, CreateInvoice, zCreateInvoiceResponse, CreateAccountingCustomer, zCreateAccountingCustomerResponse } from './generated.js';
|
|
4
4
|
|
|
5
5
|
declare const zGetAccessTokenConnectionResponse: z__default.ZodObject<{
|
|
@@ -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,
|
|
180
|
-
|
|
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
|
@@ -55,7 +55,11 @@ var RutterConnectionsApi = class {
|
|
|
55
55
|
}
|
|
56
56
|
async exchangeToken(params) {
|
|
57
57
|
const endpoint = "/item/public_token/exchange";
|
|
58
|
-
const response = await this.client.post(endpoint,
|
|
58
|
+
const response = await this.client.post(endpoint, {
|
|
59
|
+
...params,
|
|
60
|
+
client_id: this.client.clientId,
|
|
61
|
+
secret: this.client.clientSecret
|
|
62
|
+
});
|
|
59
63
|
const result = zExchangeTokenResponse.safeParse(response);
|
|
60
64
|
if (!result.success) {
|
|
61
65
|
throw new RutterSchemaMismatchError(
|
|
@@ -156,12 +160,16 @@ var RutterAccountingApi = class {
|
|
|
156
160
|
}
|
|
157
161
|
return result.data;
|
|
158
162
|
}
|
|
159
|
-
async createInvoice(accessToken, params,
|
|
163
|
+
async createInvoice(accessToken, params, options) {
|
|
160
164
|
const endpoint = "/accounting/invoices";
|
|
165
|
+
const body = { invoice: params };
|
|
166
|
+
if (options?.responseMode) {
|
|
167
|
+
body.response_mode = options.responseMode;
|
|
168
|
+
}
|
|
161
169
|
const response = await this.client.post(
|
|
162
170
|
`${endpoint}?access_token=${encodeURIComponent(accessToken)}`,
|
|
163
|
-
|
|
164
|
-
idempotencyKey ? { idempotencyKey } : void 0
|
|
171
|
+
body,
|
|
172
|
+
options?.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : void 0
|
|
165
173
|
);
|
|
166
174
|
const result = zCreateInvoiceResponse.safeParse(response);
|
|
167
175
|
if (!result.success) {
|
|
@@ -172,11 +180,15 @@ var RutterAccountingApi = class {
|
|
|
172
180
|
}
|
|
173
181
|
return result.data;
|
|
174
182
|
}
|
|
175
|
-
async createCustomer(accessToken, params) {
|
|
183
|
+
async createCustomer(accessToken, params, options) {
|
|
176
184
|
const endpoint = "/accounting/customers";
|
|
185
|
+
const body = { customer: params };
|
|
186
|
+
if (options?.responseMode) {
|
|
187
|
+
body.response_mode = options.responseMode;
|
|
188
|
+
}
|
|
177
189
|
const response = await this.client.post(
|
|
178
190
|
`${endpoint}?access_token=${encodeURIComponent(accessToken)}`,
|
|
179
|
-
|
|
191
|
+
body
|
|
180
192
|
);
|
|
181
193
|
const result = zCreateAccountingCustomerResponse.safeParse(response);
|
|
182
194
|
if (!result.success) {
|
|
@@ -19,8 +19,8 @@ interface RutterRequestOptions {
|
|
|
19
19
|
|
|
20
20
|
declare class RutterClient {
|
|
21
21
|
readonly baseUrl: string;
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
readonly clientId: string;
|
|
23
|
+
readonly clientSecret: string;
|
|
24
24
|
constructor(baseUrl: string, clientId: string, clientSecret: string);
|
|
25
25
|
private get authHeader();
|
|
26
26
|
private request;
|
|
@@ -19,8 +19,8 @@ interface RutterRequestOptions {
|
|
|
19
19
|
|
|
20
20
|
declare class RutterClient {
|
|
21
21
|
readonly baseUrl: string;
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
readonly clientId: string;
|
|
23
|
+
readonly clientSecret: string;
|
|
24
24
|
constructor(baseUrl: string, clientId: string, clientSecret: string);
|
|
25
25
|
private get authHeader();
|
|
26
26
|
private request;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RutterErrorMetadata, a as RutterErrorBody } from './client-
|
|
2
|
-
export { b as RutterClient, c as RutterPaginationParams, d as RutterQueryParams, e as RutterRequestOptions } from './client-
|
|
1
|
+
import { R as RutterErrorMetadata, a as RutterErrorBody } from './client-DPjGawJr.cjs';
|
|
2
|
+
export { b as RutterClient, c as RutterPaginationParams, d as RutterQueryParams, e as RutterRequestOptions } from './client-DPjGawJr.cjs';
|
|
3
3
|
|
|
4
4
|
declare class RutterError extends Error {
|
|
5
5
|
readonly status: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RutterErrorMetadata, a as RutterErrorBody } from './client-
|
|
2
|
-
export { b as RutterClient, c as RutterPaginationParams, d as RutterQueryParams, e as RutterRequestOptions } from './client-
|
|
1
|
+
import { R as RutterErrorMetadata, a as RutterErrorBody } from './client-DPjGawJr.js';
|
|
2
|
+
export { b as RutterClient, c as RutterPaginationParams, d as RutterQueryParams, e as RutterRequestOptions } from './client-DPjGawJr.js';
|
|
3
3
|
|
|
4
4
|
declare class RutterError extends Error {
|
|
5
5
|
readonly status: number;
|