Skip to content

Commit

Permalink
chore: regen sdks (#453)
Browse files Browse the repository at this point in the history
Automated PR to update the generated SDKs
  • Loading branch information
MagicBella authored Dec 13, 2024
1 parent 3368c93 commit 5e06ee7
Show file tree
Hide file tree
Showing 42 changed files with 960 additions and 247 deletions.
5 changes: 5 additions & 0 deletions .changeset/auto-bump-project-client-1734089735.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@magicbell/project-client': minor
---

Automatic minor version bump for changes in `@magicbell/project-client`.
5 changes: 5 additions & 0 deletions .changeset/auto-bump-user-client-1734089735.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@magicbell/user-client': minor
---

Automatic minor version bump for changes in `@magicbell/user-client`.
4 changes: 3 additions & 1 deletion packages/project-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Welcome to the Client SDK documentation. This guide will help you get started with integrating and using the Client SDK in your project.

[![This SDK was generated by liblab](https://public-liblab-readme-assets.s3.us-east-1.amazonaws.com/built-by-liblab-icon.svg)](https://liblab.com/?utm_source=readme)

## Versions

- API version: `2.0.0`
Expand Down Expand Up @@ -81,7 +83,7 @@ import { Client } from '@magicbell/project-client';
});

const { data } = await client.broadcasts.listBroadcasts({
pageSize: 6,
pageSize: 8,
pageAfter: 'page[after]',
pageBefore: 'page[before]',
});
Expand Down
16 changes: 8 additions & 8 deletions packages/project-client/documentation/models/ApnsConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

**Properties**

| Name | Type | Required | Description |
| :------------- | :------------- | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| appId | string || |
| badge | Badge || |
| certificate | string || The APNs certificate in PEM format. Generate it at [developer.apple.com](https://developer.apple.com/account/resources/authkeys/add) with the 'Apple Push Notification service (APNs)' option selected. |
| keyId | string || |
| teamId | string || |
| payloadVersion | PayloadVersion || |
| Name | Type | Required | Description |
| :------------- | :------------- | :------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| appId | string || The default bundle identifier of the application that is configured with this project. It can be overriden on a per token basis, when registering device tokens. |
| badge | Badge || |
| certificate | string || The APNs certificate in P8 format. Generate it at [developer.apple.com](https://developer.apple.com/account/resources/authkeys/add) with the 'Apple Push Notification service (APNs)' option selected. |
| keyId | string || |
| teamId | string || |
| payloadVersion | PayloadVersion || |

# Badge

Expand Down
12 changes: 7 additions & 5 deletions packages/project-client/documentation/models/ApnsToken.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

**Properties**

| Name | Type | Required | Description |
| :------------- | :---------------------- | :------- | :---------- |
| deviceToken | string || |
| appId | string || |
| installationId | ApnsTokenInstallationId || |
| Name | Type | Required | Description |
| :------------- | :---------------------- | :------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| deviceToken | string || |
| appId | string || (Optional) The bundle identifier of the application that is registering this token. Use this field to override the default identifier specified in the projects APNs integration. |
| installationId | ApnsTokenInstallationId || (Optional) The APNs environment the token is registered for. If none is provided we assume the token is used in `production`. |

# ApnsTokenInstallationId

(Optional) The APNs environment the token is registered for. If none is provided we assume the token is used in `production`.

**Properties**

| Name | Type | Required | Description |
Expand Down
12 changes: 6 additions & 6 deletions packages/project-client/documentation/models/SlackConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

**Properties**

| Name | Type | Required | Description |
| :------------ | :----- | :------- | :---------- |
| appId | string || |
| clientId | string || |
| clientSecret | string || |
| signingSecret | string || |
| Name | Type | Required | Description |
| :------------ | :----- | :------- | :------------------------------------------------------------------------------------------------ |
| appId | string || The Slack app ID that can be found in the app's settings page of the Slack API dashboard. |
| clientId | string || The Slack client ID that can be found in the app's settings page of the Slack API dashboard. |
| clientSecret | string || The Slack client secret that can be found in the app's settings page of the Slack API dashboard. |
| signingSecret | string || The Slack signing secret that can be found in the app's settings page of the Slack API dashboard. |
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { Client } from '@magicbell/project-client';
});

const { data } = await client.broadcasts.listBroadcasts({
pageSize: 6,
pageSize: 8,
pageAfter: 'page[after]',
pageBefore: 'page[before]',
});
Expand Down Expand Up @@ -141,8 +141,8 @@ import { Broadcast, Client } from '@magicbell/project-client';
const statusStatus = StatusStatus.ENQUEUED;

const summary: Summary = {
failures: 10,
total: 8,
failures: 2,
total: 9,
};

const broadcastStatus: BroadcastStatus = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ import { Client, ProjectDeliveryConfig } from '@magicbell/project-client';

const projectDeliveryConfigChannels: ProjectDeliveryConfigChannels = {
channel: channelsChannel1,
delay: 1,
delay: 8,
disabled: true,
if: 'if',
priority: 5,
priority: 3,
};

const projectDeliveryConfig: ProjectDeliveryConfig = {
Expand Down Expand Up @@ -125,10 +125,10 @@ import { CategoryDeliveryConfig, Client } from '@magicbell/project-client';

const categoryDeliveryConfigChannels: CategoryDeliveryConfigChannels = {
channel: channelsChannel2,
delay: 3,
delay: 6,
disabled: true,
if: 'if',
priority: 5,
priority: 1,
};

const categoryDeliveryConfig: CategoryDeliveryConfig = {
Expand Down Expand Up @@ -282,7 +282,7 @@ import { Client } from '@magicbell/project-client';
});

const { data } = await client.channels.getMobilePushExpoUserTokens('user_id', {
pageSize: 2,
pageSize: 6,
pageAfter: 'page[after]',
pageBefore: 'page[before]',
});
Expand Down Expand Up @@ -390,7 +390,7 @@ import { Client } from '@magicbell/project-client';
});

