Skip to content

Commit

Permalink
chore: regenerate api clients (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
smeijer committed Sep 6, 2024
1 parent f8e51c3 commit 992dade
Show file tree
Hide file tree
Showing 89 changed files with 2,116 additions and 97 deletions.
6 changes: 5 additions & 1 deletion packages/project-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ import { Client } from '@magicbell/project-client';
token: 'YOUR_TOKEN',
});

const { data } = await client.broadcasts.listBroadcasts();
const { data } = await client.broadcasts.listBroadcasts({
pageSize: 10,
pageBefore: 'page[before]',
pageAfter: 'page[after]',
});

console.log(data);
})();
Expand Down
9 changes: 0 additions & 9 deletions packages/project-client/docs/models/BroadcastListResponse.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# BroadcastListResponse

**Properties**

| Name | Type | Required | Description |
| :---- | :---------- | :------- | :---------- |
| links | Links || |
| data | Broadcast[] || |

# Links

**Properties**

| Name | Type | Required | Description |
| :--- | :----- | :------- | :--------------------------------------------------------------------------- |
| next | string || The cursor to the next page of results. If null, there are no more results. |
| prev | string || The cursor to the previous page of results. If null, this is the first page. |
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ Returns a list of broadcasts
- HTTP Method: `GET`
- Endpoint: `/broadcasts`

**Parameters**

| Name | Type | Required | Description |
| :--------- | :----- | :------- | :---------- |
| pageSize | number || |
| pageBefore | string || |
| pageAfter | string || |

**Return Type**

`BroadcastListResponse`
Expand All @@ -29,7 +37,11 @@ import { Client } from '@magicbell/project-client';
token: 'YOUR_TOKEN',
});

const { data } = await client.broadcasts.listBroadcasts();
const { data } = await client.broadcasts.listBroadcasts({
pageSize: 10,
pageBefore: 'page[before]',
pageAfter: 'page[after]',
});

console.log(data);
})();
Expand Down Expand Up @@ -62,42 +74,42 @@ import { Broadcast, Client } from '@magicbell/project-client';
token: 'YOUR_TOKEN',
});

const category = 'Mx';
const category = 'RiB';

const email: Email = {
actionUrl: 'laborum commodo magna',
content: 'exdolore elit',
title: 'Excepteur occaecat eu ipsum',
actionUrl: 'labore esse nisi',
content: 'non incididunt Duis magna minim',
title: 'aliqua ea elit deserunt',
};

const inApp: InApp = {
actionUrl: 'inest ea elit exercitation dolore',
content: 'aute eiusmod ea',
title: 'nisi elit amet laboris tempor',
actionUrl: 'commodo laborum proident non ea',
content: 'et ut sed do',
title: 'sint',
};

const mobilePush: MobilePush = {
actionUrl: 'nulla consequat do incididunt',
content: 'incididunt',
title: 'dolore labore',
actionUrl: 'sunt tempor voluptate occaecat',
content: 'sed cupidatat do aliquip nisi',
title: 'adipisicing culpa',
};

const slack: Slack = {
actionUrl: 'sunt ullamco esse',
content: 'aliqua amet',
title: 'aliquip',
actionUrl: 'et adipisicing Duis fugiat',
content: 'ex sed aliquip esse Duis',
title: 'est ipsum ea',
};

const sms: Sms = {
actionUrl: 'sit Excepteur',
content: 'incididunt laboris',
title: 'qui',
actionUrl: 'et proident amet ipsum irure',
content: 'magna Ut',
title: 'in',
};

const webPush: WebPush = {
actionUrl: 'Excepteur laboris est',
content: 'veniam sed ullamco',
title: 'volupta',
actionUrl: 'amet in Ut occaecat',
content: 'enim ut',
title: 'in dolor eiusmod laborum minim',
};

const channels: Channels = {
Expand All @@ -124,16 +136,16 @@ import { Broadcast, Client } from '@magicbell/project-client';
providers: providers,
};

const topic = 'sPebCt_M0';
const topic = 'cM5OPs/SsM';

