Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

The official OneSignal API client for Go

License

NotificationsYou must be signed in to change notification settings

OneSignal/onesignal-go-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 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

Installation

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")

Configuration of Server URL

Default configuration comes withServers 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 valuesw.ContextServerIndex of typeint.

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

Templated Server URL

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.

URLs Configuration per Operation

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",},})

Documentation for API Endpoints

All URIs are relative tohttps://api.onesignal.com

ClassMethodHTTP requestDescription
DefaultApiCancelNotificationDelete /notifications/{notification_id}Stop a scheduled or currently outgoing notification
DefaultApiCopyTemplateToAppPost /templates/{template_id}/copy_to_appCopy template to another app
DefaultApiCreateAliasPatch /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity
DefaultApiCreateAliasBySubscriptionPatch /apps/{app_id}/subscriptions/{subscription_id}/user/identity
DefaultApiCreateApiKeyPost /apps/{app_id}/auth/tokensCreate API key
DefaultApiCreateAppPost /appsCreate an app
DefaultApiCreateCustomEventsPost /apps/{app_id}/integrations/custom_eventsCreate custom events
DefaultApiCreateNotificationPost /notificationsCreate notification
DefaultApiCreateSegmentPost /apps/{app_id}/segmentsCreate Segment
DefaultApiCreateSubscriptionPost /apps/{app_id}/users/by/{alias_label}/{alias_id}/subscriptions
DefaultApiCreateTemplatePost /templatesCreate template
DefaultApiCreateUserPost /apps/{app_id}/users
DefaultApiDeleteAliasDelete /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity/{alias_label_to_delete}
DefaultApiDeleteApiKeyDelete /apps/{app_id}/auth/tokens/{token_id}Delete API key
DefaultApiDeleteSegmentDelete /apps/{app_id}/segments/{segment_id}Delete Segment
DefaultApiDeleteSubscriptionDelete /apps/{app_id}/subscriptions/{subscription_id}
DefaultApiDeleteTemplateDelete /templates/{template_id}Delete template
DefaultApiDeleteUserDelete /apps/{app_id}/users/by/{alias_label}/{alias_id}
DefaultApiExportEventsPost /notifications/{notification_id}/export_events?app_id={app_id}Export CSV of Events
DefaultApiExportSubscriptionsPost /players/csv_export?app_id={app_id}Export CSV of Subscriptions
DefaultApiGetAliasesGet /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity
DefaultApiGetAliasesBySubscriptionGet /apps/{app_id}/subscriptions/{subscription_id}/user/identity
DefaultApiGetAppGet /apps/{app_id}View an app
DefaultApiGetAppsGet /appsView apps
DefaultApiGetNotificationGet /notifications/{notification_id}View notification
DefaultApiGetNotificationHistoryPost /notifications/{notification_id}/historyNotification History
DefaultApiGetNotificationsGet /notificationsView notifications
DefaultApiGetOutcomesGet /apps/{app_id}/outcomesView Outcomes
DefaultApiGetSegmentsGet /apps/{app_id}/segmentsGet Segments
DefaultApiGetUserGet /apps/{app_id}/users/by/{alias_label}/{alias_id}
DefaultApiRotateApiKeyPost /apps/{app_id}/auth/tokens/{token_id}/rotateRotate API key
DefaultApiStartLiveActivityPost /apps/{app_id}/activities/activity/{activity_type}Start Live Activity
DefaultApiTransferSubscriptionPatch /apps/{app_id}/subscriptions/{subscription_id}/owner
DefaultApiUnsubscribeEmailWithTokenPost /apps/{app_id}/notifications/{notification_id}/unsubscribeUnsubscribe with token
DefaultApiUpdateApiKeyPatch /apps/{app_id}/auth/tokens/{token_id}Update API key
DefaultApiUpdateAppPut /apps/{app_id}Update an app
DefaultApiUpdateLiveActivityPost /apps/{app_id}/live_activities/{activity_id}/notificationsUpdate a Live Activity via Push
DefaultApiUpdateSubscriptionPatch /apps/{app_id}/subscriptions/{subscription_id}
DefaultApiUpdateSubscriptionByTokenPatch /apps/{app_id}/subscriptions_by_token/{token_type}/{token}Update subscription by token
DefaultApiUpdateTemplatePatch /templates/{template_id}Update template
DefaultApiUpdateUserPatch /apps/{app_id}/users/by/{alias_label}/{alias_id}
DefaultApiViewApiKeysGet /apps/{app_id}/auth/tokensView API keys
DefaultApiViewTemplateGet /templates/{template_id}View template
DefaultApiViewTemplatesGet /templatesView templates

Documentation For Models

Documentation For Authorization

Use a OneSignal authentication context for each auth type:

  • RestApiKey - For app-level REST API operations
  • OrganizationApiKey - For organization-level operations

organization_api_key

  • 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

rest_api_key

  • 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

Documentation for Utility Methods

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:

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

Author

devrel@onesignal.com


[8]ページ先頭

©2009-2025 Movatter.jp