Skip to content

Commit

Permalink
feat: use fetch as http client for project-client and user-client (#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
smeijer authored Aug 30, 2024
1 parent 8f20ec9 commit 036278a
Show file tree
Hide file tree
Showing 125 changed files with 4,259 additions and 1,045 deletions.
6 changes: 6 additions & 0 deletions .changeset/hip-dancers-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@magicbell/project-client': minor
'@magicbell/user-client': minor
---

use fetch as http client
30 changes: 26 additions & 4 deletions packages/project-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ OpenAPI 3.1.0 Specification for MagicBell API.
- [Authentication](#authentication)
- [Access Token Authentication](#access-token-authentication)
- [Setting a Custom Timeout](#setting-a-custom-timeout)
- [Sample Usage](#sample-usage)
- [Services](#services)
- [Models](#models)

Expand Down Expand Up @@ -67,6 +68,24 @@ You can set a custom timeout for the SDK's HTTP requests as follows:
const client = new Client({ timeout: 10000 });
```

# Sample Usage

Below is a comprehensive example demonstrating how to authenticate and call a simple endpoint:

```ts
import { Client } from '@magicbell/project-client';

(async () => {
const client = new Client({
token: 'YOUR_TOKEN',
});

const { data } = await client.broadcasts.listBroadcasts();

console.log(data);
})();
```

## Services

The SDK provides various services to interact with the API.
Expand Down Expand Up @@ -96,6 +115,8 @@ The SDK includes several models that represent the data structures used in API r
| [Broadcast](documentation/models/Broadcast.md) | |
| [ListIntegrationsResponse](documentation/models/ListIntegrationsResponse.md) | |
| [ApnsConfig](documentation/models/ApnsConfig.md) | |
| [AwssnsConfig](documentation/models/AwssnsConfig.md) | |
| [ExpoConfig](documentation/models/ExpoConfig.md) | |
| [FcmConfig](documentation/models/FcmConfig.md) | |
| [GithubConfig](documentation/models/GithubConfig.md) | |
| [InboxConfig](documentation/models/InboxConfig.md) | |
Expand All @@ -112,11 +133,11 @@ The SDK includes several models that represent the data structures used in API r
| [AccessToken](documentation/models/AccessToken.md) | |
| [DiscardTokenResponse](documentation/models/DiscardTokenResponse.md) | |
| [CreateUserTokenRequest](documentation/models/CreateUserTokenRequest.md) | |
| [ArrayWithMetadataOfInboxToken](documentation/models/ArrayWithMetadataOfInboxToken.md) | |
| [InboxTokenWithMetadata](documentation/models/InboxTokenWithMetadata.md) | |
| [DiscardResult](documentation/models/DiscardResult.md) | |
| [ArrayWithMetadataOfApnsToken](documentation/models/ArrayWithMetadataOfApnsToken.md) | |
| [ApnsTokenWithMetadata](documentation/models/ApnsTokenWithMetadata.md) | |
| [DiscardResult](documentation/models/DiscardResult.md) | |
| [ArrayWithMetadataOfExpoToken](documentation/models/ArrayWithMetadataOfExpoToken.md) | |
| [ExpoTokenWithMetadata](documentation/models/ExpoTokenWithMetadata.md) | |
| [ArrayWithMetadataOfFcmToken](documentation/models/ArrayWithMetadataOfFcmToken.md) | |
| [FcmTokenWithMetadata](documentation/models/FcmTokenWithMetadata.md) | |
| [ArrayWithMetadataOfSlackToken](documentation/models/ArrayWithMetadataOfSlackToken.md) | |
Expand All @@ -125,10 +146,11 @@ The SDK includes several models that represent the data structures used in API r
| [TeamsTokenWithMetadata](documentation/models/TeamsTokenWithMetadata.md) | |
| [ArrayWithMetadataOfWebPushToken](documentation/models/ArrayWithMetadataOfWebPushToken.md) | |
| [WebPushTokenWithMetadata](documentation/models/WebPushTokenWithMetadata.md) | |
| [InboxToken](documentation/models/InboxToken.md) | |
| [ApnsToken](documentation/models/ApnsToken.md) | |
| [ExpoToken](documentation/models/ExpoToken.md) | |
| [FcmToken](documentation/models/FcmToken.md) | |
| [SlackToken](documentation/models/SlackToken.md) | |
| [TeamsToken](documentation/models/TeamsToken.md) | |
| [WebPushToken](documentation/models/WebPushToken.md) | |

</details>
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
| Name | Type | Required | Description |
| :------- | :------------ | :------- | :---------- |
| data | ApnsToken || |
| metadata | DataMetadata2 || |
| metadata | DataMetadata1 || |

# DataMetadata2
# DataMetadata1

**Properties**

Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# ArrayWithMetadataOfInboxToken
# ArrayWithMetadataOfExpoToken

**Properties**

| Name | Type | Required | Description |
| :--- | :---------------------------------- | :------- | :---------- |
| data | ArrayWithMetadataOfInboxTokenData[] || |
| Name | Type | Required | Description |
| :--- | :--------------------------------- | :------- | :---------- |
| data | ArrayWithMetadataOfExpoTokenData[] || |

# ArrayWithMetadataOfInboxTokenData
# ArrayWithMetadataOfExpoTokenData

**Properties**

| Name | Type | Required | Description |
| :------- | :------------ | :------- | :---------- |
| data | InboxToken || |
| metadata | DataMetadata1 || |
| data | ExpoToken || |
| metadata | DataMetadata2 || |

# DataMetadata1
# DataMetadata2

**Properties**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

| Name | Type | Required | Description |
| :------- | :------------ | :------- | :---------- |
| data | any || |
| data | TeamsToken || |
| metadata | DataMetadata5 || |

# DataMetadata5
Expand Down
7 changes: 7 additions & 0 deletions packages/project-client/docs/models/AwssnsConfig.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# AwssnsConfig

**Properties**

| Name | Type | Required | Description |
| :------------------- | :----- | :------- | :----------------------------------- |
| webhookSigningSecret | string || The signing certificate from AWS SNS |
8 changes: 6 additions & 2 deletions packages/project-client/docs/models/Broadcast.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
| recipients | any[] || |
| title | string || |
| actionUrl | string || |
| category | string || |
| category | Category || |
| content | string || |
| customAttributes | any || |
| overrides | Overrides || |
| topic | string || |
| topic | Topic || |

# Category

# Overrides

Expand Down Expand Up @@ -108,3 +110,5 @@
| postmark | any || |
| sendgrid | any || |
| slack | any || |

# Topic
7 changes: 7 additions & 0 deletions packages/project-client/docs/models/ExpoConfig.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# ExpoConfig

**Properties**

| Name | Type | Required | Description |
| :---------- | :----- | :------- | :---------- |
| accessToken | string || |
7 changes: 7 additions & 0 deletions packages/project-client/docs/models/ExpoToken.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# ExpoToken

**Properties**

| Name | Type | Required | Description |
| :---------- | :----- | :------- | :---------- |
| deviceToken | string || |
19 changes: 19 additions & 0 deletions packages/project-client/docs/models/ExpoTokenWithMetadata.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# ExpoTokenWithMetadata

**Properties**

| Name | Type | Required | Description |
| :------- | :---------------------------- | :------- | :---------- |
| data | ExpoToken || |
| metadata | ExpoTokenWithMetadataMetadata || |

# ExpoTokenWithMetadataMetadata

**Properties**

| Name | Type | Required | Description |
| :---------- | :----- | :------- | :---------- |
| createdAt | string || |
| id | string || |
| discardedAt | string || |
| updatedAt | string || |
2 changes: 1 addition & 1 deletion packages/project-client/docs/models/GithubConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

| Name | Type | Required | Description |
| :------------------- | :----- | :------- | :--------------------------------------------------------- |
| webhookSigningSecret | string || The signing secret to verify incoming requests from Stripe |
| webhookSigningSecret | string || The signing secret to verify incoming requests from Github |
182 changes: 180 additions & 2 deletions packages/project-client/docs/models/InboxConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,184 @@

| Name | Type | Required | Description |
| :----- | :----- | :------- | :---------- |
| images | any || |
| images | Images || |
| locale | string || |
| theme | any || |
| theme | Theme || |

# Images

**Properties**

| Name | Type | Required | Description |
| :------------ | :----- | :------- | :---------- |
| emptyInboxUrl | string || |

# Theme

**Properties**

| Name | Type | Required | Description |
| :----------- | :----------- | :------- | :---------- |
| banner | Banner || |
| dialog | Dialog || |
| footer | Footer || |
| header | Header || |
| icon | Icon || |
| notification | Notification || |
| unseenBadge | UnseenBadge || |

# Banner

**Properties**

| Name | Type | Required | Description |
| :---------------- | :----- | :------- | :---------- |
| backgroundColor | string || |
| fontSize | string || |
| textColor | string || |
| backgroundOpacity | number || |

# Dialog

**Properties**

| Name | Type | Required | Description |
| :-------------- | :----- | :------- | :---------- |
| accentColor | string || |
| backgroundColor | string || |
| textColor | string || |

# Footer

**Properties**

| Name | Type | Required | Description |
| :-------------- | :----- | :------- | :---------- |
| backgroundColor | string || |
| borderRadius | string || |
| fontSize | string || |
| textColor | string || |

# Header

**Properties**

| Name | Type | Required | Description |
| :-------------- | :----- | :------- | :---------- |
| backgroundColor | string || |
| borderRadius | string || |
| fontFamily | string || |
| fontSize | string || |
| textColor | string || |

# Icon

**Properties**

| Name | Type | Required | Description |
| :---------- | :----- | :------- | :---------- |
| borderColor | string || |
| width | string || |

# Notification

**Properties**

| Name | Type | Required | Description |
| :------ | :-------- | :------- | :---------- |
| default | Default\_ || |
| unread | Unread || |
| unseen | Unseen || |

# Default\_

**Properties**

| Name | Type | Required | Description |
| :-------------- | :----------- | :------- | :---------- |
| backgroundColor | string || |
| borderRadius | string || |
| fontFamily | string || |
| fontSize | string || |
| margin | string || |
| textColor | string || |
| hover | DefaultHover || |
| state | DefaultState || |

# DefaultHover

**Properties**

| Name | Type | Required | Description |
| :-------------- | :----- | :------- | :---------- |
| backgroundColor | string || |

# DefaultState

**Properties**

| Name | Type | Required | Description |
| :---- | :----- | :------- | :---------- |
| color | string || |

# Unread

**Properties**

| Name | Type | Required | Description |
| :-------------- | :---------- | :------- | :---------- |
| backgroundColor | string || |
| textColor | string || |
| hover | UnreadHover || |
| state | UnreadState || |

# UnreadHover

**Properties**

| Name | Type | Required | Description |
| :-------------- | :----- | :------- | :---------- |
| backgroundColor | string || |

# UnreadState

**Properties**

| Name | Type | Required | Description |
| :---- | :----- | :------- | :---------- |
| color | string || |

# Unseen

**Properties**

| Name | Type | Required | Description |
| :-------------- | :---------- | :------- | :---------- |
| backgroundColor | string || |
| textColor | string || |
| hover | UnseenHover || |
| state | UnseenState || |

# UnseenHover

**Properties**

| Name | Type | Required | Description |
| :-------------- | :----- | :------- | :---------- |
| backgroundColor | string || |

# UnseenState

**Properties**

| Name | Type | Required | Description |
| :---- | :----- | :------- | :---------- |
| color | string || |

# UnseenBadge

**Properties**

| Name | Type | Required | Description |
| :-------------- | :----- | :------- | :---------- |
| backgroundColor | string || |
7 changes: 0 additions & 7 deletions packages/project-client/docs/models/InboxToken.md

This file was deleted.

Loading

0 comments on commit 036278a

Please sign in to comment.