const broadcast: Broadcast = {
actionUrl: 'tempor enim',
actionUrl: 'minim ut',
category: category,
content: 'nostrud',
content: 'qui deserunt sed',
customAttributes: {},
overrides: overrides,
recipients: [{}],
title: 'reprehenderit culpa aliqua ',
title: 'tempor et quis',
topic: topic,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ import { ApnsConfig, Client } from '@magicbell/project-client';
const badge = Badge.UNREAD;

const apnsConfig: ApnsConfig = {
appId: 'd9OR5CpLVzt',
appId: 'D4EQ/tIASto0nj1AzqgjxEjFdO6Src0N',
badge: badge,
certificate: 'certificate',
keyId: 'Utpariatur',
teamId: 'in Excepte',
keyId: 'velit exdo',
teamId: 'sed labore',
};

const { data } = await client.integrations.saveApnsIntegration(input);
Expand Down Expand Up @@ -256,7 +256,7 @@ import { AwssnsConfig, Client } from '@magicbell/project-client';
});

const awssnsConfig: AwssnsConfig = {
webhookSigningSecret: 'pariatur',
webhookSigningSecret: 'u',
};

const { data } = await client.integrations.saveAwssnsIntegration(input);
Expand Down Expand Up @@ -364,7 +364,7 @@ import { Client, ExpoConfig } from '@magicbell/project-client';
});

const expoConfig: ExpoConfig = {
accessToken: 'dolore non mo',
accessToken: 'officia fugi',
};

const { data } = await client.integrations.saveExpoIntegration(input);
Expand Down Expand Up @@ -592,7 +592,7 @@ import { Client, GithubConfig } from '@magicbell/project-client';
});

const githubConfig: GithubConfig = {
webhookSigningSecret: 'id dol',
webhookSigningSecret: 'ipsum',
};

const { data } = await client.integrations.saveGithubIntegration(input);
Expand Down Expand Up @@ -705,7 +705,7 @@ import { Client, InboxConfig } from '@magicbell/project-client';

const banner: Banner = {
backgroundColor: 'backgroundColor',
backgroundOpacity: 9.28,
backgroundOpacity: 9.19,
fontSize: 'fontSize',
textColor: 'textColor',
};
Expand Down Expand Up @@ -807,7 +807,7 @@ import { Client, InboxConfig } from '@magicbell/project-client';

const inboxConfig: InboxConfig = {
images: images,
locale: 'ad consequat',
locale: 'sit nostru',
theme: theme,
};

Expand Down Expand Up @@ -918,8 +918,8 @@ import { Client, MailgunConfig } from '@magicbell/project-client';
const mailgunConfigRegion = MailgunConfigRegion.US;

const mailgunConfig: MailgunConfig = {
apiKey: 'voluptate ',
domain: 'magna a',
apiKey: 'in ',
domain: 'consequat d',
region: mailgunConfigRegion,
};

Expand Down Expand Up @@ -1028,7 +1028,7 @@ import { Client, PingConfig } from '@magicbell/project-client';
});

const pingConfig: PingConfig = {
url: 'et laborum pariatur esse consequat',
url: 'ut incididunt irure Ut',
};

const { data } = await client.integrations.savePingEmailIntegration(input);
Expand Down Expand Up @@ -1261,11 +1261,11 @@ import { Client, SesConfig } from '@magicbell/project-client';
};

const sesConfig: SesConfig = {
endpoint: 'sed',
endpoint: 'dolore in occa',
from: sesConfigFrom,
keyId: 'pariat',
region: 'temp',
secretKey: 'c',
keyId: 'sit ex ',
region: 'in',
secretKey: 'do',
};

const { data } = await client.integrations.saveSesIntegration(input);
Expand Down Expand Up @@ -1373,10 +1373,10 @@ import { Client, SlackConfig } from '@magicbell/project-client';
});

const slackConfig: SlackConfig = {
appId: 'LAUM',
clientId: '48902.5229056738',
clientSecret: 'esse inest cupidatat dolore offi',
signingSecret: 'deserunt quis ametnulla dolore a',
appId: 'EC',
clientId: '707.8465562093',
clientSecret: 'et exercitation voluptate ametni',
signingSecret: 'exercitation Utmollitetad ullamc',
};

const { data } = await client.integrations.saveSlackIntegration(input);
Expand Down Expand Up @@ -1484,7 +1484,7 @@ import { Client, StripeConfig } from '@magicbell/project-client';
});

