Skip to content

Commit

Permalink
Merge pull request #1 from OneSignal/api
Browse files Browse the repository at this point in the history
1.0.0 Release
  • Loading branch information
rgomezp authored Apr 26, 2022
2 parents b99434f + c4b29ca commit ba80e5b
Show file tree
Hide file tree
Showing 87 changed files with 38,814 additions and 1 deletion.
24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Modified MIT License

Copyright 2022 OneSignal

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

1. The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

2. All copies of substantial portions of the Software may only be used in connection
with services provided by OneSignal.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
191 changes: 190 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,190 @@
# onesignal-go-client
<h1 align="center">Welcome to the official OneSignal Go Client 👋</h1>

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](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.

- API version: 1.0.2
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
For more information, please visit [https://onesignal.com](https://onesignal.com)

## Installation

```shell
go get github.com/OneSignal/onesignal-go-client
```

Install the following dependencies:

```shell
go get golang.org/x/oauth2
```

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

```golang
import "onesignal"
```

To use a proxy, set the environment variable `HTTP_PROXY`:

```golang
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`.

```golang
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`.

```golang
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* | [**CancelNotification**](docs/DefaultApi.md#cancelnotification) | **Delete** /notifications/{notification_id} | Stop a scheduled or currently outgoing notification
*DefaultApi* | [**CreateApp**](docs/DefaultApi.md#createapp) | **Post** /apps | Create an app
*DefaultApi* | [**CreateNotification**](docs/DefaultApi.md#createnotification) | **Post** /notifications | Create notification
*DefaultApi* | [**CreatePlayer**](docs/DefaultApi.md#createplayer) | **Post** /players | Add a device
*DefaultApi* | [**CreateSegments**](docs/DefaultApi.md#createsegments) | **Post** /apps/{app_id}/segments | Create Segments
*DefaultApi* | [**DeletePlayer**](docs/DefaultApi.md#deleteplayer) | **Delete** /players/{player_id} | Delete a user record
*DefaultApi* | [**DeleteSegments**](docs/DefaultApi.md#deletesegments) | **Delete** /apps/{app_id}/segments/{segment_id} | Delete Segments
*DefaultApi* | [**ExportPlayers**](docs/DefaultApi.md#exportplayers) | **Post** /players/csv_export?app_id&#x3D;{app_id} | CSV export
*DefaultApi* | [**GetApp**](docs/DefaultApi.md#getapp) | **Get** /apps/{app_id} | View an app
*DefaultApi* | [**GetApps**](docs/DefaultApi.md#getapps) | **Get** /apps | View apps
*DefaultApi* | [**GetNotification**](docs/DefaultApi.md#getnotification) | **Get** /notifications/{notification_id} | View notification
*DefaultApi* | [**GetNotificationHistory**](docs/DefaultApi.md#getnotificationhistory) | **Post** /notifications/{notification_id}/history | Notification History
*DefaultApi* | [**GetNotifications**](docs/DefaultApi.md#getnotifications) | **Get** /notifications | View notifications
*DefaultApi* | [**GetOutcomes**](docs/DefaultApi.md#getoutcomes) | **Get** /apps/{app_id}/outcomes | View Outcomes
*DefaultApi* | [**GetPlayer**](docs/DefaultApi.md#getplayer) | **Get** /players/{player_id} | View device
*DefaultApi* | [**GetPlayers**](docs/DefaultApi.md#getplayers) | **Get** /players | View devices
*DefaultApi* | [**UpdateApp**](docs/DefaultApi.md#updateapp) | **Put** /apps/{app_id} | Update an app
*DefaultApi* | [**UpdatePlayer**](docs/DefaultApi.md#updateplayer) | **Put** /players/{player_id} | Edit device
*DefaultApi* | [**UpdatePlayerTags**](docs/DefaultApi.md#updateplayertags) | **Put** /apps/{app_id}/users/{external_user_id} | Edit tags with external user id


## Documentation For Models

- [App](docs/App.md)
- [Button](docs/Button.md)
- [DeliveryData](docs/DeliveryData.md)
- [ExportPlayersRequestBody](docs/ExportPlayersRequestBody.md)
- [Filter](docs/Filter.md)
- [FilterExpressions](docs/FilterExpressions.md)
- [FilterNotificationTarget](docs/FilterNotificationTarget.md)
- [GetNotificationRequestBody](docs/GetNotificationRequestBody.md)
- [InlineResponse200](docs/InlineResponse200.md)
- [InlineResponse2001](docs/InlineResponse2001.md)
- [InlineResponse2002](docs/InlineResponse2002.md)
- [InlineResponse2003](docs/InlineResponse2003.md)
- [InlineResponse2004](docs/InlineResponse2004.md)
- [InlineResponse2005](docs/InlineResponse2005.md)
- [InlineResponse201](docs/InlineResponse201.md)
- [InlineResponse400](docs/InlineResponse400.md)
- [InlineResponse4001](docs/InlineResponse4001.md)
- [InlineResponse4002](docs/InlineResponse4002.md)
- [InlineResponse4003](docs/InlineResponse4003.md)
- [InvalidIdentifierError](docs/InvalidIdentifierError.md)
- [Notification](docs/Notification.md)
- [Notification200Errors](docs/Notification200Errors.md)
- [NotificationAllOf](docs/NotificationAllOf.md)
- [NotificationAllOfAndroidBackgroundLayout](docs/NotificationAllOfAndroidBackgroundLayout.md)
- [NotificationSlice](docs/NotificationSlice.md)
- [NotificationTarget](docs/NotificationTarget.md)
- [Operator](docs/Operator.md)
- [OutcomeData](docs/OutcomeData.md)
- [OutcomesData](docs/OutcomesData.md)
- [PlatformDeliveryData](docs/PlatformDeliveryData.md)
- [Player](docs/Player.md)
- [PlayerNotificationTarget](docs/PlayerNotificationTarget.md)
- [PlayerSlice](docs/PlayerSlice.md)
- [Purchase](docs/Purchase.md)
- [Segment](docs/Segment.md)
- [SegmentNotificationTarget](docs/SegmentNotificationTarget.md)
- [StringMap](docs/StringMap.md)
- [UpdatePlayerTagsRequestBody](docs/UpdatePlayerTagsRequestBody.md)


## Documentation For Authorization
Use a OneSignal authentication context for each auth type:
- `AppAuth`
- `UserAuth`

### app_key
- **Type**: HTTP Bearer token authentication

Example

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

### user_key
- **Type**: HTTP Bearer token authentication

Example

```golang
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]

Loading

0 comments on commit ba80e5b

Please sign in to comment.