const { data } = await client.channels.getMobilePushFcmUserTokens('user_id', {
pageSize: 3,
pageSize: 4,
pageAfter: 'page[after]',
pageBefore: 'page[before]',
});
Expand Down Expand Up @@ -606,7 +606,7 @@ import { Client } from '@magicbell/project-client';
});

const { data } = await client.channels.getTeamsUserTokens('user_id', {
pageSize: 123,
pageSize: 8,
pageAfter: 'page[after]',
pageBefore: 'page[before]',
});
Expand Down Expand Up @@ -714,7 +714,7 @@ import { Client } from '@magicbell/project-client';
});

const { data } = await client.channels.getWebPushUserTokens('user_id', {
pageSize: 9,
pageSize: 4,
pageAfter: 'page[after]',
pageBefore: 'page[before]',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { Client } from '@magicbell/project-client';
});

const { data } = await client.events.getEvents({
pageSize: 1,
pageSize: 8,
pageAfter: 'page[after]',
pageBefore: 'page[before]',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ import { Client } from '@magicbell/project-client';
});

const { data } = await client.integrations.listIntegrations({
pageSize: 8,
pageSize: 3,
pageAfter: 'page[after]',
pageBefore: 'page[before]',
});
Expand Down Expand Up @@ -165,13 +165,13 @@ const payloadVersion = PayloadVersion._1;
const apnsConfig: ApnsConfig = {
appId: "app_id",
badge: badge,
certificate: "--------- BEGINF--------
DufxW=
------- ENDQPJ---
certificate: "----- BEGIN PRIVATE KEY----------
42qmz9=
---- END PRIVATE KEY-
",
keyId: "et in elit",
keyId: "mollit dol",
payloadVersion: payloadVersion,
teamId: "consequat "
teamId: "enimmollit"
};

const { data } = await client.integrations.saveApnsIntegration(
Expand Down Expand Up @@ -527,9 +527,10 @@ const fcmConfig: FcmConfig = {
clientEmail: "client_email",
clientId: "client_id",
clientX509CertUrl: "client_x509_cert_url",
privateKey: "BEGINUQYD--------
rSm==
-------ENDTYIWA---",
privateKey: "BEGINNQX--------
B+JvPM/f7Ms==
------ENDEPJVIYYY-----
",
privateKeyId: "private_key_id",
projectId: "project_id",
tokenUri: "token_uri",
Expand Down Expand Up @@ -773,7 +774,7 @@ import { Client, InboxConfig } from '@magicbell/project-client';

const banner: Banner = {
backgroundColor: 'backgroundColor',
backgroundOpacity: 3.98,
backgroundOpacity: 4.92,
fontSize: 'fontSize',
textColor: 'textColor',
};
Expand Down Expand Up @@ -1481,10 +1482,10 @@ import { Client, SlackConfig } from '@magicbell/project-client';
});

const slackConfig: SlackConfig = {
appId: 'QPB3C3EYQY4',
clientId: '01131.219',
clientSecret: 'mollit Ut pariaturex ut Duis dol',
signingSecret: 'officia commodoincididunt quisel',
appId: 'QTEIRE',
clientId: '7201.6182620',
clientSecret: 'ex dolore ametauteDuis culpaquis',
signingSecret: 'eu ex animmollit sunt consequat ',
};

const { data } = await client.integrations.saveSlackIntegration(slackConfig);
Expand Down Expand Up @@ -1835,7 +1836,7 @@ import { Client, TwilioConfig } from '@magicbell/project-client';
accountSid: 'account_sid',
apiKey: 'api_key',
apiSecret: 'api_secret',
from: '+65321207213408',
from: '+0528138710599',
region: twilioConfigRegion,
};

