Skip to content

OneSignal/onesignal-go-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

55 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Welcome to the official OneSignal Go Client ๐Ÿ‘‹

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com

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: 5.0.1
  • Package version: 5.0.0-beta1
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://onesignal.com

Installation

go get github.com/OneSignal/onesignal-go-api

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 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 sw.ContextServerIndex of type int.

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

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables of type map[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.

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 sw.ContextOperationServerIndices and sw.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",
	},
})

Documentation for API Endpoints

All URIs are relative to https://api.onesignal.com

Class Method HTTP request Description
DefaultApi CancelNotification Delete /notifications/{notification_id} Stop a scheduled or currently outgoing notification
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 CreateApp Post /apps Create an app
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 CreateUser Post /apps/{app_id}/users
DefaultApi DeleteAlias Delete /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity/{alias_label_to_delete}
DefaultApi DeleteSegment Delete /apps/{app_id}/segments/{segment_id} Delete Segment
DefaultApi DeleteSubscription Delete /apps/{app_id}/subscriptions/{subscription_id}
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 TransferSubscription Patch /apps/{app_id}/subscriptions/{subscription_id}/owner
DefaultApi UnsubscribeEmailWithToken Post /apps/{app_id}/notifications/{notification_id}/unsubscribe Unsubscribe with token
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 UpdateUser Patch /apps/{app_id}/users/by/{alias_label}/{alias_id}

Documentation For Models

Documentation For Authorization

Use a OneSignal authentication context for each auth type:

  • AppAuth
  • UserAuth

rest_api_key

  • Type: HTTP Bearer token authentication

Example

user_auth_key

  • Type: HTTP Bearer token authentication

Example

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

devrel@onesignal.com