From 2ffff9e4fcd0a3db13847b080fc00ab47e987c83 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Mon, 21 Aug 2023 18:29:51 +0000 Subject: [PATCH] Release 1.0.2 --- .gitignore | 2 ++ package.json | 2 +- src/Client.ts | 3 ++- .../businessUserEvents/client/Client.ts | 10 +++++++--- .../resources/businessUsers/client/Client.ts | 17 ++++++++++++----- .../consumerUserEvents/client/Client.ts | 10 +++++++--- .../resources/consumerUsers/client/Client.ts | 17 ++++++++++++----- .../transactionEvents/client/Client.ts | 17 ++++++++++++----- src/api/resources/transactions/client/Client.ts | 17 ++++++++++++----- src/api/types/Address.ts | 2 +- ...ilsUserSegment.ts => BusinessUserSegment.ts} | 14 ++------------ src/api/types/CompanyGeneralDetails.ts | 3 +-- src/api/types/index.ts | 2 +- src/environments.ts | 9 +++++++++ src/index.ts | 1 + src/serialization/types/Address.ts | 4 ++-- ...ilsUserSegment.ts => BusinessUserSegment.ts} | 8 ++++---- .../types/CompanyGeneralDetails.ts | 4 ++-- src/serialization/types/index.ts | 2 +- 19 files changed, 91 insertions(+), 53 deletions(-) rename src/api/types/{CompanyGeneralDetailsUserSegment.ts => BusinessUserSegment.ts} (50%) create mode 100644 src/environments.ts rename src/serialization/types/{CompanyGeneralDetailsUserSegment.ts => BusinessUserSegment.ts} (63%) diff --git a/.gitignore b/.gitignore index 050eae0..1498321 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ node_modules /dist /Client.d.ts /Client.js +/environments.d.ts +/environments.js /index.d.ts /index.js /api diff --git a/package.json b/package.json index ae6bb27..5ec27bd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "flagright", - "version": "1.0.0", + "version": "1.0.2", "private": false, "repository": "https://github.com/flagright/flagright-node", "main": "./index.js", diff --git a/src/Client.ts b/src/Client.ts index 26c4499..10f1f5c 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -2,6 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ +import * as environments from "./environments"; import * as core from "./core"; import { Transactions } from "./api/resources/transactions/client/Client"; import { TransactionEvents } from "./api/resources/transactionEvents/client/Client"; @@ -12,7 +13,7 @@ import { BusinessUserEvents } from "./api/resources/businessUserEvents/client/Cl export declare namespace FlagrightClient { interface Options { - environment: core.Supplier; + environment?: core.Supplier; apiKey: core.Supplier; } diff --git a/src/api/resources/businessUserEvents/client/Client.ts b/src/api/resources/businessUserEvents/client/Client.ts index 4525b88..f16edb2 100644 --- a/src/api/resources/businessUserEvents/client/Client.ts +++ b/src/api/resources/businessUserEvents/client/Client.ts @@ -2,6 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ +import * as environments from "../../../../environments"; import * as core from "../../../../core"; import * as Flagright from "../../.."; import { default as URLSearchParams } from "@ungap/url-search-params"; @@ -11,7 +12,7 @@ import * as errors from "../../../../errors"; export declare namespace BusinessUserEvents { interface Options { - environment: core.Supplier; + environment?: core.Supplier; apiKey: core.Supplier; } @@ -59,13 +60,16 @@ export class BusinessUserEvents { } const _response = await core.fetcher({ - url: urlJoin(await core.Supplier.get(this._options.environment), "events/business/user"), + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.FlagrightEnvironment.Default, + "events/business/user" + ), method: "POST", headers: { "x-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "flagright", - "X-Fern-SDK-Version": "1.0.0", + "X-Fern-SDK-Version": "1.0.2", }, contentType: "application/json", queryParameters: _queryParams, diff --git a/src/api/resources/businessUsers/client/Client.ts b/src/api/resources/businessUsers/client/Client.ts index f8e677b..1e55cbe 100644 --- a/src/api/resources/businessUsers/client/Client.ts +++ b/src/api/resources/businessUsers/client/Client.ts @@ -2,6 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ +import * as environments from "../../../../environments"; import * as core from "../../../../core"; import * as Flagright from "../../.."; import * as serializers from "../../../../serialization"; @@ -10,7 +11,7 @@ import * as errors from "../../../../errors"; export declare namespace BusinessUsers { interface Options { - environment: core.Supplier; + environment?: core.Supplier; apiKey: core.Supplier; } @@ -46,13 +47,16 @@ export class BusinessUsers { requestOptions?: BusinessUsers.RequestOptions ): Promise { const _response = await core.fetcher({ - url: urlJoin(await core.Supplier.get(this._options.environment), "business/users"), + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.FlagrightEnvironment.Default, + "business/users" + ), method: "POST", headers: { "x-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "flagright", - "X-Fern-SDK-Version": "1.0.0", + "X-Fern-SDK-Version": "1.0.2", }, contentType: "application/json", body: await serializers.Business.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), @@ -112,13 +116,16 @@ export class BusinessUsers { requestOptions?: BusinessUsers.RequestOptions ): Promise { const _response = await core.fetcher({ - url: urlJoin(await core.Supplier.get(this._options.environment), `business/users/${userId}`), + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.FlagrightEnvironment.Default, + `business/users/${userId}` + ), method: "GET", headers: { "x-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "flagright", - "X-Fern-SDK-Version": "1.0.0", + "X-Fern-SDK-Version": "1.0.2", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, diff --git a/src/api/resources/consumerUserEvents/client/Client.ts b/src/api/resources/consumerUserEvents/client/Client.ts index 15a5864..16915a2 100644 --- a/src/api/resources/consumerUserEvents/client/Client.ts +++ b/src/api/resources/consumerUserEvents/client/Client.ts @@ -2,6 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ +import * as environments from "../../../../environments"; import * as core from "../../../../core"; import * as Flagright from "../../.."; import { default as URLSearchParams } from "@ungap/url-search-params"; @@ -11,7 +12,7 @@ import * as errors from "../../../../errors"; export declare namespace ConsumerUserEvents { interface Options { - environment: core.Supplier; + environment?: core.Supplier; apiKey: core.Supplier; } @@ -59,13 +60,16 @@ export class ConsumerUserEvents { } const _response = await core.fetcher({ - url: urlJoin(await core.Supplier.get(this._options.environment), "events/consumer/user"), + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.FlagrightEnvironment.Default, + "events/consumer/user" + ), method: "POST", headers: { "x-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "flagright", - "X-Fern-SDK-Version": "1.0.0", + "X-Fern-SDK-Version": "1.0.2", }, contentType: "application/json", queryParameters: _queryParams, diff --git a/src/api/resources/consumerUsers/client/Client.ts b/src/api/resources/consumerUsers/client/Client.ts index b8e6c63..2ec92bf 100644 --- a/src/api/resources/consumerUsers/client/Client.ts +++ b/src/api/resources/consumerUsers/client/Client.ts @@ -2,6 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ +import * as environments from "../../../../environments"; import * as core from "../../../../core"; import * as Flagright from "../../.."; import * as serializers from "../../../../serialization"; @@ -10,7 +11,7 @@ import * as errors from "../../../../errors"; export declare namespace ConsumerUsers { interface Options { - environment: core.Supplier; + environment?: core.Supplier; apiKey: core.Supplier; } @@ -45,13 +46,16 @@ export class ConsumerUsers { requestOptions?: ConsumerUsers.RequestOptions ): Promise { const _response = await core.fetcher({ - url: urlJoin(await core.Supplier.get(this._options.environment), "consumer/users"), + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.FlagrightEnvironment.Default, + "consumer/users" + ), method: "POST", headers: { "x-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "flagright", - "X-Fern-SDK-Version": "1.0.0", + "X-Fern-SDK-Version": "1.0.2", }, contentType: "application/json", body: await serializers.User.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), @@ -108,13 +112,16 @@ export class ConsumerUsers { */ public async get(userId: string, requestOptions?: ConsumerUsers.RequestOptions): Promise { const _response = await core.fetcher({ - url: urlJoin(await core.Supplier.get(this._options.environment), `consumer/users/${userId}`), + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.FlagrightEnvironment.Default, + `consumer/users/${userId}` + ), method: "GET", headers: { "x-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "flagright", - "X-Fern-SDK-Version": "1.0.0", + "X-Fern-SDK-Version": "1.0.2", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, diff --git a/src/api/resources/transactionEvents/client/Client.ts b/src/api/resources/transactionEvents/client/Client.ts index 26950f6..c568615 100644 --- a/src/api/resources/transactionEvents/client/Client.ts +++ b/src/api/resources/transactionEvents/client/Client.ts @@ -2,6 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ +import * as environments from "../../../../environments"; import * as core from "../../../../core"; import * as Flagright from "../../.."; import * as serializers from "../../../../serialization"; @@ -10,7 +11,7 @@ import * as errors from "../../../../errors"; export declare namespace TransactionEvents { interface Options { - environment: core.Supplier; + environment?: core.Supplier; apiKey: core.Supplier; } @@ -53,13 +54,16 @@ export class TransactionEvents { requestOptions?: TransactionEvents.RequestOptions ): Promise { const _response = await core.fetcher({ - url: urlJoin(await core.Supplier.get(this._options.environment), "events/transaction"), + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.FlagrightEnvironment.Default, + "events/transaction" + ), method: "POST", headers: { "x-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "flagright", - "X-Fern-SDK-Version": "1.0.0", + "X-Fern-SDK-Version": "1.0.2", }, contentType: "application/json", body: await serializers.TransactionEvent.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), @@ -120,13 +124,16 @@ export class TransactionEvents { requestOptions?: TransactionEvents.RequestOptions ): Promise { const _response = await core.fetcher({ - url: urlJoin(await core.Supplier.get(this._options.environment), `events/transaction/${eventId}`), + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.FlagrightEnvironment.Default, + `events/transaction/${eventId}` + ), method: "GET", headers: { "x-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "flagright", - "X-Fern-SDK-Version": "1.0.0", + "X-Fern-SDK-Version": "1.0.2", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, diff --git a/src/api/resources/transactions/client/Client.ts b/src/api/resources/transactions/client/Client.ts index 1eb2cac..b8ecbe9 100644 --- a/src/api/resources/transactions/client/Client.ts +++ b/src/api/resources/transactions/client/Client.ts @@ -2,6 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ +import * as environments from "../../../../environments"; import * as core from "../../../../core"; import * as Flagright from "../../.."; import { default as URLSearchParams } from "@ungap/url-search-params"; @@ -11,7 +12,7 @@ import * as errors from "../../../../errors"; export declare namespace Transactions { interface Options { - environment: core.Supplier; + environment?: core.Supplier; apiKey: core.Supplier; } @@ -64,13 +65,16 @@ export class Transactions { } const _response = await core.fetcher({ - url: urlJoin(await core.Supplier.get(this._options.environment), "transactions"), + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.FlagrightEnvironment.Default, + "transactions" + ), method: "POST", headers: { "x-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "flagright", - "X-Fern-SDK-Version": "1.0.0", + "X-Fern-SDK-Version": "1.0.2", }, contentType: "application/json", queryParameters: _queryParams, @@ -131,13 +135,16 @@ export class Transactions { requestOptions?: Transactions.RequestOptions ): Promise { const _response = await core.fetcher({ - url: urlJoin(await core.Supplier.get(this._options.environment), `transactions/${transactionId}`), + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.FlagrightEnvironment.Default, + `transactions/${transactionId}` + ), method: "GET", headers: { "x-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "flagright", - "X-Fern-SDK-Version": "1.0.0", + "X-Fern-SDK-Version": "1.0.2", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, diff --git a/src/api/types/Address.ts b/src/api/types/Address.ts index 81e7e9c..9901060 100644 --- a/src/api/types/Address.ts +++ b/src/api/types/Address.ts @@ -11,7 +11,7 @@ export interface Address { /** Address lines of the user's residence address */ addressLines: unknown[]; /** Post code of the user's residence address `non-empty` */ - postcode: string; + postcode?: string; /** City of the user's residence address `non-empty` */ city: string; /** State of the user's residence address `non-empty` */ diff --git a/src/api/types/CompanyGeneralDetailsUserSegment.ts b/src/api/types/BusinessUserSegment.ts similarity index 50% rename from src/api/types/CompanyGeneralDetailsUserSegment.ts rename to src/api/types/BusinessUserSegment.ts index f6bfd79..8fcf47e 100644 --- a/src/api/types/CompanyGeneralDetailsUserSegment.ts +++ b/src/api/types/BusinessUserSegment.ts @@ -2,19 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -/** - * Segmentation of the business user - */ -export type CompanyGeneralDetailsUserSegment = - | "SOLE_PROPRIETORSHIP" - | "LIMITED" - | "SMB" - | "SMALL" - | "MEDIUM" - | "LARGE" - | "UNKNOWN"; +export type BusinessUserSegment = "SOLE_PROPRIETORSHIP" | "LIMITED" | "SMB" | "SMALL" | "MEDIUM" | "LARGE" | "UNKNOWN"; -export const CompanyGeneralDetailsUserSegment = { +export const BusinessUserSegment = { SoleProprietorship: "SOLE_PROPRIETORSHIP", Limited: "LIMITED", Smb: "SMB", diff --git a/src/api/types/CompanyGeneralDetails.ts b/src/api/types/CompanyGeneralDetails.ts index db5ea7a..0dc6f9a 100644 --- a/src/api/types/CompanyGeneralDetails.ts +++ b/src/api/types/CompanyGeneralDetails.ts @@ -14,8 +14,7 @@ export interface CompanyGeneralDetails { businessIndustry?: string[]; /** The key products and services provided by the company */ mainProductsServicesSold?: string[]; - /** Segmentation of the business user */ - userSegment?: Flagright.CompanyGeneralDetailsUserSegment; + userSegment?: Flagright.BusinessUserSegment; userRegistrationStatus?: Flagright.UserRegistrationStatus; /** Additional information that can be added via tags */ tags?: Flagright.Tag[]; diff --git a/src/api/types/index.ts b/src/api/types/index.ts index e0ee139..3af1924 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -35,8 +35,8 @@ export * from "./CompanyFinancialDetails"; export * from "./UserDetails"; export * from "./UserDetailsGender"; export * from "./UserRegistrationStatus"; +export * from "./BusinessUserSegment"; export * from "./CompanyGeneralDetails"; -export * from "./CompanyGeneralDetailsUserSegment"; export * from "./CompanyRegistrationDetails"; export * from "./BusinessBase"; export * from "./BusinessOptional"; diff --git a/src/environments.ts b/src/environments.ts new file mode 100644 index 0000000..ec337d1 --- /dev/null +++ b/src/environments.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export const FlagrightEnvironment = { + Default: "https://sandbox.api.flagright.com", +} as const; + +export type FlagrightEnvironment = typeof FlagrightEnvironment.Default; diff --git a/src/index.ts b/src/index.ts index dafdb93..5667d00 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,4 @@ export * as Flagright from "./api"; export { FlagrightClient } from "./Client"; +export { FlagrightEnvironment } from "./environments"; export { FlagrightError, FlagrightTimeoutError } from "./errors"; diff --git a/src/serialization/types/Address.ts b/src/serialization/types/Address.ts index 7da7118..119c468 100644 --- a/src/serialization/types/Address.ts +++ b/src/serialization/types/Address.ts @@ -9,7 +9,7 @@ import * as core from "../../core"; export const Address: core.serialization.ObjectSchema = core.serialization.object({ addressLines: core.serialization.list(core.serialization.unknown()), - postcode: core.serialization.string(), + postcode: core.serialization.string().optional(), city: core.serialization.string(), state: core.serialization.string().optional(), country: core.serialization.string(), @@ -19,7 +19,7 @@ export const Address: core.serialization.ObjectSchema = core.serialization.enum_(["SOLE_PROPRIETORSHIP", "LIMITED", "SMB", "SMALL", "MEDIUM", "LARGE", "UNKNOWN"]); -export declare namespace CompanyGeneralDetailsUserSegment { +export declare namespace BusinessUserSegment { type Raw = "SOLE_PROPRIETORSHIP" | "LIMITED" | "SMB" | "SMALL" | "MEDIUM" | "LARGE" | "UNKNOWN"; } diff --git a/src/serialization/types/CompanyGeneralDetails.ts b/src/serialization/types/CompanyGeneralDetails.ts index 1d22506..b7c76f8 100644 --- a/src/serialization/types/CompanyGeneralDetails.ts +++ b/src/serialization/types/CompanyGeneralDetails.ts @@ -13,7 +13,7 @@ export const CompanyGeneralDetails: core.serialization.ObjectSchema< legalName: core.serialization.string(), businessIndustry: core.serialization.list(core.serialization.string()).optional(), mainProductsServicesSold: core.serialization.list(core.serialization.string()).optional(), - userSegment: core.serialization.lazy(async () => (await import("..")).CompanyGeneralDetailsUserSegment).optional(), + userSegment: core.serialization.lazy(async () => (await import("..")).BusinessUserSegment).optional(), userRegistrationStatus: core.serialization.lazy(async () => (await import("..")).UserRegistrationStatus).optional(), tags: core.serialization.list(core.serialization.lazyObject(async () => (await import("..")).Tag)).optional(), }); @@ -23,7 +23,7 @@ export declare namespace CompanyGeneralDetails { legalName: string; businessIndustry?: string[] | null; mainProductsServicesSold?: string[] | null; - userSegment?: serializers.CompanyGeneralDetailsUserSegment.Raw | null; + userSegment?: serializers.BusinessUserSegment.Raw | null; userRegistrationStatus?: serializers.UserRegistrationStatus.Raw | null; tags?: serializers.Tag.Raw[] | null; } diff --git a/src/serialization/types/index.ts b/src/serialization/types/index.ts index e0ee139..3af1924 100644 --- a/src/serialization/types/index.ts +++ b/src/serialization/types/index.ts @@ -35,8 +35,8 @@ export * from "./CompanyFinancialDetails"; export * from "./UserDetails"; export * from "./UserDetailsGender"; export * from "./UserRegistrationStatus"; +export * from "./BusinessUserSegment"; export * from "./CompanyGeneralDetails"; -export * from "./CompanyGeneralDetailsUserSegment"; export * from "./CompanyRegistrationDetails"; export * from "./BusinessBase"; export * from "./BusinessOptional";