Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/auto-bump-magicbell-go-1763964127.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"magicbell-go": minor
---

Automatic minor version bump for changes in `magicbell-go`.
173 changes: 148 additions & 25 deletions README.md

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions cmd/project-client/examples/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ package main

import (
"bufio"
"context"
"fmt"
"os"
"strings"

"context"
"github.com/magicbell/magicbell-go/pkg/project-client/broadcasts"
"github.com/magicbell/magicbell-go/pkg/project-client/client"
"github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"

"github.com/magicbell/magicbell-go/pkg/project-client/broadcasts"
"github.com/magicbell/magicbell-go/pkg/project-client/util"
)

func main() {
Expand All @@ -19,7 +19,11 @@ func main() {
config := clientconfig.NewConfig()
client := client.NewClient(config)

params := broadcasts.ListBroadcastsRequestParams{}
params := broadcasts.ListBroadcastsRequestParams{
Limit: util.ToPointer(int64(5)),
StartingAfter: util.ToPointer("starting_after"),
EndingBefore: util.ToPointer("ending_before"),
}

response, err := client.Broadcasts.ListBroadcasts(context.Background(), params)
if err != nil {
Expand Down
12 changes: 8 additions & 4 deletions cmd/user-client/examples/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ package main

import (
"bufio"
"context"
"fmt"
"os"
"strings"

"context"
"github.com/magicbell/magicbell-go/pkg/user-client/channels"
"github.com/magicbell/magicbell-go/pkg/user-client/client"
"github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"

"github.com/magicbell/magicbell-go/pkg/user-client/channels"
"github.com/magicbell/magicbell-go/pkg/user-client/util"
)

func main() {
Expand All @@ -19,7 +19,11 @@ func main() {
config := clientconfig.NewConfig()
client := client.NewClient(config)

params := channels.ListInboxTokensRequestParams{}
params := channels.ListInboxTokensRequestParams{
Limit: util.ToPointer(int64(8)),
StartingAfter: util.ToPointer("starting_after"),
EndingBefore: util.ToPointer("ending_before"),
}

response, err := client.Channels.ListInboxTokens(context.Background(), params)
if err != nil {
Expand Down
111 changes: 95 additions & 16 deletions docs/project-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ title: "project-client"

This SDK is compatible with the following versions: `Go >= 1.19.0`

## Installation

To get started with the SDK, we recommend installing using `go get`:

```bash
go get client
```

## Authentication

### Access Token Authentication
Expand Down Expand Up @@ -46,11 +54,60 @@ sdk := client.NewClient(config)
sdk.SetAccessToken("YOUR-TOKEN")
```

## Setting a Custom Timeout

You can set a custom timeout for the SDK's HTTP requests as follows:

```go
import "time"

config := clientconfig.NewConfig()

sdk := client.NewClient(config)

sdk.SetTimeout(10 * time.Second)
```

# Sample Usage

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

```go
import (
"fmt"
"encoding/json"
"context"
"github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
"github.com/magicbell/magicbell-go/pkg/project-client/client"
"github.com/magicbell/magicbell-go/pkg/project-client/util"
"github.com/magicbell/magicbell-go/pkg/project-client/broadcasts"
)

config := clientconfig.NewConfig()
config.SetAccessToken("ACCESS_TOKEN")
client := client.NewClient(config)


params := broadcasts.ListBroadcastsRequestParams{
Limit: util.ToPointer(int64(5)),
StartingAfter: util.ToPointer("starting_after"),
EndingBefore: util.ToPointer("ending_before"),
}

response, err := client.Broadcasts.ListBroadcasts(context.Background(), params)
if err != nil {
panic(err)
}

fmt.Println(response)

```

## Services

The SDK provides various services to interact with the API.

<details>
<details>
<summary>Below is a list of all available services with links to their detailed documentation:</summary>

| Name |
Expand All @@ -60,6 +117,7 @@ The SDK provides various services to interact with the API.
| [EventsService](services/events_service.md) |
| [IntegrationsService](services/integrations_service.md) |
| [UsersService](services/users_service.md) |
| [WorkflowsService](services/workflows_service.md) |

</details>

Expand Down Expand Up @@ -106,16 +164,19 @@ This struct is shared by both response wrappers and contains the following field

The SDK includes several models that represent the data structures used in API requests and responses. These models help in organizing and managing the data efficiently.

<details>
<details>
<summary>Below is a list of all available models with links to their detailed documentation:</summary>

| Name | Description |
| :-------------------------------------------------------------------------------------- | :---------- |
| [BroadcastCollection](models/broadcast_collection.md) | |
| [Broadcast](models/broadcast.md) | |
| [User](models/user.md) | |
| [Links](models/links.md) | |
| [CategoryDeliveryConfig](models/category_delivery_config.md) | |
| [InboxTokenResponseCollection](models/inbox_token_response_collection.md) | |
| [InboxTokenResponse](models/inbox_token_response.md) | |
| [Links](models/links.md) | |
| [DiscardResult](models/discard_result.md) | |
| [ApnsTokenCollection](models/apns_token_collection.md) | |
| [ApnsToken](models/apns_token.md) | |
Expand All @@ -131,49 +192,67 @@ The SDK includes several models that represent the data structures used in API r
| [WebPushToken](models/web_push_token.md) | |
| [EventCollection](models/event_collection.md) | |
| [Event](models/event.md) | |
| [Links](models/links.md) | |
| [IntegrationConfigCollection](models/integration_config_collection.md) | |
| [IntegrationConfig](models/integration_config.md) | |
| [Links](models/links.md) | |
| [ApnsConfigCollection](models/apns_config_collection.md) | |
| [ApnsConfig](models/apns_config.md) | |
| [ApnsConfigPayload](models/apns_config_payload.md) | |
| [EventSourceConfigCollection](models/event_source_config_collection.md) | |
| [EventSourceConfig](models/event_source_config.md) | |
| [EventSourceConfigPayload](models/event_source_config_payload.md) | |
| [ExpoConfigCollection](models/expo_config_collection.md) | |
| [ExpoConfig](models/expo_config.md) | |
| [ExpoConfigPayload](models/expo_config_payload.md) | |
| [FcmConfigCollection](models/fcm_config_collection.md) | |
| [FcmConfig](models/fcm_config.md) | |
| [FcmConfigPayload](models/fcm_config_payload.md) | |
| [GithubConfigCollection](models/github_config_collection.md) | |
| [GithubConfig](models/github_config.md) | |
| [GithubConfigPayload](models/github_config_payload.md) | |
| [InboxConfigCollection](models/inbox_config_collection.md) | |
| [InboxConfig](models/inbox_config.md) | |
| [InboxConfigPayload](models/inbox_config_payload.md) | |
| [SlackBotConfigCollection](models/slack_bot_config_collection.md) | |
| [SlackBotConfig](models/slack_bot_config.md) | |
| [SlackBotConfigPayload](models/slack_bot_config_payload.md) | |
| [MailgunConfigCollection](models/mailgun_config_collection.md) | |
| [MailgunConfig](models/mailgun_config.md) | |
| [MailgunConfigPayload](models/mailgun_config_payload.md) | |
| [PingConfigCollection](models/ping_config_collection.md) | |
| [PingConfig](models/ping_config.md) | |
| [PingConfigPayload](models/ping_config_payload.md) | |
| [SendgridConfigCollection](models/sendgrid_config_collection.md) | |
| [SendgridConfig](models/sendgrid_config.md) | |
| [SendgridConfigPayload](models/sendgrid_config_payload.md) | |
| [SesConfigCollection](models/ses_config_collection.md) | |
| [SesConfig](models/ses_config.md) | |
| [SesConfigPayload](models/ses_config_payload.md) | |
| [SlackConfigCollection](models/slack_config_collection.md) | |
| [SlackConfig](models/slack_config.md) | |
| [SlackConfigPayload](models/slack_config_payload.md) | |
| [SmtpConfigObjectCollection](models/smtp_config_object_collection.md) | |
| [SmtpConfigObject](models/smtp_config_object.md) | |
| [SmtpConfig](models/smtp_config.md) | |
| [StripeConfigCollection](models/stripe_config_collection.md) | |
| [StripeConfig](models/stripe_config.md) | |
| [StripeConfigPayload](models/stripe_config_payload.md) | |
| [TwilioConfigCollection](models/twilio_config_collection.md) | |
| [TwilioConfig](models/twilio_config.md) | |
| [TwilioConfigPayload](models/twilio_config_payload.md) | |
| [WebpushConfigCollection](models/webpush_config_collection.md) | |
| [WebpushConfig](models/webpush_config.md) | |
| [WebpushConfigPayload](models/webpush_config_payload.md) | |
| [UserCollection](models/user_collection.md) | |
| [User](models/user.md) | |
| [Links](models/links.md) | |
| [IntegrationConfig](models/integration_config.md) | |
| [ApnsConfig](models/apns_config.md) | |
| [ExpoConfig](models/expo_config.md) | |
| [FcmConfig](models/fcm_config.md) | |
| [GithubConfig](models/github_config.md) | |
| [InboxConfig](models/inbox_config.md) | |
| [MailgunConfig](models/mailgun_config.md) | |
| [PingConfig](models/ping_config.md) | |
| [SendgridConfig](models/sendgrid_config.md) | |
| [SesConfig](models/ses_config.md) | |
| [SlackConfig](models/slack_config.md) | |
| [StripeConfig](models/stripe_config.md) | |
| [TwilioConfig](models/twilio_config.md) | |
| [WebpushConfig](models/webpush_config.md) | |
| [WorkflowDefinition](models/workflow_definition.md) | |
| [ExecuteWorkflowRequest](models/execute_workflow_request.md) | |
| [CreateRunResponse](models/create_run_response.md) | |
| [GetRunResponse](models/get_run_response.md) | |
| [WorkflowRunCollection](models/workflow_run_collection.md) | |
| [WorkflowRun](models/workflow_run.md) | |
| [Links](models/links.md) | |

</details>
10 changes: 5 additions & 5 deletions docs/project-client/models/apns_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

**Properties**

| Name | Type | Required | Description |
| :----- | :----------------------------- | :------- | :---------- |
| Config | integrations.ApnsConfigPayload | ✅ | |
| Id | string | ✅ | |
| Name | string | ✅ | |
| Name | Type | Required | Description |
| :----- | :------------------------------------------------------- | :------- | :---------- |
| Config | [integrations.ApnsConfigPayload](apns_config_payload.md) | ✅ | |
| Id | string | ✅ | |
| Name | string | ✅ | |
8 changes: 4 additions & 4 deletions docs/project-client/models/apns_config_collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

**Properties**

| Name | Type | Required | Description |
| :---- | :------------------------ | :------- | :---------- |
| Data | []integrations.ApnsConfig | ❌ | |
| Links | shared.Links | ❌ | |
| Name | Type | Required | Description |
| :---- | :------------------------------------------ | :------- | :---------- |
| Data | [][integrations.ApnsConfig](apns_config.md) | ❌ | |
| Links | [shared.Links](links.md) | ❌ | |
4 changes: 2 additions & 2 deletions docs/project-client/models/apns_config_payload.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

| Name | Type | Required | Description |
| :----- | :----- | :------- | :---------- |
| unread | string | ✅ | "unread" |
| unseen | string | ✅ | "unseen" |
| Unread | string | ✅ | "unread" |
| Unseen | string | ✅ | "unseen" |

# PayloadVersion

Expand Down
24 changes: 12 additions & 12 deletions docs/project-client/models/apns_token.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

**Properties**

| Name | Type | Required | Description |
| :------------- | :------------------------------- | :------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| CreatedAt | string | ✅ | |
| DeviceToken | string | ✅ | |
| Id | 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. |
| DiscardedAt | string | ❌ | |
| InstallationId | channels.ApnsTokenInstallationId | ❌ | (Optional) The APNs environment the token is registered for. If none is provided we assume the token is used in `production`. |
| UpdatedAt | string | ❌ | |
| Name | Type | Required | Description |
| :------------- | :---------------------- | :------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| CreatedAt | string | ✅ | |
| DeviceToken | string | ✅ | |
| Id | 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. |
| DiscardedAt | string | ❌ | |
| InstallationId | channels.InstallationId | ❌ | (Optional) The APNs environment the token is registered for. If none is provided we assume the token is used in `production`. |
| UpdatedAt | string | ❌ | |

# ApnsTokenInstallationId
# InstallationId

(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 |
| :---------- | :----- | :------- | :------------ |
| development | string | ✅ | "development" |
| production | string | ✅ | "production" |
| Development | string | ✅ | "development" |
| Production | string | ✅ | "production" |
Loading
Loading