Expand Down
8 changes: 4 additions & 4 deletions packages/project-client/documentation/services/JwtService.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { Client } from '@magicbell/project-client';
});

const { data } = await client.jwt.fetchProjectTokens({
pageSize: 10,
pageSize: 5,
pageAfter: 'page[after]',
pageBefore: 'page[before]',
});
Expand Down Expand Up @@ -78,7 +78,7 @@ import { Client, CreateProjectTokenRequest } from '@magicbell/project-client';
});

const createProjectTokenRequest: CreateProjectTokenRequest = {
expiry: 5,
expiry: 8,
name: 'name',
};

Expand Down Expand Up @@ -150,7 +150,7 @@ import { Client, CreateUserTokenRequest } from '@magicbell/project-client';

const createUserTokenRequest: CreateUserTokenRequest = {
email: 'email',
expiry: 6,
expiry: 8,
externalId: 'external_id',
name: 'name',
};
Expand Down Expand Up @@ -225,7 +225,7 @@ import { Client } from '@magicbell/project-client';
});

const { data } = await client.jwt.fetchUserTokens('user_id', {
pageSize: 9,
pageSize: 3,
pageAfter: 'page[after]',
pageBefore: 'page[before]',
});
Expand Down
9 changes: 5 additions & 4 deletions packages/project-client/src/http/client.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
import { AuthHandler } from './handlers/auth-handler.js';
import { RequestHandlerChain } from './handlers/handler-chain.js';
import { HookHandler } from './handlers/hook-handler.js';
import { HeaderHandler } from './handlers/mb-header-handler.js';
import { RequestValidationHandler } from './handlers/request-validation-handler.js';
import { ResponseValidationHandler } from './handlers/response-validation-handler.js';
import { RetryHandler } from './handlers/retry-handler.js';
import { TerminatingHandler } from './handlers/terminating-handler.js';
import { CustomHook } from './hooks/custom-hook.js';
import { SerializationStyle } from './serialization/base-serializer.js';
import { Request } from './transport/request.js';
import { HttpMethod, HttpResponse, Options, RetryOptions, SdkConfig } from './types.js';
import { HttpResponse, SdkConfig } from './types.js';

export class HttpClient {
private readonly requestHandlerChain = new RequestHandlerChain();

constructor(private config: SdkConfig, hook = new CustomHook()) {
this.requestHandlerChain.addHandler(new HeaderHandler());
this.requestHandlerChain.addHandler(new ResponseValidationHandler());
this.requestHandlerChain.addHandler(new RequestValidationHandler());
this.requestHandlerChain.addHandler(new AuthHandler());
Expand All @@ -28,6 +25,10 @@ export class HttpClient {
return this.requestHandlerChain.callChain(request);
}

async *stream<T>(request: Request<T>): AsyncGenerator<HttpResponse<T>> {
yield* this.requestHandlerChain.streamChain(request);
}

public async callPaginated<FullResponse, Page>(request: Request<FullResponse, Page>): Promise<HttpResponse<Page>> {
const response = await this.call<FullResponse>(request as any);

Expand Down
14 changes: 12 additions & 2 deletions packages/project-client/src/http/handlers/auth-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,24 @@ import { HttpResponse, RequestHandler } from '../types.js';
export class AuthHandler implements RequestHandler {
next?: RequestHandler;

async handle<T>(request: Request<T>): Promise<HttpResponse<T>> {
public async handle<T>(request: Request<T>): Promise<HttpResponse<T>> {
const requestWithAuth = this.addAccessTokenHeader(request);

if (!this.next) {
throw new Error(`No next handler set in ${AuthHandler.name}`);
}

return this.next?.handle(requestWithAuth);
return this.next.handle(requestWithAuth);
}

public async *stream<T>(request: Request<T>): AsyncGenerator<HttpResponse<T>> {
const requestWithAuth = this.addAccessTokenHeader(request);

if (!this.next) {
throw new Error(`No next handler set in ${AuthHandler.name}`);
}

yield* this.next.stream(requestWithAuth);
}

private addAccessTokenHeader<T>(request: Request<T>): Request<T> {
Expand Down
8 changes: 8 additions & 0 deletions packages/project-client/src/http/handlers/handler-chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,12 @@ export class RequestHandlerChain {

return this.handlers[0].handle(request);
}

async *streamChain<T>(request: Request<T>): AsyncGenerator<HttpResponse<T>> {
if (!this.handlers.length) {
throw new Error('No handlers added to the chain');
}

yield* this.handlers[0].stream(request);
}
}
Loading

0 comments on commit 5e06ee7

Please sign in to comment.