airship

package module
v0.0.0-...-09c1208 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 10 Imported by: 0

README

airship-go

Build Status Go Report Card License MIT

Airship Go client.

Documentation

Index

Constants

View Source
const (
	NorthAmerica = "https://go.urbanairship.com"
	Europe       = "https://go.airship.eu"
)

Airship API base URLs

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int
	Response   *ErrorResponse
	RawBody    []byte
}

APIError represents an Airship API error. When possible, the response will be parsed into the Response field.

func (*APIError) Error

func (e *APIError) Error() string

type Actions

type Actions struct {
	Open OpenAction `json:"open,omitempty"`
}

Actions data format

type AndroidOverride

type AndroidOverride struct {
	Style *AndroidStyle `json:"style,omitempty"`
	Title string        `json:"title,omitempty"`
}

AndroidOverride data format

type AndroidStyle

type AndroidStyle struct {
	BigPicture string `json:"big_picture,omitempty"`
	Type       string `json:"type,omitempty"`
}

AndroidStyle is the representation of Android advanced styles.

type AtomicSelector

type AtomicSelector struct {
	AudienceSelector `json:"-"`
	NamedUser        []string `json:"named_user,omitempty"`
	Tag              []string `json:"tag,omitempty"`
}

AtomicSelector data format

type AudienceSelector

type AudienceSelector interface{}

AudienceSelector data format

type Auth

type Auth func(*Client)

Auth represents the API authentication method.

func BasicAuth

func BasicAuth(appKey, secret string) Auth

BasicAuth is the HTTP Basic Auth authentication method.

func BearerAuth

func BearerAuth(token string) Auth

BearerAuth is the HTTP Bearer token authentication method.

type Campaigns

type Campaigns struct {
	Categories []string `json:"categories,omitempty"`
}

Campaigns data format

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a client for the Airship API.

func NewClient

func NewClient(baseURL string, auth Auth) *Client

NewClient returns a new Airship client.

func (*Client) Push

func (c *Client) Push(ctx context.Context, objects []PushObject) (*PushResponse, error)

Push is POST /api/push

type CompoundSelector

type CompoundSelector struct {
	AudienceSelector `json:"-"`
	And              []AudienceSelector `json:"AND,omitempty"`
}

CompoundSelector data format

type ErrorDetails

type ErrorDetails struct {
	Error    string `json:"error"`
	Location struct {
		Line   int `json:"line"`
		Column int `json:"column"`
	} `json:"location"`
	Path string `json:"path"`
}

ErrorDetails data format

type ErrorResponse

type ErrorResponse struct {
	Error     string       `json:"error"`
	ErrorCode int          `json:"error_code"`
	Details   ErrorDetails `json:"details"`
}

ErrorResponse data format

type IOSMediaAttachment

type IOSMediaAttachment struct {
	URL string `json:"url,omitempty"`
}

IOSMediaAttachment is the representation of media attachments (>= iOS 10).

type IOSOverride

type IOSOverride struct {
	MediaAttachment *IOSMediaAttachment `json:"media_attachment,omitempty"`
	Title           string              `json:"title,omitempty"`
}

IOSOverride data format

type MessageCenterObject

type MessageCenterObject struct {
	Body        string            `json:"body,omitempty"`
	ContentType string            `json:"content_type,omitempty"`
	Expiry      *Time             `json:"expiry,omitempty"`
	Extra       map[string]string `json:"extra,omitempty"`
	Title       string            `json:"title,omitempty"`
}

MessageCenterObject data format

type NotificationObject

type NotificationObject struct {
	Actions *Actions         `json:"actions,omitempty"`
	Alert   string           `json:"alert,omitempty"`
	Android *AndroidOverride `json:"android,omitempty"`
	IOS     *IOSOverride     `json:"ios,omitempty"`
}

NotificationObject data format

type OpenAction

type OpenAction interface{}

OpenAction data format

type OpenDeepLinkAction

type OpenDeepLinkAction struct {
	OpenAction `json:"-"`
	Content    string `json:"content,omitempty"`
	Type       string `json:"type,omitempty"`
}

OpenDeepLinkAction data format

type Options

type Options struct {
	Expiry *Time `json:"expiry,omitempty"`
}

Options data format

type PushObject

type PushObject struct {
	Audience     AudienceSelector     `json:"audience,omitempty"`
	Campaigns    *Campaigns           `json:"campaigns,omitempty"`
	DeviceTypes  []string             `json:"device_types,omitempty"`
	Message      *MessageCenterObject `json:"message,omitempty"`
	Notification *NotificationObject  `json:"notification,omitempty"`
	Options      *Options             `json:"options,omitempty"`
}

PushObject data format

type PushResponse

type PushResponse struct {
	OK          bool     `json:"ok"`
	OperationID string   `json:"operation_id"`
	PushIDs     []string `json:"push_ids"`
}

PushResponse is the response format for POST /api/push

type Time

type Time time.Time

Time is the representation of Airship ISO UTC timestamp.

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL