MagicBell GO SDK
MagicBell Go SDK
Welcome to the MagiBell GO SDK documentation. This guide will help you get started with integrating and using the MagicBell GO SDK in your project.
MagicBell GO ProjectClient
Authentication
Access Token Authentication
The Client API uses an Access Token for authentication.
This token must be provided to authenticate your requests to the API.
Setting the Access Token
When you initialize the SDK, you can set the access token as follows:
import (
"github.com/magicbell/magicbell-go/pkg/project-client/client"
"github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
)
config := clientconfig.NewConfig()
config.SetAccessToken("YOUR-TOKEN")
sdk := client.NewClient(config)
If you need to set or update the access token after initializing the SDK, you can use:
import (
"github.com/magicbell/magicbell-go/pkg/project-client/client"
"github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
)
config := clientconfig.NewConfig()
sdk := client.NewClient(config)
sdk.SetAccessToken("YOUR-TOKEN")
Services
The SDK provides various services to interact with the API.
Below is a list of all available services with links to their detailed documentation:
Name |
---|
BroadcastsService |
ChannelsService |
EventsService |
IntegrationsService |
JwtService |
NotificationsService |
UsersService |
Response Wrappers
All services use response wrappers to provide a consistent interface to return the responses from the API.
The response wrapper itself is a generic struct that contains the response data and metadata.
Below are the response wrappers used in the SDK:
ClientResponse[T]
This response wrapper is used to return the response data from the API. It contains the following fields:
Name | Type | Description |
---|---|---|
Data | T |
The body of the API response |
Metadata | ClientResponseMetadata |
Status code and headers returned by the API |
ClientError
This response wrapper is used to return an error. It contains the following fields:
Name | Type | Description |
---|---|---|
Err | error |
The error that occurred |
Body | T |
The body of the API response |
Metadata | ClientResponseMetadata |
Status code and headers returned by the API |
ClientResponseMetadata
This struct is shared by both response wrappers and contains the following fields:
Name | Type | Description |
---|---|---|
Headers | map[string]string |
A map containing the headers returned by the API |
StatusCode | int |
The status code returned by the API |
Models
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.
Below is a list of all available models with links to their detailed documentation:
MagicBell GO UserClient
Authentication
Access Token Authentication
The Client API uses an Access Token for authentication.
This token must be provided to authenticate your requests to the API.
Setting the Access Token
When you initialize the SDK, you can set the access token as follows:
import (
"github.com/magicbell/magicbell-go/pkg/user-client/client"
"github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
)
config := clientconfig.NewConfig()
config.SetAccessToken("YOUR-TOKEN")
sdk := client.NewClient(config)
If you need to set or update the access token after initializing the SDK, you can use:
import (
"github.com/magicbell/magicbell-go/pkg/user-client/client"
"github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
)
config := clientconfig.NewConfig()
sdk := client.NewClient(config)
sdk.SetAccessToken("YOUR-TOKEN")
Services
The SDK provides various services to interact with the API.
Below is a list of all available services with links to their detailed documentation:
Name |
---|
ChannelsService |
IntegrationsService |
NotificationsService |
Response Wrappers
All services use response wrappers to provide a consistent interface to return the responses from the API.
The response wrapper itself is a generic struct that contains the response data and metadata.
Below are the response wrappers used in the SDK:
ClientResponse[T]
This response wrapper is used to return the response data from the API. It contains the following fields:
Name | Type | Description |
---|---|---|
Data | T |
The body of the API response |
Metadata | ClientResponseMetadata |
Status code and headers returned by the API |
ClientError
This response wrapper is used to return an error. It contains the following fields:
Name | Type | Description |
---|---|---|
Err | error |
The error that occurred |
Body | T |
The body of the API response |
Metadata | ClientResponseMetadata |
Status code and headers returned by the API |
ClientResponseMetadata
This struct is shared by both response wrappers and contains the following fields:
Name | Type | Description |
---|---|---|
Headers | map[string]string |
A map containing the headers returned by the API |
StatusCode | int |
The status code returned by the API |
Models
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.