Skip to content

Commit

Permalink
Release 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Jan 9, 2024
1 parent 87b3598 commit 1478cf7
Show file tree
Hide file tree
Showing 94 changed files with 791 additions and 345 deletions.
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flagright",
"version": "1.2.1",
"version": "1.3.0",
"private": false,
"repository": "https://github.com/flagright/flagright-node",
"main": "./index.js",
Expand All @@ -11,12 +11,15 @@
"prepack": "cp -rv dist/. ."
},
"dependencies": {
"@ungap/url-search-params": "0.2.2",
"url-join": "4.0.1",
"@types/url-join": "4.0.1",
"axios": "0.27.2"
"form-data": "4.0.0",
"node-fetch": "2.7.0",
"qs": "6.11.2"
},
"devDependencies": {
"@types/url-join": "4.0.1",
"@types/qs": "6.9.8",
"@types/node-fetch": "2.6.9",
"@types/node": "17.0.33",
"prettier": "2.7.1",
"typescript": "4.6.4"
Expand Down
1 change: 1 addition & 0 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export declare namespace FlagrightClient {

interface RequestOptions {
timeoutInSeconds?: number;
maxRetries?: number;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/api/errors/BadRequestError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as errors from "../../errors";
export class BadRequestError extends errors.FlagrightError {
constructor(body?: unknown) {
super({
message: "BadRequestError",
statusCode: 400,
body: body,
});
Expand Down
1 change: 1 addition & 0 deletions src/api/errors/TooManyRequestsError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as errors from "../../errors";
export class TooManyRequestsError extends errors.FlagrightError {
constructor(body?: unknown) {
super({
message: "TooManyRequestsError",
statusCode: 429,
body: body,
});
Expand Down
1 change: 1 addition & 0 deletions src/api/errors/UnauthorizedError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as errors from "../../errors";
export class UnauthorizedError extends errors.FlagrightError {
constructor(body?: unknown) {
super({
message: "UnauthorizedError",
statusCode: 401,
body: body,
});
Expand Down
2 changes: 1 addition & 1 deletion src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from "./resources";
export * from "./types";
export * from "./errors";
export * from "./resources";
18 changes: 9 additions & 9 deletions src/api/resources/businessUserEvents/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import * as environments from "../../../../environments";
import * as core from "../../../../core";
import * as Flagright from "../../..";
import { default as URLSearchParams } from "@ungap/url-search-params";
import * as serializers from "../../../../serialization";
import urlJoin from "url-join";
import * as errors from "../../../../errors";
Expand All @@ -18,6 +17,7 @@ export declare namespace BusinessUserEvents {

interface RequestOptions {
timeoutInSeconds?: number;
maxRetries?: number;
}
}

Expand All @@ -31,20 +31,19 @@ export class BusinessUserEvents {
*
* User events are created after the initial `POST /business/users` call (which creates a user) and are used to:
*
* * Update the STATE and KYC Status of the user, using the `userStateDetails` or `kycStatusDetails` field
* * Update the user details, using the `updatedBusinessUserAttributes` field.
* - Update the STATE and KYC Status of the user, using the `userStateDetails` or `kycStatusDetails` field
* - Update the user details, using the `updatedBusinessUserAttributes` field.
*
* > If you have neither of the above two use cases, you do not need to use user events.
*
* ### Payload
*
* Each user event needs three mandatory fields:
*
* * `timestamp`- the timestamp of when the event was created or occured in your system
* * `userId` - The ID of the transaction for which this event is generated.
* - `timestamp`- the timestamp of when the event was created or occured in your system
* - `userId` - The ID of the transaction for which this event is generated.
*
* In order to make individual events retrievable, you also need to pass in a unique `eventId` to the request body.
*
* @throws {@link Flagright.BadRequestError}
* @throws {@link Flagright.UnauthorizedError}
* @throws {@link Flagright.TooManyRequestsError}
Expand All @@ -54,9 +53,9 @@ export class BusinessUserEvents {
requestOptions?: BusinessUserEvents.RequestOptions
): Promise<Flagright.BusinessWithRulesResult> {
const { allowUserTypeConversion, ..._body } = request;
const _queryParams = new URLSearchParams();
const _queryParams: Record<string, string | string[]> = {};
if (allowUserTypeConversion != null) {
_queryParams.append("allowUserTypeConversion", allowUserTypeConversion);
_queryParams["allowUserTypeConversion"] = allowUserTypeConversion;
}

const _response = await core.fetcher({
Expand All @@ -69,12 +68,13 @@ export class BusinessUserEvents {
"x-api-key": await core.Supplier.get(this._options.apiKey),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "flagright",
"X-Fern-SDK-Version": "1.2.1",
"X-Fern-SDK-Version": "1.3.0",
},
contentType: "application/json",
queryParameters: _queryParams,
body: await serializers.BusinessUserEvent.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }),
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
});
if (_response.ok) {
return await serializers.BusinessWithRulesResult.parseOrThrow(_response.body, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface BusinessUserEvent {
allowUserTypeConversion?: Flagright.BooleanString;
/** Timestamp of the event */
timestamp: number;
/** Transaction ID the event pertains to <span style="white-space: nowrap">`non-empty`</span> */
/** Transaction ID the event pertains to */
userId: string;
/** Unique event ID */
eventId?: string;
Expand Down
14 changes: 8 additions & 6 deletions src/api/resources/businessUsers/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export declare namespace BusinessUsers {

interface RequestOptions {
timeoutInSeconds?: number;
maxRetries?: number;
}
}

Expand All @@ -32,12 +33,11 @@ export class BusinessUsers {
*
* ### Payload
*
*
* Each consumer Business entity needs three mandatory fields:
*
* * `userId` - Unique identifier for the user
* * `legalEntity` - Details of the business legal entity (CompanyGeneralDetails, FinancialDetails etc) - only `legalName`in `CompanyGeneralDetails` is mandatory
* * `createdTimestamp` - UNIX timestamp in *milliseconds* for when the User is created in your system
* - `userId` - Unique identifier for the user
* - `legalEntity` - Details of the business legal entity (CompanyGeneralDetails, FinancialDetails etc) - only `legalName`in `CompanyGeneralDetails` is mandatory
* - `createdTimestamp` - UNIX timestamp in _milliseconds_ for when the User is created in your system
* @throws {@link Flagright.BadRequestError}
* @throws {@link Flagright.UnauthorizedError}
* @throws {@link Flagright.TooManyRequestsError}
Expand All @@ -56,11 +56,12 @@ export class BusinessUsers {
"x-api-key": await core.Supplier.get(this._options.apiKey),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "flagright",
"X-Fern-SDK-Version": "1.2.1",
"X-Fern-SDK-Version": "1.3.0",
},
contentType: "application/json",
body: await serializers.Business.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
});
if (_response.ok) {
return await serializers.BusinessUsersCreateResponse.parseOrThrow(_response.body, {
Expand Down Expand Up @@ -125,10 +126,11 @@ export class BusinessUsers {
"x-api-key": await core.Supplier.get(this._options.apiKey),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "flagright",
"X-Fern-SDK-Version": "1.2.1",
"X-Fern-SDK-Version": "1.3.0",
},
contentType: "application/json",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
});
if (_response.ok) {
return await serializers.BusinessResponse.parseOrThrow(_response.body, {
Expand Down
1 change: 1 addition & 0 deletions src/api/resources/businessUsers/index.ts
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
Expand Up @@ -2,7 +2,7 @@
* This file was auto-generated by Fern from our API Definition.
*/

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

export interface BusinessUsersCreateResponse extends Flagright.BusinessUsersResponse {
message?: string;
Expand Down
1 change: 1 addition & 0 deletions src/api/resources/businessUsers/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./BusinessUsersCreateResponse";
18 changes: 9 additions & 9 deletions src/api/resources/consumerUserEvents/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import * as environments from "../../../../environments";
import * as core from "../../../../core";
import * as Flagright from "../../..";
import { default as URLSearchParams } from "@ungap/url-search-params";
import * as serializers from "../../../../serialization";
import urlJoin from "url-join";
import * as errors from "../../../../errors";
Expand All @@ -18,6 +17,7 @@ export declare namespace ConsumerUserEvents {

interface RequestOptions {
timeoutInSeconds?: number;
maxRetries?: number;
}
}

Expand All @@ -31,20 +31,19 @@ export class ConsumerUserEvents {
*
* User events are created after the initial `POST /consumer/users` call (which creates a user) and are used to:
*
* * Update the STATE and KYC Status of the user, using the `userStateDetails` or `kycStatusDetails` field
* * Update the user details, using the `updatedConsumerUserAttributes` field.
* - Update the STATE and KYC Status of the user, using the `userStateDetails` or `kycStatusDetails` field
* - Update the user details, using the `updatedConsumerUserAttributes` field.
*
* > If you have neither of the above two use cases, you do not need to use user events.
*
* ### Payload
*
* Each user event needs three mandatory fields:
*
* * `timestamp`- the timestamp of when the event was created or occured in your system
* * `userId` - The ID of the transaction for which this event is generated.
* - `timestamp`- the timestamp of when the event was created or occured in your system
* - `userId` - The ID of the transaction for which this event is generated.
*
* In order to make individual events retrievable, you also need to pass in a unique `eventId` to the request body.
*
* @throws {@link Flagright.BadRequestError}
* @throws {@link Flagright.UnauthorizedError}
* @throws {@link Flagright.TooManyRequestsError}
Expand All @@ -54,9 +53,9 @@ export class ConsumerUserEvents {
requestOptions?: ConsumerUserEvents.RequestOptions
): Promise<Flagright.UserWithRulesResult> {
const { allowUserTypeConversion, ..._body } = request;
const _queryParams = new URLSearchParams();
const _queryParams: Record<string, string | string[]> = {};
if (allowUserTypeConversion != null) {
_queryParams.append("allowUserTypeConversion", allowUserTypeConversion);
_queryParams["allowUserTypeConversion"] = allowUserTypeConversion;
}

const _response = await core.fetcher({
Expand All @@ -69,12 +68,13 @@ export class ConsumerUserEvents {
"x-api-key": await core.Supplier.get(this._options.apiKey),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "flagright",
"X-Fern-SDK-Version": "1.2.1",
"X-Fern-SDK-Version": "1.3.0",
},
contentType: "application/json",
queryParameters: _queryParams,
body: await serializers.ConsumerUserEvent.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }),
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
});
if (_response.ok) {
return await serializers.UserWithRulesResult.parseOrThrow(_response.body, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface ConsumerUserEvent {
allowUserTypeConversion?: Flagright.BooleanString;
/** Timestamp of the event */
timestamp: number;
/** Transaction ID the event pertains to <span style="white-space: nowrap">`non-empty`</span> */
/** Transaction ID the event pertains to */
userId: string;
/** Unique event ID */
eventId?: string;
Expand Down
12 changes: 7 additions & 5 deletions src/api/resources/consumerUsers/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export declare namespace ConsumerUsers {

interface RequestOptions {
timeoutInSeconds?: number;
maxRetries?: number;
}
}

Expand All @@ -34,9 +35,8 @@ export class ConsumerUsers {
*
* Each consumer User entity needs three mandatory fields:
*
* * `userId` - Unique identifier for the user
* * `createdTimestamp` - UNIX timestamp in *milliseconds* for when the User is created in your system
*
* - `userId` - Unique identifier for the user
* - `createdTimestamp` - UNIX timestamp in _milliseconds_ for when the User is created in your system
* @throws {@link Flagright.BadRequestError}
* @throws {@link Flagright.UnauthorizedError}
* @throws {@link Flagright.TooManyRequestsError}
Expand All @@ -55,11 +55,12 @@ export class ConsumerUsers {
"x-api-key": await core.Supplier.get(this._options.apiKey),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "flagright",
"X-Fern-SDK-Version": "1.2.1",
"X-Fern-SDK-Version": "1.3.0",
},
contentType: "application/json",
body: await serializers.User.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
});
if (_response.ok) {
return await serializers.ConsumerUsersCreateResponse.parseOrThrow(_response.body, {
Expand Down Expand Up @@ -121,10 +122,11 @@ export class ConsumerUsers {
"x-api-key": await core.Supplier.get(this._options.apiKey),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "flagright",
"X-Fern-SDK-Version": "1.2.1",
"X-Fern-SDK-Version": "1.3.0",
},
contentType: "application/json",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
});
if (_response.ok) {
return await serializers.UserResponse.parseOrThrow(_response.body, {
Expand Down
1 change: 1 addition & 0 deletions src/api/resources/consumerUsers/index.ts
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
Expand Up @@ -2,7 +2,7 @@
* This file was auto-generated by Fern from our API Definition.
*/

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

export interface ConsumerUsersCreateResponse extends Flagright.ConsumerUsersResponse {
message?: string;
Expand Down
1 change: 1 addition & 0 deletions src/api/resources/consumerUsers/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./ConsumerUsersCreateResponse";
5 changes: 4 additions & 1 deletion src/api/resources/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
export * as transactions from "./transactions";
export * as transactionEvents from "./transactionEvents";
export * from "./transactions/types";
export * as consumerUsers from "./consumerUsers";
export * from "./consumerUsers/types";
export * as businessUsers from "./businessUsers";
export * from "./businessUsers/types";
export * as transactionEvents from "./transactionEvents";
export * as consumerUserEvents from "./consumerUserEvents";
export * as businessUserEvents from "./businessUserEvents";
export * from "./transactions/client/requests";
Expand Down
Loading

0 comments on commit 1478cf7

Please sign in to comment.