Skip to content

OneSignal/onesignal-go-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

47 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: 1.2.2
  • Package version: 2.0.3
  • 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://onesignal.com/api/v1

Class Method HTTP request Description
DefaultApi BeginLiveActivity Post /apps/{app_id}/live_activities/{activity_id}/token Start Live Activity
DefaultApi CancelNotification Delete /notifications/{notification_id} Stop a scheduled or currently outgoing notification
DefaultApi CreateApp Post /apps Create an app
DefaultApi CreateNotification Post /notifications Create notification
DefaultApi CreatePlayer Post /players Add a device
DefaultApi CreateSegments Post /apps/{app_id}/segments Create Segments
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 DeletePlayer Delete /players/{player_id} Delete a user record
DefaultApi DeleteSegments Delete /apps/{app_id}/segments/{segment_id} Delete Segments
DefaultApi DeleteSubscription Delete /apps/{app_id}/subscriptions/{subscription_id}
DefaultApi DeleteUser Delete /apps/{app_id}/users/by/{alias_label}/{alias_id}
DefaultApi EndLiveActivity Delete /apps/{app_id}/live_activities/{activity_id}/token/{subscription_id} Stop Live Activity
DefaultApi ExportEvents Post /notifications/{notification_id}/export_events?app_id={app_id} Export CSV of Events
DefaultApi ExportPlayers Post /players/csv_export?app_id={app_id} Export CSV of Players
DefaultApi FetchAliases Get /apps/{app_id}/subscriptions/{subscription_id}/user/identity
DefaultApi FetchUser Get /apps/{app_id}/users/by/{alias_label}/{alias_id}
DefaultApi FetchUserIdentity Get /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity
DefaultApi GetApp Get /apps/{app_id} View an app
DefaultApi GetApps Get /apps View apps
DefaultApi GetEligibleIams Get /apps/{app_id}/subscriptions/{subscription_id}/iams
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 GetPlayer Get /players/{player_id} View device
DefaultApi GetPlayers Get /players View devices
DefaultApi IdentifyUserByAlias Patch /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity
DefaultApi IdentifyUserBySubscriptionId Patch /apps/{app_id}/subscriptions/{subscription_id}/user/identity
DefaultApi TransferSubscription Patch /apps/{app_id}/subscriptions/{subscription_id}/owner
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 UpdatePlayer Put /players/{player_id} Edit device
DefaultApi UpdatePlayerTags Put /apps/{app_id}/users/{external_user_id} Edit tags with external user id
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

app_key

  • Type: HTTP Bearer token authentication

Example

appAuth := context.WithValue(context.Background(), onesignal.AppAuth, "APP_KEY_STRING")

user_key

  • Type: HTTP Bearer token authentication

Example

userAuth := context.WithValue(context.Background(), onesignal.UserAuth, "USER_KEY_STRING")

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

[email protected]