Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mergeapi/merge-node-client",
"version": "1.0.11",
"version": "1.0.12",
"private": false,
"repository": "https://github.com/merge-api/merge-node-client",
"main": "./index.js",
Expand Down
15 changes: 8 additions & 7 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@
import * as environments from "./environments";
import * as core from "./core";
import { Filestorage } from "./api/resources/filestorage/client/Client";
import { Ticketing } from "./api/resources/ticketing/client/Client";
import { Ats } from "./api/resources/ats/client/Client";
import { Crm } from "./api/resources/crm/client/Client";
import { Hris } from "./api/resources/hris/client/Client";
import { Ticketing } from "./api/resources/ticketing/client/Client";
import { Accounting } from "./api/resources/accounting/client/Client";

export declare namespace MergeClient {
interface Options {
environment?: core.Supplier<environments.MergeEnvironment | string>;
apiKey: core.Supplier<core.BearerToken>;
accountToken?: core.Supplier<string | undefined>;
fetcher?: core.FetchFunction;
}

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

protected _ticketing: Ticketing | undefined;

public get ticketing(): Ticketing {
return (this._ticketing ??= new Ticketing(this._options));
}

protected _ats: Ats | undefined;

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

protected _ticketing: Ticketing | undefined;

public get ticketing(): Ticketing {
return (this._ticketing ??= new Ticketing(this._options));
}

protected _accounting: Accounting | undefined;

public get accounting(): Accounting {
Expand Down
1 change: 1 addition & 0 deletions src/api/resources/accounting/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export declare namespace Accounting {
environment?: core.Supplier<environments.MergeEnvironment | string>;
apiKey: core.Supplier<core.BearerToken>;
accountToken?: core.Supplier<string | undefined>;
fetcher?: core.FetchFunction;
}

interface RequestOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export declare namespace AccountDetails {
environment?: core.Supplier<environments.MergeEnvironment | string>;
apiKey: core.Supplier<core.BearerToken>;
accountToken?: core.Supplier<string | undefined>;
fetcher?: core.FetchFunction;
}

interface RequestOptions {
Expand All @@ -32,7 +33,7 @@ export class AccountDetails {
* await merge.accounting.accountDetails.retrieve()
*/
public async retrieve(requestOptions?: AccountDetails.RequestOptions): Promise<Merge.accounting.AccountDetails> {
const _response = await core.fetcher({
const _response = await (this._options.fetcher ?? core.fetcher)({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.MergeEnvironment.Production,
"accounting/v1/account-details"
Expand All @@ -46,7 +47,7 @@ export class AccountDetails {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@mergeapi/merge-node-client",
"X-Fern-SDK-Version": "1.0.11",
"X-Fern-SDK-Version": "1.0.12",
},
contentType: "application/json",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export declare namespace AccountToken {
environment?: core.Supplier<environments.MergeEnvironment | string>;
apiKey: core.Supplier<core.BearerToken>;
accountToken?: core.Supplier<string | undefined>;
fetcher?: core.FetchFunction;
}

interface RequestOptions {
Expand All @@ -35,7 +36,7 @@ export class AccountToken {
publicToken: string,
requestOptions?: AccountToken.RequestOptions
): Promise<Merge.accounting.AccountToken> {
const _response = await core.fetcher({
const _response = await (this._options.fetcher ?? core.fetcher)({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.MergeEnvironment.Production,
`accounting/v1/account-token/${publicToken}`
Expand All @@ -49,7 +50,7 @@ export class AccountToken {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@mergeapi/merge-node-client",
"X-Fern-SDK-Version": "1.0.11",
"X-Fern-SDK-Version": "1.0.12",
},
contentType: "application/json",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export declare namespace AccountingPeriods {
environment?: core.Supplier<environments.MergeEnvironment | string>;
apiKey: core.Supplier<core.BearerToken>;
accountToken?: core.Supplier<string | undefined>;
fetcher?: core.FetchFunction;
}

interface RequestOptions {
Expand Down Expand Up @@ -57,7 +58,7 @@ export class AccountingPeriods {
_queryParams["page_size"] = pageSize.toString();
}

const _response = await core.fetcher({
const _response = await (this._options.fetcher ?? core.fetcher)({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.MergeEnvironment.Production,
"accounting/v1/accounting-periods"
Expand All @@ -71,7 +72,7 @@ export class AccountingPeriods {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@mergeapi/merge-node-client",
"X-Fern-SDK-Version": "1.0.11",
"X-Fern-SDK-Version": "1.0.12",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand Down Expand Up @@ -127,7 +128,7 @@ export class AccountingPeriods {
_queryParams["include_remote_data"] = includeRemoteData.toString();
}

const _response = await core.fetcher({
const _response = await (this._options.fetcher ?? core.fetcher)({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.MergeEnvironment.Production,
`accounting/v1/accounting-periods/${id}`
Expand All @@ -141,7 +142,7 @@ export class AccountingPeriods {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@mergeapi/merge-node-client",
"X-Fern-SDK-Version": "1.0.11",
"X-Fern-SDK-Version": "1.0.12",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand Down
17 changes: 9 additions & 8 deletions src/api/resources/accounting/resources/accounts/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export declare namespace Accounts {
environment?: core.Supplier<environments.MergeEnvironment | string>;
apiKey: core.Supplier<core.BearerToken>;
accountToken?: core.Supplier<string | undefined>;
fetcher?: core.FetchFunction;
}

interface RequestOptions {
Expand Down Expand Up @@ -108,7 +109,7 @@ export class Accounts {
_queryParams["show_enum_origins"] = showEnumOrigins;
}

const _response = await core.fetcher({
const _response = await (this._options.fetcher ?? core.fetcher)({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.MergeEnvironment.Production,
"accounting/v1/accounts"
Expand All @@ -122,7 +123,7 @@ export class Accounts {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@mergeapi/merge-node-client",
"X-Fern-SDK-Version": "1.0.11",
"X-Fern-SDK-Version": "1.0.12",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand Down Expand Up @@ -183,7 +184,7 @@ export class Accounts {
_queryParams["run_async"] = runAsync.toString();
}

const _response = await core.fetcher({
const _response = await (this._options.fetcher ?? core.fetcher)({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.MergeEnvironment.Production,
"accounting/v1/accounts"
Expand All @@ -197,7 +198,7 @@ export class Accounts {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@mergeapi/merge-node-client",
"X-Fern-SDK-Version": "1.0.11",
"X-Fern-SDK-Version": "1.0.12",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand Down Expand Up @@ -268,7 +269,7 @@ export class Accounts {
_queryParams["show_enum_origins"] = showEnumOrigins;
}

const _response = await core.fetcher({
const _response = await (this._options.fetcher ?? core.fetcher)({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.MergeEnvironment.Production,
`accounting/v1/accounts/${id}`
Expand All @@ -282,7 +283,7 @@ export class Accounts {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@mergeapi/merge-node-client",
"X-Fern-SDK-Version": "1.0.11",
"X-Fern-SDK-Version": "1.0.12",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand Down Expand Up @@ -328,7 +329,7 @@ export class Accounts {
* await merge.accounting.accounts.metaPostRetrieve()
*/
public async metaPostRetrieve(requestOptions?: Accounts.RequestOptions): Promise<Merge.accounting.MetaResponse> {
const _response = await core.fetcher({
const _response = await (this._options.fetcher ?? core.fetcher)({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.MergeEnvironment.Production,
"accounting/v1/accounts/meta/post"
Expand All @@ -342,7 +343,7 @@ export class Accounts {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@mergeapi/merge-node-client",
"X-Fern-SDK-Version": "1.0.11",
"X-Fern-SDK-Version": "1.0.12",
},
contentType: "application/json",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export declare namespace Addresses {
environment?: core.Supplier<environments.MergeEnvironment | string>;
apiKey: core.Supplier<core.BearerToken>;
accountToken?: core.Supplier<string | undefined>;
fetcher?: core.FetchFunction;
}

interface RequestOptions {
Expand Down Expand Up @@ -50,7 +51,7 @@ export class Addresses {
_queryParams["show_enum_origins"] = showEnumOrigins;
}

const _response = await core.fetcher({
const _response = await (this._options.fetcher ?? core.fetcher)({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.MergeEnvironment.Production,
`accounting/v1/addresses/${id}`
Expand All @@ -64,7 +65,7 @@ export class Addresses {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@mergeapi/merge-node-client",
"X-Fern-SDK-Version": "1.0.11",
"X-Fern-SDK-Version": "1.0.12",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export declare namespace AsyncPassthrough {
environment?: core.Supplier<environments.MergeEnvironment | string>;
apiKey: core.Supplier<core.BearerToken>;
accountToken?: core.Supplier<string | undefined>;
fetcher?: core.FetchFunction;
}

interface RequestOptions {
Expand All @@ -38,7 +39,7 @@ export class AsyncPassthrough {
request: Merge.accounting.DataPassthroughRequest,
requestOptions?: AsyncPassthrough.RequestOptions
): Promise<Merge.accounting.AsyncPassthroughReciept> {
const _response = await core.fetcher({
const _response = await (this._options.fetcher ?? core.fetcher)({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.MergeEnvironment.Production,
"accounting/v1/async-passthrough"
Expand All @@ -52,7 +53,7 @@ export class AsyncPassthrough {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@mergeapi/merge-node-client",
"X-Fern-SDK-Version": "1.0.11",
"X-Fern-SDK-Version": "1.0.12",
},
contentType: "application/json",
body: await serializers.accounting.DataPassthroughRequest.jsonOrThrow(request, {
Expand Down Expand Up @@ -95,15 +96,12 @@ export class AsyncPassthrough {

/**
* Retrieves data from earlier async-passthrough POST request
*
* @example
* await merge.accounting.asyncPassthrough.retrieve("async_passthrough_receipt_id")
*/
public async retrieve(
asyncPassthroughReceiptId: string,
requestOptions?: AsyncPassthrough.RequestOptions
): Promise<Merge.accounting.RemoteResponse> {
const _response = await core.fetcher({
): Promise<Merge.accounting.AsyncPassthroughRetrieveResponse> {
const _response = await (this._options.fetcher ?? core.fetcher)({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.MergeEnvironment.Production,
`accounting/v1/async-passthrough/${asyncPassthroughReceiptId}`
Expand All @@ -117,14 +115,14 @@ export class AsyncPassthrough {
: undefined,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@mergeapi/merge-node-client",
"X-Fern-SDK-Version": "1.0.11",
"X-Fern-SDK-Version": "1.0.12",
},
contentType: "application/json",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
});
if (_response.ok) {
return await serializers.accounting.RemoteResponse.parseOrThrow(_response.body, {
return await serializers.accounting.AsyncPassthroughRetrieveResponse.parseOrThrow(_response.body, {
unrecognizedObjectKeys: "passthrough",
allowUnrecognizedUnionMembers: true,
allowUnrecognizedEnumValues: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from "./types";
export * from "./client";
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

import * as Merge from "../../../../..";

export type AsyncPassthroughRetrieveResponse = Merge.accounting.RemoteResponse | string;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./AsyncPassthroughRetrieveResponse";
Loading
Loading