push

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client ... プッシュ通知のクライアント

func NewClient

func NewClient(appID string, endpoint string, authToken string) *Client

NewClient ... クライアントを作成する

func (*Client) CreateReserve

func (c *Client) CreateReserve(ctx context.Context, userIDs []string, msg *Message, reservedAt int64, unmanaged bool) (*Reserve, error)

CreateReserve ... 予約を作成する

func (*Client) Entry

func (c *Client) Entry(ctx context.Context, userID string, pf Platform, deviceID string, token string) error

Entry ... 登録する

func (*Client) GetReserve

func (c *Client) GetReserve(ctx context.Context, reserveID string) (*Reserve, error)

GetReserve ... 予約を取得する

func (*Client) Leave

func (c *Client) Leave(ctx context.Context, userID string, pf Platform, deviceID string) error

Leave ... 解除する

func (*Client) ListReserve

func (c *Client) ListReserve(ctx context.Context, limit int, cursor string) ([]*Reserve, string, error)

ListReserve ... 予約リストを取得する

func (*Client) SendByAllUsers

func (c *Client) SendByAllUsers(ctx context.Context, pushID string, msg *Message) error

SendByAllUsers ... 全員に送信する

func (*Client) SendByUsers

func (c *Client) SendByUsers(ctx context.Context, userIDs []string, pushID string, msg *Message) error

SendByUsers ... 指定したユーザーに送信する

func (*Client) UpdateReserve

func (c *Client) UpdateReserve(ctx context.Context, reserveID string, userIDs []string, msg *Message, reservedAt int64, status ReserveStatus) (*Reserve, error)

UpdateReserve ... 予約を更新する

type Message

type Message struct {
	Title   string            `json:"title"`
	Body    string            `json:"body"`
	Data    map[string]string `json:"data"`
	IOS     *MessageIOS       `json:"ios"`
	Android *MessageAndroid   `json:"android"`
	Web     *MessageWeb       `json:"web"`
}

Message ... プッシュ通知メッセージ

type MessageAndroid

type MessageAndroid struct {
	ClickAction string `json:"click_action,omitempty"`
	Sound       string `json:"sound,omitempty"`
	Tag         string `json:"badge,omitempty"`
}

MessageAndroid ... プッシュ通知メッセージ(Android独自部分)

type MessageIOS

type MessageIOS struct {
	Sound string `json:"sound,omitempty"`
	Badge int    `json:"badge,omitempty"`
}

MessageIOS ... プッシュ通知メッセージ(iOS独自部分)

type MessageWeb

type MessageWeb struct {
	Icon string `json:"icon,omitempty"`
}

MessageWeb ... プッシュ通知メッセージ(Web独自部分)

type Platform

type Platform string

Platform ... 送信元のプラットフォーム

const (
	// PlatformIOS ... iOS
	PlatformIOS Platform = "ios"
	// PlatformAndroid ... Android
	PlatformAndroid Platform = "android"
	// PlatformWeb ... Web
	PlatformWeb Platform = "web"
)

type Reserve

type Reserve struct {
	ID         string        `json:"id"`
	UserIDs    []string      `json:"user_ids"`
	Message    *Message      `json:"message"`
	ReservedAt int64         `json:"reserved_at"`
	Status     ReserveStatus `json:"status"`
	Unmanaged  bool          `json:"unmanaged"`
	CreatedAt  int64         `json:"created_at"`
	UpdatedAt  int64         `json:"updated_at"`
}

Reserve ... 予約

type ReserveStatus

type ReserveStatus string

ReserveStatus ... 予約ステータス

const (
	// ReserveStatusReserved ... 予約ステータス: 予約中
	ReserveStatusReserved ReserveStatus = "reserved"
	// ReserveStatusCanceled ... 予約ステータス: キャンセル
	ReserveStatusCanceled ReserveStatus = "canceled"
	// ReserveStatusProcessing ... 予約ステータス: 処理中
	ReserveStatusProcessing ReserveStatus = "processing"
	// ReserveStatusFailure ... 予約ステータス: 送信失敗
	ReserveStatusFailure ReserveStatus = "failure"
	// ReserveStatusSuccess ... 予約ステータス: 送信成功
	ReserveStatusSuccess ReserveStatus = "success"
)

Jump to

Keyboard shortcuts

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