- Notifications
You must be signed in to change notification settings - Fork10
The official OneSignal API client for Go
License
OneSignal/onesignal-go-api
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
This API client was generated by theOpenAPI Generator project. By using theOpenAPI-spec from a remote server, you can easily generate an API client.
- API version: 5.3.0
- Package version: 5.3.0-beta1
- Build package: org.openapitools.codegen.languages.GoClientCodegenFor more information, please visithttps://onesignal.com
go get github.com/OneSignal/onesignal-go-api/v5
Install the following dependencies:
go get golang.org/x/oauth2
Put the package under your project folder and add the following in import:
import"github.com/OneSignal/onesignal-go-api"
To use a proxy, set the environment variableHTTP_PROXY:
os.Setenv("HTTP_PROXY","http://proxy_name:proxy_port")
Default configuration comes withServers field that contains server objects as defined in the OpenAPI specification.
For using other server than the one defined on index 0 set context valuesw.ContextServerIndex of typeint.
ctx:=context.WithValue(context.Background(),onesignal.ContextServerIndex,1)
Templated server URL is formatted using default variables from configuration or from context valuesw.ContextServerVariables of typemap[string]string.
ctx:=context.WithValue(context.Background(),onesignal.ContextServerVariables,map[string]string{"basePath":"v2",})
Note, enum values are always validated and all unused variables are silently ignored.
Each operation can use different server URL defined usingOperationServers map in theConfiguration.An operation is uniquely identified by"{classname}Service.{nickname}" string.Similar rules for overriding default operation server index and variables applies by usingsw.ContextOperationServerIndices andsw.ContextOperationServerVariables context maps.
ctx := context.WithValue(context.Background(), onesignal.ContextOperationServerIndices, map[string]int{"{classname}Service.{nickname}": 2,})ctx = context.WithValue(context.Background(), onesignal.ContextOperationServerVariables, map[string]map[string]string{"{classname}Service.{nickname}": {"port": "8443",},})All URIs are relative tohttps://api.onesignal.com
| Class | Method | HTTP request | Description |
|---|---|---|---|
| DefaultApi | CancelNotification | Delete /notifications/{notification_id} | Stop a scheduled or currently outgoing notification |
| DefaultApi | CopyTemplateToApp | Post /templates/{template_id}/copy_to_app | Copy template to another app |
| DefaultApi | CreateAlias | Patch /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity | |
| DefaultApi | CreateAliasBySubscription | Patch /apps/{app_id}/subscriptions/{subscription_id}/user/identity | |
| DefaultApi | CreateApiKey | Post /apps/{app_id}/auth/tokens | Create API key |
| DefaultApi | CreateApp | Post /apps | Create an app |
| DefaultApi | CreateCustomEvents | Post /apps/{app_id}/integrations/custom_events | Create custom events |
| DefaultApi | CreateNotification | Post /notifications | Create notification |
| DefaultApi | CreateSegment | Post /apps/{app_id}/segments | Create Segment |
| DefaultApi | CreateSubscription | Post /apps/{app_id}/users/by/{alias_label}/{alias_id}/subscriptions | |
| DefaultApi | CreateTemplate | Post /templates | Create template |
| DefaultApi | CreateUser | Post /apps/{app_id}/users | |
| DefaultApi | DeleteAlias | Delete /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity/{alias_label_to_delete} | |
| DefaultApi | DeleteApiKey | Delete /apps/{app_id}/auth/tokens/{token_id} | Delete API key |
| DefaultApi | DeleteSegment | Delete /apps/{app_id}/segments/{segment_id} | Delete Segment |
| DefaultApi | DeleteSubscription | Delete /apps/{app_id}/subscriptions/{subscription_id} | |
| DefaultApi | DeleteTemplate | Delete /templates/{template_id} | Delete template |
| DefaultApi | DeleteUser | Delete /apps/{app_id}/users/by/{alias_label}/{alias_id} | |
| DefaultApi | ExportEvents | Post /notifications/{notification_id}/export_events?app_id={app_id} | Export CSV of Events |
| DefaultApi | ExportSubscriptions | Post /players/csv_export?app_id={app_id} | Export CSV of Subscriptions |
| DefaultApi | GetAliases | Get /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity | |
| DefaultApi | GetAliasesBySubscription | Get /apps/{app_id}/subscriptions/{subscription_id}/user/identity | |
| DefaultApi | GetApp | Get /apps/{app_id} | View an app |
| DefaultApi | GetApps | Get /apps | View apps |
| DefaultApi | GetNotification | Get /notifications/{notification_id} | View notification |
| DefaultApi | GetNotificationHistory | Post /notifications/{notification_id}/history | Notification History |
| DefaultApi | GetNotifications | Get /notifications | View notifications |
| DefaultApi | GetOutcomes | Get /apps/{app_id}/outcomes | View Outcomes |
| DefaultApi | GetSegments | Get /apps/{app_id}/segments | Get Segments |
| DefaultApi | GetUser | Get /apps/{app_id}/users/by/{alias_label}/{alias_id} | |
| DefaultApi | RotateApiKey | Post /apps/{app_id}/auth/tokens/{token_id}/rotate | Rotate API key |
| DefaultApi | StartLiveActivity | Post /apps/{app_id}/activities/activity/{activity_type} | Start Live Activity |
| DefaultApi | TransferSubscription | Patch /apps/{app_id}/subscriptions/{subscription_id}/owner | |
| DefaultApi | UnsubscribeEmailWithToken | Post /apps/{app_id}/notifications/{notification_id}/unsubscribe | Unsubscribe with token |
| DefaultApi | UpdateApiKey | Patch /apps/{app_id}/auth/tokens/{token_id} | Update API key |
| DefaultApi | UpdateApp | Put /apps/{app_id} | Update an app |
| DefaultApi | UpdateLiveActivity | Post /apps/{app_id}/live_activities/{activity_id}/notifications | Update a Live Activity via Push |
| DefaultApi | UpdateSubscription | Patch /apps/{app_id}/subscriptions/{subscription_id} | |
| DefaultApi | UpdateSubscriptionByToken | Patch /apps/{app_id}/subscriptions_by_token/{token_type}/{token} | Update subscription by token |
| DefaultApi | UpdateTemplate | Patch /templates/{template_id} | Update template |
| DefaultApi | UpdateUser | Patch /apps/{app_id}/users/by/{alias_label}/{alias_id} | |
| DefaultApi | ViewApiKeys | Get /apps/{app_id}/auth/tokens | View API keys |
| DefaultApi | ViewTemplate | Get /templates/{template_id} | View template |
| DefaultApi | ViewTemplates | Get /templates | View templates |
- ApiKeyToken
- ApiKeyTokensListResponse
- App
- BasicNotification
- BasicNotificationAllOf
- BasicNotificationAllOfAndroidBackgroundLayout
- Button
- CopyTemplateRequest
- CreateApiKeyRequest
- CreateApiKeyResponse
- CreateNotificationSuccessResponse
- CreateSegmentConflictResponse
- CreateSegmentSuccessResponse
- CreateTemplateRequest
- CreateUserConflictResponse
- CreateUserConflictResponseErrorsInner
- CreateUserConflictResponseErrorsItemsMeta
- CustomEvent
- CustomEventsRequest
- DeliveryData
- ExportEventsSuccessResponse
- ExportSubscriptionsRequestBody
- ExportSubscriptionsSuccessResponse
- Filter
- FilterExpression
- GenericError
- GenericSuccessBoolResponse
- GetNotificationHistoryRequestBody
- GetSegmentsSuccessResponse
- LanguageStringMap
- Notification
- NotificationAllOf
- NotificationHistorySuccessResponse
- NotificationSlice
- NotificationTarget
- NotificationWithMeta
- NotificationWithMetaAllOf
- Operator
- OutcomeData
- OutcomesData
- PlatformDeliveryData
- PlatformDeliveryDataEmailAllOf
- PlatformDeliveryDataSmsAllOf
- PropertiesBody
- PropertiesDeltas
- PropertiesObject
- Purchase
- RateLimitError
- Segment
- SegmentData
- SegmentNotificationTarget
- StartLiveActivityRequest
- StartLiveActivitySuccessResponse
- Subscription
- SubscriptionBody
- SubscriptionNotificationTarget
- TemplateResource
- TemplatesListResponse
- TransferSubscriptionRequestBody
- UpdateApiKeyRequest
- UpdateLiveActivityRequest
- UpdateLiveActivitySuccessResponse
- UpdateTemplateRequest
- UpdateUserRequest
- User
- UserIdentityBody
- WebButton
Use a OneSignal authentication context for each auth type:
RestApiKey- For app-level REST API operationsOrganizationApiKey- For organization-level operations
- Type: HTTP Bearer token authentication
Example
orgAuth:=context.WithValue(context.Background(),onesignal.OrganizationApiKey,"YOUR_ORGANIZATION_API_KEY")// Organization API key is only required for creating new apps and other top-level endpoints
- Type: HTTP Bearer token authentication
Example
restAuth:=context.WithValue(context.Background(),onesignal.RestApiKey,"YOUR_REST_API_KEY")// App REST API key required for most endpoints
Due to the fact that model structure members are all pointers, this package containsa 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:
PtrBoolPtrIntPtrInt32PtrInt64PtrFloatPtrFloat32PtrFloat64PtrStringPtrTime
About
The official OneSignal API client for Go
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.