Skip to content

Commit ffa041c

Browse files
Add client override for customFetcher (#45)
Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
1 parent b15692e commit ffa041c

File tree

244 files changed

+1314
-933
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

244 files changed

+1314
-933
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mergeapi/merge-node-client",
3-
"version": "1.0.11",
3+
"version": "1.0.12",
44
"private": false,
55
"repository": "https://github.com/merge-api/merge-node-client",
66
"main": "./index.js",

src/Client.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@
55
import * as environments from "./environments";
66
import * as core from "./core";
77
import { Filestorage } from "./api/resources/filestorage/client/Client";
8-
import { Ticketing } from "./api/resources/ticketing/client/Client";
98
import { Ats } from "./api/resources/ats/client/Client";
109
import { Crm } from "./api/resources/crm/client/Client";
1110
import { Hris } from "./api/resources/hris/client/Client";
11+
import { Ticketing } from "./api/resources/ticketing/client/Client";
1212
import { Accounting } from "./api/resources/accounting/client/Client";
1313

1414
export declare namespace MergeClient {
1515
interface Options {
1616
environment?: core.Supplier<environments.MergeEnvironment | string>;
1717
apiKey: core.Supplier<core.BearerToken>;
1818
accountToken?: core.Supplier<string | undefined>;
19+
fetcher?: core.FetchFunction;
1920
}
2021

2122
interface RequestOptions {
@@ -33,12 +34,6 @@ export class MergeClient {
3334
return (this._filestorage ??= new Filestorage(this._options));
3435
}
3536

36-
protected _ticketing: Ticketing | undefined;
37-
38-
public get ticketing(): Ticketing {
39-
return (this._ticketing ??= new Ticketing(this._options));
40-
}
41-
4237
protected _ats: Ats | undefined;
4338

4439
public get ats(): Ats {
@@ -57,6 +52,12 @@ export class MergeClient {
5752
return (this._hris ??= new Hris(this._options));
5853
}
5954

55+
protected _ticketing: Ticketing | undefined;
56+
57+
public get ticketing(): Ticketing {
58+
return (this._ticketing ??= new Ticketing(this._options));
59+
}
60+
6061
protected _accounting: Accounting | undefined;
6162

6263
public get accounting(): Accounting {

src/api/resources/accounting/client/Client.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export declare namespace Accounting {
4848
environment?: core.Supplier<environments.MergeEnvironment | string>;
4949
apiKey: core.Supplier<core.BearerToken>;
5050
accountToken?: core.Supplier<string | undefined>;
51+
fetcher?: core.FetchFunction;
5152
}
5253

5354
interface RequestOptions {

src/api/resources/accounting/resources/accountDetails/client/Client.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export declare namespace AccountDetails {
1414
environment?: core.Supplier<environments.MergeEnvironment | string>;
1515
apiKey: core.Supplier<core.BearerToken>;
1616
accountToken?: core.Supplier<string | undefined>;
17+
fetcher?: core.FetchFunction;
1718
}
1819

1920
interface RequestOptions {
@@ -32,7 +33,7 @@ export class AccountDetails {
3233
* await merge.accounting.accountDetails.retrieve()
3334
*/
3435
public async retrieve(requestOptions?: AccountDetails.RequestOptions): Promise<Merge.accounting.AccountDetails> {
35-
const _response = await core.fetcher({
36+
const _response = await (this._options.fetcher ?? core.fetcher)({
3637
url: urlJoin(
3738
(await core.Supplier.get(this._options.environment)) ?? environments.MergeEnvironment.Production,
3839
"accounting/v1/account-details"
@@ -46,7 +47,7 @@ export class AccountDetails {
4647
: undefined,
4748
"X-Fern-Language": "JavaScript",
4849
"X-Fern-SDK-Name": "@mergeapi/merge-node-client",
49-
"X-Fern-SDK-Version": "1.0.11",
50+
"X-Fern-SDK-Version": "1.0.12",
5051
},
5152
contentType: "application/json",
5253
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,

src/api/resources/accounting/resources/accountToken/client/Client.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export declare namespace AccountToken {
1414
environment?: core.Supplier<environments.MergeEnvironment | string>;
1515
apiKey: core.Supplier<core.BearerToken>;
1616
accountToken?: core.Supplier<string | undefined>;
17+
fetcher?: core.FetchFunction;
1718
}
1819

1920
interface RequestOptions {
@@ -35,7 +36,7 @@ export class AccountToken {
3536
publicToken: string,
3637
requestOptions?: AccountToken.RequestOptions
3738
): Promise<Merge.accounting.AccountToken> {
38-
const _response = await core.fetcher({
39+
const _response = await (this._options.fetcher ?? core.fetcher)({
3940
url: urlJoin(
4041
(await core.Supplier.get(this._options.environment)) ?? environments.MergeEnvironment.Production,
4142
`accounting/v1/account-token/${publicToken}`
@@ -49,7 +50,7 @@ export class AccountToken {
4950
: undefined,
5051
"X-Fern-Language": "JavaScript",
5152
"X-Fern-SDK-Name": "@mergeapi/merge-node-client",
52-
"X-Fern-SDK-Version": "1.0.11",
53+
"X-Fern-SDK-Version": "1.0.12",
5354
},
5455
contentType: "application/json",
5556
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,

src/api/resources/accounting/resources/accountingPeriods/client/Client.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export declare namespace AccountingPeriods {
1414
environment?: core.Supplier<environments.MergeEnvironment | string>;
1515
apiKey: core.Supplier<core.BearerToken>;
1616
accountToken?: core.Supplier<string | undefined>;
17+
fetcher?: core.FetchFunction;
1718
}
1819

1920
interface RequestOptions {
@@ -57,7 +58,7 @@ export class AccountingPeriods {
5758
_queryParams["page_size"] = pageSize.toString();
5859
}
5960

60-
const _response = await core.fetcher({
61+
const _response = await (this._options.fetcher ?? core.fetcher)({
6162
url: urlJoin(
6263
(await core.Supplier.get(this._options.environment)) ?? environments.MergeEnvironment.Production,
6364
"accounting/v1/accounting-periods"
@@ -71,7 +72,7 @@ export class AccountingPeriods {
7172
: undefined,
7273
"X-Fern-Language": "JavaScript",
7374
"X-Fern-SDK-Name": "@mergeapi/merge-node-client",
74-
"X-Fern-SDK-Version": "1.0.11",
75+
"X-Fern-SDK-Version": "1.0.12",
7576
},
7677
contentType: "application/json",
7778
queryParameters: _queryParams,
@@ -127,7 +128,7 @@ export class AccountingPeriods {
127128
_queryParams["include_remote_data"] = includeRemoteData.toString();
128129
}
129130

130-
const _response = await core.fetcher({
131+
const _response = await (this._options.fetcher ?? core.fetcher)({
131132
url: urlJoin(
132133
(await core.Supplier.get(this._options.environment)) ?? environments.MergeEnvironment.Production,
133134
`accounting/v1/accounting-periods/${id}`
@@ -141,7 +142,7 @@ export class AccountingPeriods {
141142
: undefined,
142143
"X-Fern-Language": "JavaScript",
143144
"X-Fern-SDK-Name": "@mergeapi/merge-node-client",
144-
"X-Fern-SDK-Version": "1.0.11",
145+
"X-Fern-SDK-Version": "1.0.12",
145146
},
146147
contentType: "application/json",
147148
queryParameters: _queryParams,

src/api/resources/accounting/resources/accounts/client/Client.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export declare namespace Accounts {
1414
environment?: core.Supplier<environments.MergeEnvironment | string>;
1515
apiKey: core.Supplier<core.BearerToken>;
1616
accountToken?: core.Supplier<string | undefined>;
17+
fetcher?: core.FetchFunction;
1718
}
1819

1920
interface RequestOptions {
@@ -108,7 +109,7 @@ export class Accounts {
108109
_queryParams["show_enum_origins"] = showEnumOrigins;
109110
}
110111

111-
const _response = await core.fetcher({
112+
const _response = await (this._options.fetcher ?? core.fetcher)({
112113
url: urlJoin(
113114
(await core.Supplier.get(this._options.environment)) ?? environments.MergeEnvironment.Production,
114115
"accounting/v1/accounts"
@@ -122,7 +123,7 @@ export class Accounts {
122123
: undefined,
123124
"X-Fern-Language": "JavaScript",
124125
"X-Fern-SDK-Name": "@mergeapi/merge-node-client",
125-
"X-Fern-SDK-Version": "1.0.11",
126+
"X-Fern-SDK-Version": "1.0.12",
126127
},
127128
contentType: "application/json",
128129
queryParameters: _queryParams,
@@ -183,7 +184,7 @@ export class Accounts {
183184
_queryParams["run_async"] = runAsync.toString();
184185
}
185186

186-
const _response = await core.fetcher({
187+
const _response = await (this._options.fetcher ?? core.fetcher)({
187188
url: urlJoin(
188189
(await core.Supplier.get(this._options.environment)) ?? environments.MergeEnvironment.Production,
189190
"accounting/v1/accounts"
@@ -197,7 +198,7 @@ export class Accounts {
197198
: undefined,
198199
"X-Fern-Language": "JavaScript",
199200
"X-Fern-SDK-Name": "@mergeapi/merge-node-client",
200-
"X-Fern-SDK-Version": "1.0.11",
201+
"X-Fern-SDK-Version": "1.0.12",
201202
},
202203
contentType: "application/json",
203204
queryParameters: _queryParams,
@@ -268,7 +269,7 @@ export class Accounts {
268269
_queryParams["show_enum_origins"] = showEnumOrigins;
269270
}
270271

271-
const _response = await core.fetcher({
272+
const _response = await (this._options.fetcher ?? core.fetcher)({
272273
url: urlJoin(
273274
(await core.Supplier.get(this._options.environment)) ?? environments.MergeEnvironment.Production,
274275
`accounting/v1/accounts/${id}`
@@ -282,7 +283,7 @@ export class Accounts {
282283
: undefined,
283284
"X-Fern-Language": "JavaScript",
284285
"X-Fern-SDK-Name": "@mergeapi/merge-node-client",
285-
"X-Fern-SDK-Version": "1.0.11",
286+
"X-Fern-SDK-Version": "1.0.12",
286287
},
287288
contentType: "application/json",
288289
queryParameters: _queryParams,
@@ -328,7 +329,7 @@ export class Accounts {
328329
* await merge.accounting.accounts.metaPostRetrieve()
329330
*/
330331
public async metaPostRetrieve(requestOptions?: Accounts.RequestOptions): Promise<Merge.accounting.MetaResponse> {
331-
const _response = await core.fetcher({
332+
const _response = await (this._options.fetcher ?? core.fetcher)({
332333
url: urlJoin(
333334
(await core.Supplier.get(this._options.environment)) ?? environments.MergeEnvironment.Production,
334335
"accounting/v1/accounts/meta/post"
@@ -342,7 +343,7 @@ export class Accounts {
342343
: undefined,
343344
"X-Fern-Language": "JavaScript",
344345
"X-Fern-SDK-Name": "@mergeapi/merge-node-client",
345-
"X-Fern-SDK-Version": "1.0.11",
346+
"X-Fern-SDK-Version": "1.0.12",
346347
},
347348
contentType: "application/json",
348349
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,

src/api/resources/accounting/resources/addresses/client/Client.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export declare namespace Addresses {
1414
environment?: core.Supplier<environments.MergeEnvironment | string>;
1515
apiKey: core.Supplier<core.BearerToken>;
1616
accountToken?: core.Supplier<string | undefined>;
17+
fetcher?: core.FetchFunction;
1718
}
1819

1920
interface RequestOptions {
@@ -50,7 +51,7 @@ export class Addresses {
5051
_queryParams["show_enum_origins"] = showEnumOrigins;
5152
}
5253

53-
const _response = await core.fetcher({
54+
const _response = await (this._options.fetcher ?? core.fetcher)({
5455
url: urlJoin(
5556
(await core.Supplier.get(this._options.environment)) ?? environments.MergeEnvironment.Production,
5657
`accounting/v1/addresses/${id}`
@@ -64,7 +65,7 @@ export class Addresses {
6465
: undefined,
6566
"X-Fern-Language": "JavaScript",
6667
"X-Fern-SDK-Name": "@mergeapi/merge-node-client",
67-
"X-Fern-SDK-Version": "1.0.11",
68+
"X-Fern-SDK-Version": "1.0.12",
6869
},
6970
contentType: "application/json",
7071
queryParameters: _queryParams,

src/api/resources/accounting/resources/asyncPassthrough/client/Client.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export declare namespace AsyncPassthrough {
1414
environment?: core.Supplier<environments.MergeEnvironment | string>;
1515
apiKey: core.Supplier<core.BearerToken>;
1616
accountToken?: core.Supplier<string | undefined>;
17+
fetcher?: core.FetchFunction;
1718
}
1819

1920
interface RequestOptions {
@@ -38,7 +39,7 @@ export class AsyncPassthrough {
3839
request: Merge.accounting.DataPassthroughRequest,
3940
requestOptions?: AsyncPassthrough.RequestOptions
4041
): Promise<Merge.accounting.AsyncPassthroughReciept> {
41-
const _response = await core.fetcher({
42+
const _response = await (this._options.fetcher ?? core.fetcher)({
4243
url: urlJoin(
4344
(await core.Supplier.get(this._options.environment)) ?? environments.MergeEnvironment.Production,
4445
"accounting/v1/async-passthrough"
@@ -52,7 +53,7 @@ export class AsyncPassthrough {
5253
: undefined,
5354
"X-Fern-Language": "JavaScript",
5455
"X-Fern-SDK-Name": "@mergeapi/merge-node-client",
55-
"X-Fern-SDK-Version": "1.0.11",
56+
"X-Fern-SDK-Version": "1.0.12",
5657
},
5758
contentType: "application/json",
5859
body: await serializers.accounting.DataPassthroughRequest.jsonOrThrow(request, {
@@ -95,15 +96,12 @@ export class AsyncPassthrough {
9596

9697
/**
9798
* Retrieves data from earlier async-passthrough POST request
98-
*
99-
* @example
100-
* await merge.accounting.asyncPassthrough.retrieve("async_passthrough_receipt_id")
10199
*/
102100
public async retrieve(
103101
asyncPassthroughReceiptId: string,
104102
requestOptions?: AsyncPassthrough.RequestOptions
105-
): Promise<Merge.accounting.RemoteResponse> {
106-
const _response = await core.fetcher({
103+
): Promise<Merge.accounting.AsyncPassthroughRetrieveResponse> {
104+
const _response = await (this._options.fetcher ?? core.fetcher)({
107105
url: urlJoin(
108106
(await core.Supplier.get(this._options.environment)) ?? environments.MergeEnvironment.Production,
109107
`accounting/v1/async-passthrough/${asyncPassthroughReceiptId}`
@@ -117,14 +115,14 @@ export class AsyncPassthrough {
117115
: undefined,
118116
"X-Fern-Language": "JavaScript",
119117
"X-Fern-SDK-Name": "@mergeapi/merge-node-client",
120-
"X-Fern-SDK-Version": "1.0.11",
118+
"X-Fern-SDK-Version": "1.0.12",
121119
},
122120
contentType: "application/json",
123121
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
124122
maxRetries: requestOptions?.maxRetries,
125123
});
126124
if (_response.ok) {
127-
return await serializers.accounting.RemoteResponse.parseOrThrow(_response.body, {
125+
return await serializers.accounting.AsyncPassthroughRetrieveResponse.parseOrThrow(_response.body, {
128126
unrecognizedObjectKeys: "passthrough",
129127
allowUnrecognizedUnionMembers: true,
130128
allowUnrecognizedEnumValues: true,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
export * from "./types";
12
export * from "./client";

0 commit comments

Comments
 (0)