const stripeConfig: StripeConfig = {
webhookSigningSecret: 'mollit',
webhookSigningSecret: 'in',
};

const { data } = await client.integrations.saveStripeIntegration(input);
Expand Down Expand Up @@ -1700,10 +1700,10 @@ import { Client, TwilioConfig } from '@magicbell/project-client';
const twilioConfigRegion = TwilioConfigRegion.US1;

const twilioConfig: TwilioConfig = {
accountSid: 'Ut fugiat culpa ex',
apiKey: 'sunt',
apiSecret: 'commodo dolo',
from: '+738',
accountSid: 'qui',
apiKey: 'velit',
apiSecret: 'cillum magna',
from: '+300',
region: twilioConfigRegion,
};

Expand Down Expand Up @@ -1812,8 +1812,8 @@ import { Client, WebpushConfig } from '@magicbell/project-client';
});

const webpushConfig: WebpushConfig = {
privateKey: 'Lorem minim',
publicKey: 'amet ullamco in',
privateKey: 'labore aliquip tempor enim magna',
publicKey: 'labore sunt',
};

const { data } = await client.integrations.saveWebPushIntegration(input);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ import { Client, CreateProjectTokenRequest } from '@magicbell/project-client';
});

const createProjectTokenRequest: CreateProjectTokenRequest = {
expiry: 9,
name: 'ullamco ut',
expiry: 3,
name: 'mollit elit commodo Lorem ullamco',
};

const { data } = await client.jwt.createProjectJwt(input);
Expand Down Expand Up @@ -129,10 +129,10 @@ import { Client, CreateUserTokenRequest } from '@magicbell/project-client';
});

const createUserTokenRequest: CreateUserTokenRequest = {
email: 'deserunt sit nisi ut',
expiry: 10,
externalId: 'Duis amet magna',
name: 'veniam id adipisicing ea',
email: 'ut sunt ullamco sint',
expiry: 6,
externalId: 'commodo dolore cupidatat et ut',
name: 'do ea dolore',
};

const { data } = await client.jwt.createUserJwt(input);
Expand Down
2 changes: 1 addition & 1 deletion packages/project-client/scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ async function build(specfile = 'https://public.magicbell.com/specs/openapi.v2.j
// await move('output/typescript/test', './test');
await move('output/typescript/package.json', './package.json');
await move('output/typescript/README.md', './README.md');
await move('output/typescript/documentation', './docs');
await move('output/typescript/documentation', './documentation');
await rimraf('output');

// code mods
Expand Down
2 changes: 2 additions & 0 deletions packages/project-client/src/http/client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { AuthHandler } from './handlers/auth-handler';
import { RequestHandlerChain } from './handlers/handler-chain';
import { HookHandler } from './handlers/hook-handler';
import { HeaderHandler } from './handlers/mb-header-handler';
import { RequestValidationHandler } from './handlers/request-validation-handler';
import { ResponseValidationHandler } from './handlers/response-validation-handler';
import { RetryHandler } from './handlers/retry-handler';
Expand All @@ -13,6 +14,7 @@ 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 Down
35 changes: 35 additions & 0 deletions packages/project-client/src/http/handlers/mb-header-handler.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { SerializationStyle } from '../serialization/base-serializer';
import { Request } from '../transport/request';
import { HttpResponse, RequestHandler } from '../types';

export class HeaderHandler implements RequestHandler {
next?: RequestHandler;

async handle<T>(request: Request<T>): Promise<HttpResponse<T>> {
if (!this.next) {
throw new Error(`No next handler set in ${HeaderHandler.name}`);
}

const requestWithHeaders = this.addHeaders(request);
return this.next?.handle(requestWithHeaders);
}

private addHeaders<T>(request: Request<T>): Request<T> {
const { headers } = request.config as any;
if (typeof headers !== 'object') {
return request;
}

for (const [key, value] of Object.entries(headers)) {
request.addHeaderParam(key, {
key: key,
value: value,
explode: false,
encode: false,
style: SerializationStyle.SIMPLE,
});
}

return request;
}
}
2 changes: 1 addition & 1 deletion packages/project-client/src/http/hooks/hook.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD';

export interface HttpRequest {
baseUrl: string;
Expand Down
Loading

0 comments on commit 992dade

Please sign in to comment.