Skip to content

bsgworld/go-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go API client for bsgapi

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 2.0
  • Package version: 0.1.8
  • Generator version: 7.12.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import bsgapi "github.com/bsgworld/go-sdk"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value bsgapi.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), bsgapi.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value bsgapi.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), bsgapi.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using bsgapi.ContextOperationServerIndices and bsgapi.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), bsgapi.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), bsgapi.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://one-api.bsg.world

Class Method HTTP request Description
AccountBalanceAPI AccountBalance Get /api/accounts/balance Get balance
AccountTariffsAPI AccountTariffs Get /api/accounts/tariff Get tariffs
CampaignAPI CampaignSend Post /api/campaigns/send Send campaign
CampaignDetailsAPI CampaignDetails Get /api/campaigns/{id}/detail Get campaign details
CampaignPriceAPI CampaignPrice Post /api/campaigns/price Calculate campaign price
CampaignRCSAPI RcsSendGroups Post /api/campaigns/rcs/send-groups Send RCS message to contact list
CampaignStopAPI CampaignStop Patch /api/campaigns/{id}/stop Cancel campaign
CampaignTagAPI Campaign Get /api/campaigns/{id} Get campaign info
CampaignViberAPI ViberSend Post /api/campaigns/viber/send Send Viber campaign
CampaignsAPI Campaigns Get /api/campaigns List of campaigns
CancelOtpAPI CancelOtp Post /api/2fa/authentications/{id}/cancel Cancel the authentication session
ContactCreateAPI ContactCreate Post /api/contacts Create a contact
ContactDeleteAPI ContactDelete Delete /api/contacts/{id} Delete contact
ContactFieldCreateAPI ContactFieldCreate Post /api/contacts/fields Create contact field
ContactFieldUpdateAPI ContactFieldUpdate Patch /api/contacts/fields/{id} Update contact field
ContactFieldsAPI ContactFields Get /api/contacts/fields List of contact fields
ContactListAttachAPI ContactListAttach Post /api/groups/attach Add contacts to the list
ContactListCreateAPI ContactListCreate Post /api/groups Create list
ContactListDeleteAPI ContactListDelete Delete /api/groups/{id} Delete list
ContactListDetachAPI ContactListDetach Post /api/groups/detach Remove contacts from the list
ContactListSearchAPI ContactListSearch Get /api/groups/search Search list
ContactListTagAPI ContactList Get /api/groups/{id} Get list by id
ContactListUpdateAPI ContactListUpdate Put /api/groups/{id} Update list
ContactListsAPI ContactLists Get /api/groups List of contact lists
ContactTagAPI Contact Get /api/contacts/{id} Get contact by ID
ContactUpdateAPI ContactUpdate Put /api/contacts/{id} Update contact
ContactsAPI Contacts Get /api/contacts List of contacts
ContactsDeleteAPI ContactsDelete Post /api/contacts/delete Delete multiple contacts
ContactsSearchAPI ContactsSearch Get /api/contacts/search Search contacts
EmailSendAPI EmailSend Post /api/email/send-emails Send Email
EmailTemplateSendAPI EmailTemplateSend Post /api/email/send-template-emails Send Email template
GetMessagesAPI GetMessages Get /api/messages Find messages
GetSettingsAddressBookFieldsByIdAPI GetSettingsAddressBookFieldsById Get /api/settings/address-book-fields/{id} Get settings value
LoginAPI Login Post /api/auth/login Receive JWT token
MessagesAPI SendMessage Post /api/messages/send Send single message
MessagesWhatsAppAPI WhatsappSingle Post /api/messages/whatsapp/send Send single WhatsApp message
OtpListAPI OtpList Get /api/2fa/authentications List of authentication sessions
OtpTemplateAPI OtpTemplate Get /api/2fa/authentications/templates/{templateId} Get message template
OtpTemplateCreateAPI OtpTemplateCreate Post /api/2fa/authentications/templates Create a message template
OtpTemplateDeleteAPI OtpTemplateDelete Delete /api/2fa/authentications/templates/{templateId} Delete a message template
OtpTemplateListAPI OtpTemplateList Get /api/2fa/authentications/templates List of message templates
PostCampaignsWhatsappSendAPI PostCampaignsWhatsappSend Post /api/campaigns/whatsapp/send Send WhatsApp campaign
PostContactsFieldsDeleteAPI PostContactsFieldsDelete Post /api/contacts/fields/delete Delete contact fields by ids
RcsSendGroupsAPI RcsSend Post /api/campaigns/rcs/send Send RCS message
RcsSingleAPI RcsSingle Post /api/messages/rcs/send Send single RCS message
RefreshTokenAPI RefreshToken Post /api/auth/refresh Refresh JWT token
ResendOtpAPI ResendOtp Post /api/2fa/authentications/otp/{id}/resend Resend the one-time code
SendOtpAPI SendOtp Post /api/2fa/authentications/otp Send One-time password
SenderRequestLegalAPI SenderRequestLegal Post /api/senders/requests/legal Sender registration by a legal entity
SenderRequestNaturalAPI SenderRequestNatural Post /api/senders/requests/natural Sender registration by an individual
SenderRequestsAPI SenderRequests Get /api/senders/requests/sms List of Sender Requests
SendersTagAPI Senders Get /api/senders List of Senders
ShortUrlsClicksAPI ShortUrlsClicks Get /api/short-url/clicks List of clicks
ShortUrlsDomainAPI ShortUrlsDomain Get /api/short-url/domains/{uuid} Get domain by uuid
ShortUrlsDomainCreateAPI ShortUrlsDomainCreate Post /api/short-url/domains Add domain
ShortUrlsDomainRemoveAPI ShortUrlsDomainRemove Delete /api/short-url/domains/{uuid} Remove domain
ShortUrlsDomainUpdateAPI ShortUrlsDomainUpdate Put /api/short-url/domains/{uuid} Update domain
ShortUrlsDomainsAPI ShortUrlsDomains Get /api/short-url/domains List of domains
ShortUrlsLinkAPI ShortUrlsLink Get /api/short-url/links/{uuid}/statistics Get short link statistic
ShortUrlsLinkCreateAPI ShortUrlsLinkCreate Post /api/short-url/links Create short link
ShortUrlsLinkDeleteAPI ShortUrlsLinkDelete Delete /api/short-url/links/{uuid} Remove short link
ShortUrlsLinkUpdateAPI ShortUrlsLinkUpdate Put /api/short-url/links/{uuid} Update short link
ShortUrlsLinksAPI ShortUrlsLinks Get /api/short-url/links List of short links
SmsSendAPI SmsSend Post /api/campaigns/sms/send Send SMS campaign
SmsSendGroupsAPI SmsSendGroups Post /api/campaigns/sms/send-groups Send SMS to contact list
SmsSendIndividualAPI SmsSendIndividual Post /api/campaigns/sms/send-individual Send SMS with different text
StatisticAPI StatJobsCreate Post /api/stat/jobs Create new job
StatisticAPI StatJobsDelete Delete /api/stat/jobs/{id} Delete job result
StatisticAPI StatJobsList Get /api/stat/jobs List statistic jobs
StatisticAPI StatJobsShow Get /api/stat/jobs/{id} Load job result
StatusOtpAPI StatusOtp Get /api/2fa/authentications/{id} Check authentication status
StoplistAddAPI StoplistAdd Post /api/stoplist/attach Add contacts to stop list
StoplistItemsAPI StoplistItems Get /api/stoplist List the contacts of stop lists
StoplistRemoveAPI StoplistRemove Post /api/stoplist/detach Remove contacts from stop list
StoplistSearchAPI StoplistSearch Get /api/stoplist/search Search contacts in Stop lists
VerifyOtpAPI VerifyOtp Post /api/2fa/authentications/otp/{id}/verify Check one-time Code

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

ExternalAuth

  • Type: HTTP Bearer token authentication

Example

auth := context.WithValue(context.Background(), bsgapi.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)

InternalAuth

  • Type: HTTP Bearer token authentication

Example

auth := context.WithValue(context.Background(), bsgapi.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages