sendbirdclient

package module
Version: v0.0.0-...-4f9646f Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2020 License: MIT Imports: 10 Imported by: 0

README

Sendbird Client Package for Golang

Drone Build Status Go Report Card

Features

This library provides wrapper functions for Sendbird Platform API written in Golang and support following Sendbird APIs:

Requirements

  • Go 1.5 or later.
  • Sendbird API Key.

Installation

To install SendbirdClient for Golang, please execute the following go get command.

    go get github.com/blazingorb/sendbirdclient

Usage

Sample Usage of creating a new Sendbird User:

package main

import (
	"flag"
	"fmt"
	sendbirdclient "sendbirdclient"
)

const (
	IssueAccessToken  = false
	IsDistinct        = true
)

var (
	apiKey   = flag.String("key", "", "API Key for using Sendbird Platform API")
	userID   = flag.String("id", "", "UserID for creating a new user")
	nickName = flag.String("name", "", "Nickname for creating a new user")
)

func main() {
	flag.Parse()

	testClient, err := sendbirdclient.NewClient(sendbirdclient.WithAPIKey(*apiKey))
	check(err)

	user, err := testClient.CreateAUserWithURL(&sendbirdclient.CreateAUserWithURLRequest{
		UserID:   *userID,
		NickName: *nickName,
		IssueAccessToken: IssueAccessToken,
	})
	check(err)
	fmt.Printf("User: %+v \n", user)
}

func check(err error) {
	if err != nil {
		fmt.Println(err)
		panic(err)
	}
}

For more detail sample cases, please refer to files under examples folder.

Documentation

Index

Constants

View Source
const (
	SendbirdAPITokenHeaderKey      = "Api-Token"
	SendbirdContentTypeHeaderValue = "application/json, charset=utf8"
)
View Source
const (
	ListLimitUpperBound = 100
	ListLimitLowerBound = 1
)

Sendbird list limits

View Source
const (
	//Users
	SendbirdURLUsers = `/users`

	//Open Channels
	SendbirdURLOpenChannels = `/open_channels`

	//Group Channels
	SendbirdURLGroupChannels = `/group_channels`
)

Sendbird urls template

View Source
const (
	TokenTypeGCM  = "GCM"
	TokenTypeAPNS = "APNS"
)

Sendbird token type for push service

View Source
const (
	ChannelTypeOpenChannel  = "open_channels"
	ChannelTypeGroupChannel = "group_channels"
)

Sendbird channel type

View Source
const (
	SendbirdAPIErrorUniqueIDConstraint = "violates unique constraint"
	SendbirdAPIErrorChannelNotFound    = "Channel not found"
	SendbirdAPIErrorUserNotFound       = "User not found"

	SendbirdClientErrorKeyValueMismatch = "Key and value are mismatched."
	SendbirdClientErrorUnsupportMethod  = "Unsupport http method."
	SendbirdClientErrorNotImplemented   = "Not implemented."

	SendbirdClientErrorUnsuppoertedWebhookCategory = "Unsupport webhook category."
)
View Source
const (
	WebhookCategoryOpenChannelMsgSend        webhookCategory = "open_channel:message_send"
	WebhookCategoryGroupChannelMsgSend       webhookCategory = "group_channel:message_send"
	WebhookCategoryOpenChannelMsgDeleted     webhookCategory = "open_channel:message_delete"
	WebhookCategoryGroupChannelMsgDeleted    webhookCategory = "group_channel:message_delete"
	WebhookCategoryGroupChannelMsgRead       webhookCategory = "group_channel:message_read"
	WebhookCategoryOpenChannelCreated        webhookCategory = "open_channel:create"
	WebhookCategoryGroupChannelCreated       webhookCategory = "group_channel:create"
	WebhookCategoryOpenChannelRemoved        webhookCategory = "open_channel:remove"
	WebhookCategoryGroupChannelInvited       webhookCategory = "group_channel:invite"
	WebhookCategoryGroupChannelJoined        webhookCategory = "group_channel:join"
	WebhookCategoryGroupChannelDeclineInvite webhookCategory = "group_channel:decline_invite"
	WebhookCategoryUserBlocked               webhookCategory = "user:block"
	WebhookCategoryUserUnblocked             webhookCategory = "user:unblock"
	WebhookCategoryUserMsgRateLimitExceeded  webhookCategory = "alert:user_message_rate_limit_exceeded"
)

Variables

This section is empty.

Functions

func CheckSendbirdError

func CheckSendbirdError(httpResp *http.Response) error

Types

type AdminMessage

type AdminMessage struct {
	Message string `json:"message"`
	Data    string `json:"data"`
	// contains filtered or unexported fields
}

type BanAUserInOpenChannelRequest

type BanAUserInOpenChannelRequest struct {
	UserID      string `json:"user_id"`
	Seconds     int    `json:"seconds,omitempty"`
	Description string `json:"description,omitempty"`
	NextURL     string `json:"next_url,omitempty"`
}

type BanAUserInOpenChannelResponse

type BanAUserInOpenChannelResponse struct {
	Description string `json:"description,omitempty"`
	User        User   `json:"user,omitempty"`
	StartAt     int64  `json:"start_at,omitempty"`
	EndAt       int64  `json:"end_at,omitempty"`
	NextURL     string `json:"next_url,omitempty"`
}

type BannedChannelResult

type BannedChannelResult struct {
	StartAt     int64       `json:"start_at"`
	EndAt       int64       `json:"end_at"`
	Description string      `json:"description"`
	Channel     OpenChannel `json:"channel"`
}

type BannedResult

type BannedResult struct {
	Description string `json:"description,omitempty"`
	User        User   `json:"user,omitempty"`
	StartAt     int64  `json:"start_at,omitempty"`
	EndAt       int64  `json:"end_at,omitempty"`
}

type BlockAUserRequest

type BlockAUserRequest struct {
	TargetID string `json:"target_id"`
}

type CheckIfMemberInGroupChannelResponse

type CheckIfMemberInGroupChannelResponse struct {
	IsMember bool `json:"is_member"`
}

type Client

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

Client may be used to make requests to Sendbird Platform APIs

func NewClient

func NewClient(options ...ClientOption) (*Client, error)

NewClient is the factory function for Client struct

func (*Client) BanAUserInOpenChannel

func (c *Client) BanAUserInOpenChannel(channelURL string, r *BanAUserInOpenChannelRequest) (BanAUserInOpenChannelResponse, error)

func (*Client) BlockAUser

func (c *Client) BlockAUser(userID string, r *BlockAUserRequest) (User, error)

func (*Client) CheckIfMemberInGroupChannel

func (c *Client) CheckIfMemberInGroupChannel(channelURL string, userID string) (CheckIfMemberInGroupChannelResponse, error)

func (*Client) CreateAChannelMetadata

func (c *Client) CreateAChannelMetadata(channelType string, channelURL string, r *CreateAChannelMetadataRequest) (map[string]string, error)

func (*Client) CreateAGroupChannelWithFile

func (c *Client) CreateAGroupChannelWithFile(r *CreateAGroupChannelWithFileRequest) (GroupChannel, error)

func (*Client) CreateAGroupChannelWithURL

func (c *Client) CreateAGroupChannelWithURL(r *CreateAGroupChannelWithURLRequest) (GroupChannel, error)

func (*Client) CreateAUserWithFile

func (c *Client) CreateAUserWithFile(r *CreateAUserWithFileRequest) (User, error)

func (*Client) CreateAUserWithURL

func (c *Client) CreateAUserWithURL(r *CreateAUserWithURLRequest) (User, error)

func (*Client) CreateAnOpenChannelWithFile

func (c *Client) CreateAnOpenChannelWithFile(r *CreateAnOpenChannelWithFileRequest) (OpenChannel, error)

func (*Client) CreateAnOpenChannelWithURL

func (c *Client) CreateAnOpenChannelWithURL(r *CreateAnOpenChannelWithURLRequest) (OpenChannel, error)

func (*Client) CreateAnUserMetaData

func (c *Client) CreateAnUserMetaData(userID string, r *CreateAnUserMetaDataRequest) (map[string]string, error)

func (*Client) CreateChannelMetaCounter

func (c *Client) CreateChannelMetaCounter(channelType string, channelURL string, r *CreateChannelMetaCounterRequest) (map[string]int, error)

func (*Client) DeleteAGroupChannel

func (c *Client) DeleteAGroupChannel(channelURL string) (sendbirdErrorResponse, error)

func (*Client) DeleteAUser

func (c *Client) DeleteAUser(userID string) (sendbirdErrorResponse, error)

func (*Client) DeleteAnOpenChannel

func (c *Client) DeleteAnOpenChannel(channelURL string) (sendbirdErrorResponse, error)

func (*Client) DeleteChannelMetaCounter

func (c *Client) DeleteChannelMetaCounter(channelType string, channelURL string) (sendbirdErrorResponse, error)

func (*Client) DeleteChannelMetaCounterByKeyName

func (c *Client) DeleteChannelMetaCounterByKeyName(channelType string, channelURL string, keyName string) (sendbirdErrorResponse, error)

func (*Client) DeleteChannelMetaData

func (c *Client) DeleteChannelMetaData(channelType string, channelURL string) (sendbirdErrorResponse, error)

func (*Client) DeleteChannelMetaDataByKeyName

func (c *Client) DeleteChannelMetaDataByKeyName(channelType string, channelURL string, keyName string) (sendbirdErrorResponse, error)

func (*Client) DeleteUserMetaData

func (c *Client) DeleteUserMetaData(userID string) (sendbirdErrorResponse, error)

func (*Client) DeleteUserMetaDataItem

func (c *Client) DeleteUserMetaDataItem(userID string, keyName string) (sendbirdErrorResponse, error)

func (*Client) FreezeAnGroupChannel

func (c *Client) FreezeAnGroupChannel(channelURL string, r *FreezeAnGroupChannelRequest) (GroupChannel, error)

func (*Client) FreezeAnOpenChannel

func (c *Client) FreezeAnOpenChannel(channelURL string, r *FreezeAnOpenChannelRequest) (OpenChannel, error)

func (*Client) GetChannelPushPerferences

func (c *Client) GetChannelPushPerferences(userID string, channelURL string) (GetChannelPushPerferencesResponse, error)

func (*Client) GetPushPerferences

func (c *Client) GetPushPerferences(userID string) (GetPushPerferencesResponse, error)

func (*Client) GetUnreadMessageCount

func (c *Client) GetUnreadMessageCount(userID string) (GetUnreadMessageCountResponse, error)

func (*Client) HideFromAGroupChannel

func (c *Client) HideFromAGroupChannel(channelURL string, r *HideFromAGroupChannelRequest) (sendbirdErrorResponse, error)

func (*Client) InviteMembersToGroupChannel

func (c *Client) InviteMembersToGroupChannel(channelURL string, r *InviteMembersToGroupChannelRequest) (GroupChannel, error)

func (*Client) LeaveFromAGroupChannel

func (c *Client) LeaveFromAGroupChannel(channelURL string, r *LeaveFromAGroupChannelRequest) (sendbirdErrorResponse, error)

func (*Client) ListBannedChannels

func (c *Client) ListBannedChannels(userID string, r *ListBannedChannelsRequest) (ListBannedChannelsResponse, error)

func (*Client) ListBannedUsersInOpenChannel

func (c *Client) ListBannedUsersInOpenChannel(channelURL string, r *ListBannedUsersInOpenChannelRequest) (ListBannedUsersInOpenChannelResponse, error)

func (*Client) ListBlockedUsers

func (c *Client) ListBlockedUsers(userID string, r *ListBlockUsersRequest) (ListBlockUsersResponse, error)

func (*Client) ListDeviceTokens

func (c *Client) ListDeviceTokens(userID string, tokenType string) (ListDeviceTokensResponse, error)

func (*Client) ListGroupChannels

func (c *Client) ListGroupChannels(r *ListGroupChannelsRequest) (ListGroupChannelsResponse, error)

func (*Client) ListMembersInGroupChannel

func (c *Client) ListMembersInGroupChannel(channelURL string, r *ListMembersInGroupChannelRequest) (ListMembersInGroupChannelResponse, error)

func (*Client) ListMutedChannels

func (c *Client) ListMutedChannels(userID string, r *ListMutedChannelsRequest) (ListMutedChannelsResponse, error)

func (*Client) ListMutedUsersInOpenChannel

func (c *Client) ListMutedUsersInOpenChannel(channelURL string, r *ListMutedUsersInOpenChannelRequest) (ListMutedUsersInOpenChannelResponse, error)

func (*Client) ListMyGroupChannels

func (c *Client) ListMyGroupChannels(userID string, r *ListMyGroupChannelsRequest) (ListMyGroupChannelsResponse, error)

func (*Client) ListOpenChannelParticipants

func (c *Client) ListOpenChannelParticipants(channelURL string, r *ListOpenChannelParticipantsRequest) (ListOpenChannelParticipantsResponse, error)

func (*Client) ListOpenChannels

func (c *Client) ListOpenChannels(r *ListOpenChannelsRequest) (ListOpenChannelsResponse, error)

func (*Client) ListUserMetaData

func (c *Client) ListUserMetaData(userID string, r *ListUserMetaDataRequest) (map[string]string, error)

func (*Client) ListUsers

func (c *Client) ListUsers(r *ListUsersRequest) (ListUsersResponse, error)

func (*Client) MarkAllMessagesAsRead

func (c *Client) MarkAllMessagesAsRead(userID string) (sendbirdErrorResponse, error)

func (*Client) MuteAUserInOpenChannel

func (c *Client) MuteAUserInOpenChannel(channelURL string, r *MuteAUserInOpenChannelRequest) (OpenChannel, error)

func (*Client) PrepareUrl

func (c *Client) PrepareUrl(pathEncodedUrl string) *url.URL

func (*Client) RegisterADeviceToken

func (c *Client) RegisterADeviceToken(userID string, tokenType string, r *RegisterADeviceTokenRequest) (RegisterADeviceTokenResponse, error)

func (*Client) ResetPushPerferences

func (c *Client) ResetPushPerferences(userID string) (sendbirdErrorResponse, error)

func (*Client) SendMessage

func (c *Client) SendMessage(channelType, channelURL string, r *SendMessageRequest) (sendMessageResponse, error)

func (*Client) UnbanAUserInOpenChannel

func (c *Client) UnbanAUserInOpenChannel(channelURL string, bannedUserID string) (sendbirdErrorResponse, error)

func (*Client) UnblockAUser

func (c *Client) UnblockAUser(userID string, targetID string) (sendbirdErrorResponse, error)

func (*Client) UnmuteAUserInOpenChannel

func (c *Client) UnmuteAUserInOpenChannel(channelURL string, mutedUserID string) (sendbirdErrorResponse, error)

func (*Client) UnregisterADeviceToken

func (c *Client) UnregisterADeviceToken(userID string, tokenType string, pushToken string) (UnregisterADeviceTokenResponse, error)

func (*Client) UnregisterAllDeviceTokens

func (c *Client) UnregisterAllDeviceTokens(userID string) (User, error)

func (*Client) UpdateAGroupChannel

func (c *Client) UpdateAGroupChannel(channelURL string, r *UpdateAGroupChannelRequest) (GroupChannel, error)

func (*Client) UpdateAUserWithFile

func (c *Client) UpdateAUserWithFile(userID string, r *UpdateAUserWithFileRequest) (User, error)

func (*Client) UpdateAUserWithURL

func (c *Client) UpdateAUserWithURL(userID string, r *UpdateAUserWithURLRequest) (User, error)

func (*Client) UpdateAnOpenChannelWithFile

func (c *Client) UpdateAnOpenChannelWithFile(channelURL string, r *UpdateAnOpenChannelWithFileRequest) (OpenChannel, error)

func (*Client) UpdateAnOpenChannelWithURL

func (c *Client) UpdateAnOpenChannelWithURL(channelURL string, r *UpdateAnOpenChannelWithURLRequest) (OpenChannel, error)

func (*Client) UpdateBanInOpenChannel

func (c *Client) UpdateBanInOpenChannel(channelURL string, bannedUserID string, r *UpdateBanInOpenChannelRequest) (BannedResult, error)

func (*Client) UpdateChannelMetaCounter

func (c *Client) UpdateChannelMetaCounter(channelType string, channelURL string, r *UpdateChannelMetaCounterRequest) (map[string]int, error)

func (*Client) UpdateChannelMetaCounterByKeyName

func (c *Client) UpdateChannelMetaCounterByKeyName(channelType string, channelURL string, keyName string, r *UpdateChannelMetaCounterByKeyNameRequest) (map[string]int, error)

func (*Client) UpdateChannelMetaData

func (c *Client) UpdateChannelMetaData(channelType string, channelURL string, r *UpdateChannelMetaDataRequest) (map[string]string, error)

func (*Client) UpdateChannelMetaDataByKeyName

func (c *Client) UpdateChannelMetaDataByKeyName(channelType string, channelURL string, keyName string, r *UpdateChannelMetaDataByKeyNameRequest) (map[string]string, error)

func (*Client) UpdateChannelPushPerferences

func (c *Client) UpdateChannelPushPerferences(userID string, channelURL string, r *UpdateChannelPushPerferencesRequest) (UpdateChannelPushPerferencesResponse, error)

func (*Client) UpdatePushPerferences

func (c *Client) UpdatePushPerferences(userID string, r *UpdatePushPerferencesRequest) (UpdatePushPerferencesResponse, error)

func (*Client) UpdateUserMetaData

func (c *Client) UpdateUserMetaData(userID string, r *UpdateUserMetaDataRequest) (map[string]string, error)

func (*Client) UpdateUserMetaDataItem

func (c *Client) UpdateUserMetaDataItem(userID string, keyName string, r *UpdateUserMetaDataItemRequest) (map[string]string, error)

func (*Client) ViewAGroupChannel

func (c *Client) ViewAGroupChannel(channelURL string, r *ViewAGroupChannelRequest) (GroupChannel, error)

func (*Client) ViewAMuteInOpenChannel

func (c *Client) ViewAMuteInOpenChannel(channelURL string, mutedUserID string) (ViewAMuteInOpenChannelResponse, error)

func (*Client) ViewAUser

func (c *Client) ViewAUser(userID string) (User, error)

func (*Client) ViewAnOpenChannel

func (c *Client) ViewAnOpenChannel(channelURL string, r *ViewAnOpenChannelRequest) (OpenChannel, error)

func (*Client) ViewAnUserMetaData

func (c *Client) ViewAnUserMetaData(userID string, keyName string) (map[string]string, error)

func (*Client) ViewBanInOpenChannel

func (c *Client) ViewBanInOpenChannel(channelURL string, bannedUserID string) (BannedResult, error)

func (*Client) ViewChannelMetaCounter

func (c *Client) ViewChannelMetaCounter(channelType string, channelURL string, r *ViewChannelMetaCounterRequest) (map[string]int, error)

func (*Client) ViewChannelMetaCounterByKeyName

func (c *Client) ViewChannelMetaCounterByKeyName(channelType string, channelURL string, keyName string) (map[string]int, error)

func (*Client) ViewChannelMetadata

func (c *Client) ViewChannelMetadata(channelType string, channelURL string, r *ViewChannelMetadataRequest) (map[string]string, error)

func (*Client) ViewChannelMetadataByKeyName

func (c *Client) ViewChannelMetadataByKeyName(channelType string, channelURL string, keyName string) (map[string]string, error)

type ClientOption

type ClientOption func(*Client) error

ClientOption is the type of constructor options for NewClient(...).

func WithAPIKey

func WithAPIKey(apiKey string) ClientOption

WithAPIKey configures a Maps API client with an API Key

func WithHTTPClient

func WithHTTPClient(c *http.Client) ClientOption

WithHTTPClient configures a Maps API client with a http.Client to make requests over.

type CreateAChannelMetadataRequest

type CreateAChannelMetadataRequest struct {
	Metadata map[string]string `json:"metadata"`
}

type CreateAGroupChannelWithFileRequest

type CreateAGroupChannelWithFileRequest struct {
	Name       string   `json:"name,omitempty"`
	CoverFile  []byte   `json:"cover_file,omitempty"`
	CustomType string   `json:"custom_type,omitempty"`
	Data       string   `json:"data,omitempty"`
	UserIDs    []string `json:"user_ids,omitempty"`
	IsDistinct bool     `json:"is_distinct,omitempty"`
}

type CreateAGroupChannelWithURLRequest

type CreateAGroupChannelWithURLRequest struct {
	Name       string   `json:"name,omitempty"`
	CoverURL   string   `json:"cover_url,omitempty"`
	CustomType string   `json:"custom_type,omitempty"`
	Data       string   `json:"data,omitempty"`
	UserIDs    []string `json:"user_ids,omitempty"`
	IsDistinct bool     `json:"is_distinct,omitempty"`
}

type CreateAUserWithFileRequest

type CreateAUserWithFileRequest struct {
	UserID           string `json:"user_id"`
	NickName         string `json:"nickname"`
	ProfileFile      string `json:"profile_file"`
	IssueAccessToken bool   `json:"issue_access_token,omitempty"`
}

type CreateAUserWithURLRequest

type CreateAUserWithURLRequest struct {
	UserID           string `json:"user_id"`
	NickName         string `json:"nickname"`
	ProfileURL       string `json:"profile_url"`
	IssueAccessToken bool   `json:"issue_access_token,omitempty"`
}

type CreateAnOpenChannelWithFileRequest

type CreateAnOpenChannelWithFileRequest struct {
	Name       string   `json:"name,omitempty"`
	ChannelURL string   `json:"channel_url,omitempty"`
	CoverFile  []byte   `json:"cover_file,omitempty"`
	CustomType string   `json:"custom_type,omitempty"`
	Data       string   `json:"data,omitempty"`
	Operators  []string `json:"operators,omitempty"`
}

type CreateAnOpenChannelWithURLRequest

type CreateAnOpenChannelWithURLRequest struct {
	Name       string   `json:"name,omitempty"`
	ChannelURL string   `json:"channel_url,omitempty"`
	CoverURL   string   `json:"cover_url,omitempty"`
	CustomType string   `json:"custom_type,omitempty"`
	Data       string   `json:"data,omitempty"`
	Operators  []string `json:"operators,omitempty"`
}

type CreateAnUserMetaDataRequest

type CreateAnUserMetaDataRequest struct {
	MetaData map[string]string `json:"metadata"`
}

type CreateChannelMetaCounterRequest

type CreateChannelMetaCounterRequest struct {
	Metacounter map[string]int `json:"metacounter"`
}

type File

type File struct {
	URL  string `json:"url"`
	Data string `json:"data"`
}

type FileMessage

type FileMessage struct {
	File     File   `json:"file"`
	FileName string `json:"file_name"`
	FileSize string `json:"file_size"`
	FileType string `json:"file_type"`
	// contains filtered or unexported fields
}

type FreezeAnGroupChannelRequest

type FreezeAnGroupChannelRequest struct {
	Freeze bool `json:"freeze"`
}

type FreezeAnOpenChannelRequest

type FreezeAnOpenChannelRequest struct {
	Freeze bool `json:"freeze"`
}

type GetChannelPushPerferencesResponse

type GetChannelPushPerferencesResponse struct {
	Enable bool `json:"enable"`
}

type GetPushPerferencesResponse

type GetPushPerferencesResponse struct {
	DoNotDisturb bool   `json:"do_not_disturb,omitempty"`
	StartHour    int    `json:"start_hour,omitempty"`
	StartMin     int    `json:"start_min,omitempty"`
	EndHour      int    `json:"end_hour,omitempty"`
	EndMin       int    `json:"end_min,omitempty"`
	TimeZone     string `json:"timezone,omitempty"`
}

type GetUnreadMessageCountResponse

type GetUnreadMessageCountResponse struct {
	UnreadCount int64 `json:"unread_count"`
}

type GroupChannel

type GroupChannel struct {
	IsDistinct         bool             `json:"is_distinct"`
	MemberCount        int              `json:"member_count"`
	Members            []User           `json:"members"`
	ReadReceipt        map[string]int64 `json:"read_receipt"`
	UnreadMessageCount int              `json:"unread_message_count"`
	LastMessage        LastMessage      `json:"last_message"`
	// contains filtered or unexported fields
}

type HideFromAGroupChannelRequest

type HideFromAGroupChannelRequest struct {
	UserID string `json:"user_id"`
}

type InviteMembersToGroupChannelRequest

type InviteMembersToGroupChannelRequest struct {
	UserIDs []string `json:"user_ids"`
}

type LastMessage

type LastMessage struct {
	CreatedAt int64 `json:"created_at"`
	User      User  `json:"user"`
}

type LeaveFromAGroupChannelRequest

type LeaveFromAGroupChannelRequest struct {
	UserIDs []string `json:"user_ids"`
}

type ListBannedChannelsRequest

type ListBannedChannelsRequest struct {
	Token string `json:"token,omitempty"`
	Limit int    `json:"limit,omitempty"`
}

type ListBannedChannelsResponse

type ListBannedChannelsResponse struct {
	BannedChannels []BannedChannelResult `json:"banned_channels"`
	Next           string                `json:"next"`
}

type ListBannedUsersInOpenChannelRequest

type ListBannedUsersInOpenChannelRequest struct {
	Token string `json:"token,omitempty"`
	Limit int    `json:"limit,omitempty"`
}

type ListBannedUsersInOpenChannelResponse

type ListBannedUsersInOpenChannelResponse struct {
	BannedList []BannedResult `json:"banned_list"`
	Next       string         `json:"next"`
}

type ListBlockUsersRequest

type ListBlockUsersRequest struct {
	Token string `json:"token,omitempty"`
	Limit int    `json:"limit,omitempty"`
}

type ListBlockUsersResponse

type ListBlockUsersResponse struct {
	Users []User `json:"users"`
	Next  string `json:"next"`
}

type ListDeviceTokensResponse

type ListDeviceTokensResponse struct {
	Tokens []string `json:"tokens"`
	Type   string   `json:"type"`
	User   User     `json:"user"`
}

type ListGroupChannelsRequest

type ListGroupChannelsRequest struct {
	Token                   string   `json:"token,omitempty"`
	Limit                   int      `json:"limit,omitempty"`
	ShowMember              bool     `json:"show_member,omitempty"`
	ShowReadReceipt         bool     `json:"show_read_receipt,omitempty"`
	DistinctMode            string   `json:"distinct_mode,omitempty"`
	MembersExactlyIn        []string `json:"members_exactly_in,omitempty"`
	MembersIncludeIn        []string `json:"members_include_in,omitempty"`
	MembersNicknameContains []string `json:"members_nickname_contains,omitempty"`
	QueryType               string   `json:"query_type,omitempty"`
	CustomType              string   `json:"custom_type,omitempty"`
	ChannelURLs             []string `json:"channel_urls,omitempty"`
	CreatedAfter            int64    `json:"created_after,omitempty"`
	CreatedBefore           int64    `json:"created_before,omitempty"`
}

type ListGroupChannelsResponse

type ListGroupChannelsResponse struct {
	Channels []GroupChannel `json:"channels"`
	Next     string         `json:"next"`
}

type ListMembersInGroupChannelRequest

type ListMembersInGroupChannelRequest struct {
	Token string `json:"token,omitempty"`
	Limit int    `json:"limit,omitempty"`
}

type ListMembersInGroupChannelResponse

type ListMembersInGroupChannelResponse struct {
	Members []User `json:"members"`
	Next    string `json:"next"`
}

type ListMutedChannelsRequest

type ListMutedChannelsRequest struct {
	Token string `json:"token,omitempty"`
	Limit int    `json:"limit,omitempty"`
}

type ListMutedChannelsResponse

type ListMutedChannelsResponse struct {
	MutedChannels []OpenChannel `json:"muted_channels"`
	Next          string        `json:"next"`
}

type ListMutedUsersInOpenChannelRequest

type ListMutedUsersInOpenChannelRequest struct {
	Token string `json:"token,omitempty"`
	Limit int    `json:"limit,omitempty"`
}

type ListMutedUsersInOpenChannelResponse

type ListMutedUsersInOpenChannelResponse struct {
	MutedList []User `json:"muted_list"`
	Next      string `json:"next"`
}

type ListMyGroupChannelsRequest

type ListMyGroupChannelsRequest struct {
	Token                   string   `json:"token,omitempty"`
	Limit                   int      `json:"limit,omitempty"`
	ShowEmpty               bool     `json:"show_empty,omitempty"`
	ShowMember              bool     `json:"show_member,omitempty"`
	ShowReadReceipt         bool     `json:"show_read_receipt,omitempty"`
	DistinctMode            string   `json:"distinct_mode,omitempty"`
	Order                   string   `json:"order,omitempty"`
	MembersExactlyIn        []string `json:"members_exactly_in,omitempty"`
	MembersNicknameContains []string `json:"members_nickname_contains,omitempty"`
	MembersIncludeIn        []string `json:"members_include_in,omitempty"`
	QueryType               string   `json:"query_type,omitempty"`
	CustomType              string   `json:"custom_type,omitempty"`
	ChannelURLs             []string `json:"channel_urls,omitempty"`
	CreatedAfter            int64    `json:"created_after,omitempty"`
	CreatedBefore           int64    `json:"created_before,omitempty"`
}

type ListMyGroupChannelsResponse

type ListMyGroupChannelsResponse struct {
	Channels []GroupChannel `json:"channels"`
	Next     string         `json:"next"`
}

type ListOpenChannelParticipantsRequest

type ListOpenChannelParticipantsRequest struct {
	Token string `json:"token,omitempty"`
	Limit int    `json:"limit,omitempty"`
}

type ListOpenChannelParticipantsResponse

type ListOpenChannelParticipantsResponse struct {
	Participants []User `json:"participants"`
	Next         string `json:"next"`
}

type ListOpenChannelsRequest

type ListOpenChannelsRequest struct {
	Token      string `json:"token,omitempty"`
	Limit      int    `json:"limit,omitempty"`
	CustomType string `json:"custom_type,omitempty"`
}

type ListOpenChannelsResponse

type ListOpenChannelsResponse struct {
	Channels []OpenChannel `json:"channels"`
	Next     string        `json:"next"`
}

type ListUserMetaDataRequest

type ListUserMetaDataRequest struct {
	Keys []string `json:"keys,omitempty"`
}

type ListUsersRequest

type ListUsersRequest struct {
	Token      string   `json:"token,omitempty"`
	Limit      int      `json:"limit,omitempty"`
	ActiveMode string   `json:"active_mode,omitempty"`
	ShowBot    bool     `json:"show_bot,omitempty"`
	UserIDs    []string `json:"user_ids,omitempty"`
}

type ListUsersResponse

type ListUsersResponse struct {
	Users []User `json:"users"`
	Next  string `json:"next"`
}

type MuteAUserInOpenChannelRequest

type MuteAUserInOpenChannelRequest struct {
	UserID string `json:"user_id"`
}

type OpenChannel

type OpenChannel struct {
	Operators        []User `json:"operators"`
	Participants     []User `json:"participants"`
	ParticipantCount int    `json:"participant_count"`
	Freeze           bool   `json:"freeze"`
	// contains filtered or unexported fields
}

type RegisterADeviceTokenRequest

type RegisterADeviceTokenRequest struct {
	GcmRegToken     string `json:"gcm_reg_token,omitempty"`
	ApnsDeviceToken string `json:"apns_device_token,omitempty"`
}

type RegisterADeviceTokenResponse

type RegisterADeviceTokenResponse struct {
	Token []string `json:"token"`
	Type  string   `json:"type"`
	User  User     `json:"user"`
}

type SendMessageRequest

type SendMessageRequest struct {
	MessageType string `json:"message_type"`
	UserId      string `json:"user_id"`
	Message     string `json:"message"`

	CustomType string `json:"custom_type"`
	Data       string `json:"data"`
}

type TextMessage

type TextMessage struct {
	Message string `json:"message"`
	Data    string `json:"data"`
	File    File   `json:"file"`
	// contains filtered or unexported fields
}

type UnregisterADeviceTokenResponse

type UnregisterADeviceTokenResponse struct {
	Token []string `json:"token"`
	User  User     `json:"user"`
}

type UpdateAGroupChannelRequest

type UpdateAGroupChannelRequest struct {
	Name       string `json:"name,omitempty"`
	CoverURL   string `json:"cover_url,omitempty"`
	CustomType string `json:"custom_type,omitempty"`
	Data       string `json:"data,omitempty"`
	IsDistinct bool   `json:"is_distinct,omitempty"`
}

type UpdateAUserWithFileRequest

type UpdateAUserWithFileRequest struct {
	NickName                string `json:"nickname,omitempty"`
	ProfileFile             string `json:"profile_file,omitempty"`
	IssueAccessToken        bool   `json:"issue_access_token,omitempty"`
	IsActive                bool   `json:"is_active,omitempty"`
	LeaveAllWhenDeactivated bool   `json:"leave_all_when_deactivated,omitempty"`
}

type UpdateAUserWithURLRequest

type UpdateAUserWithURLRequest struct {
	NickName                string `json:"nickname,omitempty"`
	ProfileURL              string `json:"profile_url,omitempty"`
	IssueAccessToken        bool   `json:"issue_access_token,omitempty"`
	IsActive                bool   `json:"is_active,omitempty"`
	LeaveAllWhenDeactivated bool   `json:"leave_all_when_deactivated,omitempty"`
}

type UpdateAnOpenChannelWithFileRequest

type UpdateAnOpenChannelWithFileRequest struct {
	Name       string   `json:"name,omitempty"`
	CustomType string   `json:"custom_type,omitempty"`
	CoverFile  string   `json:"cover_file,omitempty"`
	Data       string   `json:"data,omitempty"`
	Operators  []string `json:"operators,omitempty"`
}

type UpdateAnOpenChannelWithURLRequest

type UpdateAnOpenChannelWithURLRequest struct {
	Name       string   `json:"name,omitempty"`
	CoverURL   string   `json:"cover_url,omitempty"`
	CustomType string   `json:"custom_type,omitempty"`
	Data       string   `json:"data,omitempty"`
	Operators  []string `json:"operators,omitempty"`
}

type UpdateBanInOpenChannelRequest

type UpdateBanInOpenChannelRequest struct {
	Description string `json:"description,omitempty"`
	Seconds     int    `json:"seconds"`
}

type UpdateChannelMetaCounterByKeyNameRequest

type UpdateChannelMetaCounterByKeyNameRequest struct {
	Value  int    `json:"value"`
	Mode   string `json:"mode,omitempty"`
	Upsert bool   `json:"upsert,omitempty"`
}

type UpdateChannelMetaCounterRequest

type UpdateChannelMetaCounterRequest struct {
	Metacounter map[string]int `json:"metacounter"`
	Mode        string         `json:"mode,omitempty"`
	Upsert      bool           `json:"upsert,omitempty"`
}

type UpdateChannelMetaDataByKeyNameRequest

type UpdateChannelMetaDataByKeyNameRequest struct {
	Value  string `json:"value"`
	Upsert bool   `json:"upsert,omitempty"`
}

type UpdateChannelMetaDataRequest

type UpdateChannelMetaDataRequest struct {
	Metadata map[string]string `json:"metadata"`
	Upsert   bool              `json:"upsert,omitempty"`
}

type UpdateChannelPushPerferencesRequest

type UpdateChannelPushPerferencesRequest struct {
	Enable bool `json:"enable"`
}

type UpdateChannelPushPerferencesResponse

type UpdateChannelPushPerferencesResponse struct {
	Enable bool `json:"enable"`
}

type UpdatePushPerferencesRequest

type UpdatePushPerferencesRequest struct {
	DoNotDisturb bool   `json:"do_not_disturb,omitempty"`
	StartHour    int    `json:"start_hour,omitempty"`
	StartMin     int    `json:"start_min,omitempty"`
	EndHour      int    `json:"end_hour,omitempty"`
	EndMin       int    `json:"end_min,omitempty"`
	TimeZone     string `json:"timezone,omitempty"`
}

type UpdatePushPerferencesResponse

type UpdatePushPerferencesResponse struct {
	DoNotDisturb bool   `json:"do_not_disturb,omitempty"`
	StartHour    int    `json:"start_hour,omitempty"`
	StartMin     int    `json:"start_min,omitempty"`
	EndHour      int    `json:"end_hour,omitempty"`
	EndMin       int    `json:"end_min,omitempty"`
	TimeZone     string `json:"timezone,omitempty"`
}

type UpdateUserMetaDataItemRequest

type UpdateUserMetaDataItemRequest struct {
	Value  string `json:"value"`
	Upsert bool   `json:"upsert,omitempty"`
}

type UpdateUserMetaDataRequest

type UpdateUserMetaDataRequest struct {
	MetaData interface{} `json:"metadata"`
	Upsert   bool        `json:"upsert,omitempty"`
}

type User

type User struct {
	UserID      string `json:"user_id"`
	NickName    string `json:"nickname"`
	ProfileURL  string `json:"profile_url"`
	ProfileFile []byte `json:"profile_file"`
	AccessToken string `json:"access_token"`
	IsActive    bool   `json:"is_active"`
	IsOnline    bool   `json:"is_online"`
	LastSeenAt  int64  `json:"last_seen_at"`
}

type ViewAGroupChannelRequest

type ViewAGroupChannelRequest struct {
	ShowReadReceipt bool `json:"show_read_receipt,omitempty"`
	ShowMember      bool `json:"show_member,omitempty"`
}

type ViewAMuteInOpenChannelResponse

type ViewAMuteInOpenChannelResponse struct {
	IsMuted bool `json:"is_muted"`
}

type ViewAnOpenChannelRequest

type ViewAnOpenChannelRequest struct {
	Participants bool `json:"participants,omitempty"`
}

type ViewChannelMetaCounterRequest

type ViewChannelMetaCounterRequest struct {
	Keys []string `json:"keys"`
}

type ViewChannelMetadataRequest

type ViewChannelMetadataRequest struct {
	Keys []string `json:"keys"`
}

type WebhookCallback

type WebhookCallback func(message interface{}) error

type WebhookHelper

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

func NewWebhookHelper

func NewWebhookHelper() *WebhookHelper

func (*WebhookHelper) SendbirdWebhook

func (wh *WebhookHelper) SendbirdWebhook(w http.ResponseWriter, req *http.Request)

func (*WebhookHelper) Subscribe

func (h *WebhookHelper) Subscribe(callbackTopic webhookCategory, callback WebhookCallback)

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL