Documentation ΒΆ
Index ΒΆ
- Constants
- Variables
- func AddMembersWithHideHistory() func(*addMembersOptions)
- func AddMembersWithMessage(message *Message) func(*addMembersOptions)
- func AddMembersWithRolesAssignment(assignements []*RoleAssignment) func(*addMembersOptions)
- func BanWithExpiration(expiration int) func(*banOptions)
- func BanWithReason(reason string) func(*banOptions)
- func DeactivateUserWithCreatedBy(userID string) func(*deactivateUserOptions)
- func DeactivateUserWithMarkChannelsDeleted() func(*deactivateUserOptions)
- func DeactivateUserWithMarkMessagesDeleted() func(*deactivateUserOptions)
- func DeleteUserWithDeleteConversations() func(*deleteUserOptions)
- func DeleteUserWithHardDelete() func(*deleteUserOptions)
- func DeleteUserWithMarkMessagesDeleted() func(*deleteUserOptions)
- func MarkReadUntilMessage(id string) func(*markReadOption)
- func MessagePending(r *messageRequest)
- func MessageSkipEnrichURL(r *messageRequest)
- func MessageSkipPush(r *messageRequest)
- func MuteWithExpiration(expiration int) func(*muteOptions)
- func ReactivateUserWithCreatedBy(userID string) func(*reactivateUserOptions)
- func ReactivateUserWithName(name string) func(*reactivateUserOptions)
- func ReactivateUserWithRestoreChannels() func(*reactivateUserOptions)
- func ReactivateUserWithRestoreMessages() func(*reactivateUserOptions)
- func TruncateWithHardDelete() func(*truncateOptions)
- func TruncateWithMessage(message *Message) func(*truncateOptions)
- func TruncateWithSkipPush() func(*truncateOptions)
- func TruncateWithTruncatedAt(truncatedAt *time.Time) func(*truncateOptions)
- func TruncateWithUser(user *User) func(*truncateOptions)
- func TruncateWithUserID(userID string) func(*truncateOptions)
- func Version() string
- func WithTimeout(t time.Duration) func(c *Client)
- type APNConfig
- type AddMembersOptions
- type AppResponse
- type AppSettings
- func (a *AppSettings) SetAPNConfig(c APNConfig) *AppSettings
- func (a *AppSettings) SetDisableAuth(b bool) *AppSettings
- func (a *AppSettings) SetDisablePermissions(b bool) *AppSettings
- func (a *AppSettings) SetFirebaseConfig(c FirebaseConfigRequest) *AppSettings
- func (a *AppSettings) SetGrants(g map[string][]string) *AppSettings
- func (a *AppSettings) SetMultiTenant(b bool) *AppSettings
- func (a *AppSettings) SetWebhookURL(s string) *AppSettings
- type AsyncTaskResponse
- type Attachment
- type Ban
- type BanOption
- type Blocklist
- type BlocklistBase
- type BlocklistCreateRequest
- type Channel
- func (ch *Channel) AcceptInvite(ctx context.Context, userID string, message *Message) (*Response, error)
- func (ch *Channel) AddMembers(ctx context.Context, userIDs []string, options ...AddMembersOptions) (*Response, error)
- func (ch *Channel) AddModerators(ctx context.Context, userIDs ...string) (*Response, error)
- func (ch *Channel) AddModeratorsWithMessage(ctx context.Context, userIDs []string, msg *Message) (*Response, error)
- func (ch *Channel) AssignRole(ctx context.Context, assignments []*RoleAssignment, msg *Message) (*Response, error)
- func (ch *Channel) BanUser(ctx context.Context, targetID, bannedBy string, options ...BanOption) (*Response, error)
- func (ch *Channel) Delete(ctx context.Context) (*Response, error)
- func (ch *Channel) DeleteFile(ctx context.Context, location string) (*Response, error)
- func (ch *Channel) DeleteImage(ctx context.Context, location string) (*Response, error)
- func (ch *Channel) DeleteReaction(ctx context.Context, messageID, reactionType, userID string) (*ReactionResponse, error)
- func (ch *Channel) DemoteModerators(ctx context.Context, userIDs ...string) (*Response, error)
- func (ch *Channel) DemoteModeratorsWithMessage(ctx context.Context, userIDs []string, msg *Message) (*Response, error)
- func (ch *Channel) GetMessages(ctx context.Context, messageIds []string) (*GetMessagesResponse, error)
- func (ch *Channel) GetReplies(ctx context.Context, parentID string, options map[string][]string) (*RepliesResponse, error)
- func (ch *Channel) Hide(ctx context.Context, userID string) (*Response, error)
- func (ch *Channel) HideWithHistoryClear(ctx context.Context, userID string) (*Response, error)
- func (ch *Channel) InviteMembers(ctx context.Context, userIDs ...string) (*Response, error)
- func (ch *Channel) InviteMembersWithMessage(ctx context.Context, userIDs []string, msg *Message) (*Response, error)
- func (ch *Channel) MarkRead(ctx context.Context, userID string, options ...MarkReadOption) (*Response, error)
- func (ch Channel) MarshalJSON() ([]byte, error)
- func (ch *Channel) Mute(ctx context.Context, userID string, expiration *time.Duration) (*ChannelMuteResponse, error)
- func (ch *Channel) PartialUpdate(ctx context.Context, update PartialUpdate) (*Response, error)
- func (ch *Channel) Query(ctx context.Context, q *QueryRequest) (*QueryResponse, error)
- func (ch *Channel) QueryMembers(ctx context.Context, q *QueryOption, sorters ...*SortOption) (*QueryMembersResponse, error)
- func (ch *Channel) RefreshState(ctx context.Context) (*QueryResponse, error)
- func (ch *Channel) RejectInvite(ctx context.Context, userID string, message *Message) (*Response, error)
- func (ch *Channel) RemoveMembers(ctx context.Context, userIDs []string, message *Message) (*Response, error)
- func (ch *Channel) SendAction(ctx context.Context, msgID string, formData map[string]string) (*MessageResponse, error)
- func (ch *Channel) SendEvent(ctx context.Context, event *Event, userID string) (*Response, error)
- func (ch *Channel) SendFile(ctx context.Context, request SendFileRequest) (*SendFileResponse, error)
- func (ch *Channel) SendImage(ctx context.Context, request SendFileRequest) (*SendFileResponse, error)
- func (ch *Channel) SendMessage(ctx context.Context, message *Message, userID string, ...) (*MessageResponse, error)
- func (ch *Channel) SendReaction(ctx context.Context, reaction *Reaction, messageID, userID string) (*ReactionResponse, error)
- func (ch *Channel) ShadowBan(ctx context.Context, targetID, bannedByID string, options ...BanOption) (*Response, error)
- func (ch *Channel) Show(ctx context.Context, userID string) (*Response, error)
- func (ch *Channel) Truncate(ctx context.Context, options ...TruncateOption) (*Response, error)
- func (ch *Channel) UnBanUser(ctx context.Context, targetID string) (*Response, error)
- func (ch *Channel) UnmarshalJSON(data []byte) error
- func (ch *Channel) Unmute(ctx context.Context, userID string) (*Response, error)
- func (ch *Channel) Update(ctx context.Context, properties map[string]interface{}, message *Message) (*Response, error)
- type ChannelConfig
- type ChannelMember
- type ChannelMute
- type ChannelMuteResponse
- type ChannelRead
- type ChannelRequest
- type ChannelType
- type ChannelTypePermission
- type ChannelTypeResponse
- type ChannelTypesResponse
- type CheckPushRequest
- type CheckPushResponse
- type CheckSQSRequest
- type CheckSQSResponse
- type Client
- func (c *Client) AddDevice(ctx context.Context, device *Device) (*Response, error)
- func (c *Client) BanUser(ctx context.Context, targetID, bannedBy string, options ...BanOption) (*Response, error)
- func (c *Client) Channel(channelType, channelID string) *Channel
- func (c *Client) CheckPush(ctx context.Context, req *CheckPushRequest) (*CheckPushResponse, error)
- func (c *Client) CheckSqs(ctx context.Context, req *CheckSQSRequest) (*CheckSQSResponse, error)
- func (c *Client) CreateBlocklist(ctx context.Context, blocklist *BlocklistCreateRequest) (*Response, error)
- func (c *Client) CreateChannel(ctx context.Context, chanType, chanID, userID string, data *ChannelRequest) (*CreateChannelResponse, error)
- func (c *Client) CreateChannelType(ctx context.Context, chType *ChannelType) (*ChannelTypeResponse, error)
- func (c *Client) CreateChannelWithMembers(ctx context.Context, chanType, chanID, userID string, memberIDs ...string) (*CreateChannelResponse, error)
- func (c *Client) CreateCommand(ctx context.Context, cmd *Command) (*CommandResponse, error)
- func (c *Client) CreateGuestUser(ctx context.Context, user *User) (*GuestUserResponse, error)
- func (c *Client) CreateImport(ctx context.Context, filePath string, mode ImportMode) (*CreateImportResponse, error)
- func (c *Client) CreateImportURL(ctx context.Context, filename string) (*CreateImportURLResponse, error)
- func (c *Client) CreateToken(userID string, expire time.Time, issuedAt ...time.Time) (string, error)
- func (c *Client) DeactivateUser(ctx context.Context, targetID string, options ...DeactivateUserOptions) (*Response, error)
- func (c *Client) DeactivateUsers(ctx context.Context, targetIDs []string, options ...DeactivateUserOptions) (*Response, error)
- func (c *Client) DeleteBlocklist(ctx context.Context, name string) (*Response, error)
- func (c *Client) DeleteChannelType(ctx context.Context, name string) (*Response, error)
- func (c *Client) DeleteChannels(ctx context.Context, cids []string, hardDelete bool) (*AsyncTaskResponse, error)
- func (c *Client) DeleteCommand(ctx context.Context, cmdName string) (*Response, error)
- func (c *Client) DeleteDevice(ctx context.Context, userID, deviceID string) (*Response, error)
- func (c *Client) DeleteMessage(ctx context.Context, msgID string) (*Response, error)
- func (c *Client) DeletePushProvider(ctx context.Context, providerType, name string) (*Response, error)
- func (c *Client) DeleteReaction(ctx context.Context, messageID, reactionType, userID string) (*ReactionResponse, error)
- func (c *Client) DeleteUser(ctx context.Context, targetID string, options ...DeleteUserOption) (*Response, error)
- func (c *Client) DeleteUsers(ctx context.Context, userIDs []string, options DeleteUserOptions) (*AsyncTaskResponse, error)
- func (c *Client) ExportChannels(ctx context.Context, channels []*ExportableChannel, ...) (*AsyncTaskResponse, error)
- func (c *Client) ExportUser(ctx context.Context, targetID string) (*ExportUserResponse, error)
- func (c *Client) FlagMessage(ctx context.Context, msgID, userID string) (*Response, error)
- func (c *Client) FlagUser(ctx context.Context, targetID, flaggedBy string) (*Response, error)
- func (c *Client) GetAppSettings(ctx context.Context) (*AppResponse, error)
- func (c *Client) GetBlocklist(ctx context.Context, name string) (*GetBlocklistResponse, error)
- func (c *Client) GetChannelType(ctx context.Context, chanType string) (*GetChannelTypeResponse, error)
- func (c *Client) GetCommand(ctx context.Context, cmdName string) (*GetCommandResponse, error)
- func (c *Client) GetDevices(ctx context.Context, userID string) (*DevicesResponse, error)
- func (c *Client) GetExportChannelsTask(ctx context.Context, taskID string) (*TaskResponse, error)
- func (c *Client) GetImport(ctx context.Context, id string) (*GetImportResponse, error)
- func (c *Client) GetMessage(ctx context.Context, msgID string) (*MessageResponse, error)
- func (c *Client) GetRateLimits(ctx context.Context, options ...GetRateLimitsOption) (GetRateLimitsResponse, error)
- func (c *Client) GetReactions(ctx context.Context, messageID string, options map[string][]string) (*ReactionsResponse, error)
- func (c *Client) GetTask(ctx context.Context, id string) (*TaskResponse, error)
- func (c *Client) HardDeleteMessage(ctx context.Context, msgID string) (*Response, error)
- func (c *Client) ListBlocklists(ctx context.Context) (*ListBlocklistsResponse, error)
- func (c *Client) ListChannelTypes(ctx context.Context) (*ChannelTypesResponse, error)
- func (c *Client) ListCommands(ctx context.Context) (*CommandsResponse, error)
- func (c *Client) ListImports(ctx context.Context, opts *ListImportsOptions) (*ListImportsResponse, error)
- func (c *Client) ListPushProviders(ctx context.Context) (*PushProviderListResponse, error)
- func (c *Client) MarkAllRead(ctx context.Context, userID string) (*Response, error)
- func (c *Client) MuteUser(ctx context.Context, targetID, mutedBy string, options ...MuteOption) (*Response, error)
- func (c *Client) MuteUsers(ctx context.Context, targetIDs []string, mutedBy string, options ...MuteOption) (*Response, error)
- func (c *Client) PartialUpdateMessage(ctx context.Context, messageID string, updates *MessagePartialUpdateRequest) (*MessageResponse, error)
- func (c *Client) PartialUpdateUser(ctx context.Context, update PartialUserUpdate) (*User, error)
- func (c *Client) PartialUpdateUsers(ctx context.Context, updates []PartialUserUpdate) (*UsersResponse, error)
- func (c *Client) Permissions() *PermissionClient
- func (c *Client) PinMessage(ctx context.Context, msgID, pinnedByID string, expiration *time.Time) (*MessageResponse, error)
- func (c *Client) QueryBannedUsers(ctx context.Context, q *QueryBannedUsersOptions, sorters ...*SortOption) (*QueryBannedUsersResponse, error)
- func (c *Client) QueryChannels(ctx context.Context, q *QueryOption, sort ...*SortOption) (*QueryChannelsResponse, error)
- func (c *Client) QueryFlagReports(ctx context.Context, q *QueryFlagReportsRequest) (*QueryFlagReportsResponse, error)
- func (c *Client) QueryMessageFlags(ctx context.Context, q *QueryOption) (*QueryMessageFlagsResponse, error)
- func (c *Client) QueryUsers(ctx context.Context, q *QueryOption, sorters ...*SortOption) (*QueryUsersResponse, error)
- func (c *Client) ReactivateUser(ctx context.Context, targetID string, options ...ReactivateUserOptions) (*Response, error)
- func (c *Client) ReactivateUsers(ctx context.Context, targetIDs []string, options ...ReactivateUserOptions) (*Response, error)
- func (c *Client) ReviewFlagReport(ctx context.Context, reportID string, req *ReviewFlagReportRequest) (*ReviewFlagReportResponse, error)
- func (c *Client) RevokeTokens(ctx context.Context, before *time.Time) (*Response, error)
- func (c *Client) RevokeUserToken(ctx context.Context, userID string, before *time.Time) (*Response, error)
- func (c *Client) RevokeUsersTokens(ctx context.Context, userIDs []string, before *time.Time) (*Response, error)
- func (c *Client) Search(ctx context.Context, request SearchRequest) (*SearchResponse, error)
- func (c *Client) SearchWithFullResponse(ctx context.Context, request SearchRequest) (*SearchFullResponse, error)
- func (c *Client) SendReaction(ctx context.Context, reaction *Reaction, messageID, userID string) (*ReactionResponse, error)
- func (c *Client) SendUserCustomEvent(ctx context.Context, targetUserID string, event *UserCustomEvent) (*Response, error)
- func (c *Client) SetClient(client *http.Client)
- func (c *Client) ShadowBan(ctx context.Context, targetID, bannedByID string, options ...BanOption) (*Response, error)
- func (c *Client) TranslateMessage(ctx context.Context, msgID, language string) (*TranslationResponse, error)
- func (c *Client) UnBanUser(ctx context.Context, targetID string) (*Response, error)
- func (c *Client) UnPinMessage(ctx context.Context, msgID, userID string) (*MessageResponse, error)
- func (c *Client) UnmuteUser(ctx context.Context, targetID, unmutedBy string) (*Response, error)
- func (c *Client) UnmuteUsers(ctx context.Context, targetIDs []string, unmutedBy string) (*Response, error)
- func (c *Client) UpdateAppSettings(ctx context.Context, settings *AppSettings) (*Response, error)
- func (c *Client) UpdateBlocklist(ctx context.Context, name string, words []string) (*Response, error)
- func (c *Client) UpdateChannelType(ctx context.Context, name string, options map[string]interface{}) (*Response, error)
- func (c *Client) UpdateCommand(ctx context.Context, cmdName string, update *Command) (*CommandResponse, error)
- func (c *Client) UpdateMessage(ctx context.Context, msg *Message, msgID string) (*MessageResponse, error)
- func (c *Client) UpsertPushProvider(ctx context.Context, provider *PushProvider) (*Response, error)
- func (c *Client) UpsertUser(ctx context.Context, user *User) (*UpsertUserResponse, error)
- func (c *Client) UpsertUsers(ctx context.Context, users ...*User) (*UsersResponse, error)
- func (c *Client) VerifyWebhook(body, signature []byte) (valid bool)
- type ClientOption
- type Command
- type CommandResponse
- type CommandsResponse
- type CreateChannelResponse
- type CreateImportResponse
- type CreateImportURLResponse
- type DeactivateUserOptions
- type DeleteType
- type DeleteUserOption
- type DeleteUserOptions
- type Device
- type DeviceError
- type DevicesResponse
- type Error
- type Event
- type EventType
- type ExportChannelOptions
- type ExportUserResponse
- type ExportableChannel
- type ExtendedFlagReport
- type FileUploadConfig
- type FirebaseConfig
- type FirebaseConfigRequest
- type FlagReport
- type GetBlocklistResponse
- type GetChannelTypeResponse
- type GetCommandResponse
- type GetImportResponse
- type GetMessagesResponse
- type GetPermissionResponse
- type GetRateLimitsOption
- type GetRateLimitsResponse
- type GuestUserResponse
- type HuaweiConfig
- type HuaweiConfigRequest
- type ImportMode
- type ImportTask
- type ImportTaskHistory
- type LabelThresholds
- type ListBlocklistsResponse
- type ListImportsOptions
- type ListImportsResponse
- type ListPermissionsResponse
- type MarkReadOption
- type Message
- type MessageFlag
- type MessagePaginationParamsRequest
- type MessagePartialUpdateRequest
- type MessageResponse
- type MessageType
- type Mute
- type MuteOption
- type PaginationParamsRequest
- type PartialUpdate
- type PartialUserUpdate
- type Permission
- type PermissionClient
- func (p *PermissionClient) CreatePermission(ctx context.Context, perm *Permission) (*Response, error)
- func (p *PermissionClient) CreateRole(ctx context.Context, name string) (*Response, error)
- func (p *PermissionClient) DeletePermission(ctx context.Context, id string) (*Response, error)
- func (p *PermissionClient) DeleteRole(ctx context.Context, name string) (*Response, error)
- func (p *PermissionClient) GetPermission(ctx context.Context, id string) (*GetPermissionResponse, error)
- func (p *PermissionClient) ListPermissions(ctx context.Context) (*ListPermissionsResponse, error)
- func (p *PermissionClient) ListRoles(ctx context.Context) (*RolesResponse, error)
- func (p *PermissionClient) UpdatePermission(ctx context.Context, id string, perm *Permission) (*Response, error)
- type Policy
- type PushConfigRequest
- type PushNotificationFields
- type PushProvider
- type PushProviderListResponse
- type PushProviderType
- type QueryBannedUsersOptions
- type QueryBannedUsersResponse
- type QueryChannelsResponse
- type QueryFlagReportsRequest
- type QueryFlagReportsResponse
- type QueryMembersResponse
- type QueryMessageFlagsResponse
- type QueryOption
- type QueryRequest
- type QueryResponse
- type QueryUsersResponse
- type RateLimitInfo
- type RateLimitsMap
- type Reaction
- type ReactionResponse
- type ReactionsResponse
- type ReactivateUserOptions
- type RepliesResponse
- type Response
- type ReviewFlagReportRequest
- type ReviewFlagReportResponse
- type Role
- type RoleAssignment
- type RolesResponse
- type SearchFullResponse
- type SearchMessageResponse
- type SearchRequest
- type SearchResponse
- type SendFileRequest
- type SendFileResponse
- type SendMessageOption
- type SortOption
- type TaskResponse
- type TaskStatus
- type Thresholds
- type TranslationResponse
- type TruncateOption
- type TruncateResponse
- type UpsertUserResponse
- type User
- type UserCustomEvent
- type UsersResponse
- type XiaomiConfig
- type XiaomiConfigRequest
Examples ΒΆ
- Channel.AddModerators
- Channel.Query
- Channel.Update
- Client.AddDevice
- Client.BanUser
- Client.CreateChannelType
- Client.CreateCommand
- Client.DeactivateUser
- Client.DeleteChannelType
- Client.DeleteCommand
- Client.DeleteDevice
- Client.DeleteUser
- Client.DeleteUser (Hard)
- Client.ExportUser
- Client.GetChannelType
- Client.GetCommand
- Client.ListChannelTypes
- Client.ListCommands
- Client.ReactivateUser
- Client.SendReaction
- Client.UpdateAppSettings (Disable_auth)
- Client.UpdateAppSettings (Disable_permission)
- Client.UpdateChannelType
- Client.UpdateChannelType (Bool)
- Client.UpdateChannelType (Other)
- Client.UpdateChannelType (Permissions)
- Client.UpdateCommand
- Client.UpsertUser
Constants ΒΆ
const ( AutoModDisabled modType = "disabled" AutoModSimple modType = "simple" AutoModAI modType = "AI" ModBehaviourFlag modBehaviour = "flag" ModBehaviourBlock modBehaviour = "block" MessageRetentionForever = "infinite" )
const ( PushProviderAPNS = PushProviderType("apn") PushProviderFirebase = PushProviderType("firebase") PushProviderXiaomi = PushProviderType("xiaomi") PushProviderHuawei = PushProviderType("huawei") )
const ( HeaderRateLimit = "X-Ratelimit-Limit" HeaderRateRemaining = "X-Ratelimit-Remaining" HeaderRateReset = "X-Ratelimit-Reset" )
const ( // DefaultBaseURL is the default base URL for the stream chat api. // It works like CDN style and connects you to the closest production server. // By default, there is no real reason to change it. Use it only if you know what you are doing. DefaultBaseURL = "https://chat.stream-io-api.com" )
Variables ΒΆ
var DefaultChannelConfig = ChannelConfig{ Automod: AutoModDisabled, ModBehavior: ModBehaviourFlag, MaxMessageLength: defaultMessageLength, MessageRetention: MessageRetentionForever, PushNotifications: true, }
DefaultChannelConfig is the default channel configuration.
Functions ΒΆ
func AddMembersWithHideHistory ΒΆ
func AddMembersWithHideHistory() func(*addMembersOptions)
func AddMembersWithMessage ΒΆ
func AddMembersWithMessage(message *Message) func(*addMembersOptions)
func AddMembersWithRolesAssignment ΒΆ
func AddMembersWithRolesAssignment(assignements []*RoleAssignment) func(*addMembersOptions)
func BanWithExpiration ΒΆ
func BanWithExpiration(expiration int) func(*banOptions)
BanWithExpiration set when the ban will expire. Should be in minutes. eg. to ban during one hour: BanWithExpiration(60).
func BanWithReason ΒΆ
func BanWithReason(reason string) func(*banOptions)
func DeactivateUserWithCreatedBy ΒΆ
func DeactivateUserWithCreatedBy(userID string) func(*deactivateUserOptions)
func DeactivateUserWithMarkChannelsDeleted ΒΆ
func DeactivateUserWithMarkChannelsDeleted() func(*deactivateUserOptions)
func DeactivateUserWithMarkMessagesDeleted ΒΆ
func DeactivateUserWithMarkMessagesDeleted() func(*deactivateUserOptions)
func DeleteUserWithDeleteConversations ΒΆ
func DeleteUserWithDeleteConversations() func(*deleteUserOptions)
func DeleteUserWithHardDelete ΒΆ
func DeleteUserWithHardDelete() func(*deleteUserOptions)
func DeleteUserWithMarkMessagesDeleted ΒΆ
func DeleteUserWithMarkMessagesDeleted() func(*deleteUserOptions)
func MarkReadUntilMessage ΒΆ
func MarkReadUntilMessage(id string) func(*markReadOption)
func MessagePending ΒΆ
func MessagePending(r *messageRequest)
MessagePending is a flag that makes this a pending message
func MessageSkipEnrichURL ΒΆ
func MessageSkipEnrichURL(r *messageRequest)
MessageSkipEnrichURL is a flag that disables enrichment of the URLs in the message
func MessageSkipPush ΒΆ
func MessageSkipPush(r *messageRequest)
MessageSkipPush is a flag that be given to SendMessage if you don't want to generate any push notifications.
func MuteWithExpiration ΒΆ
func MuteWithExpiration(expiration int) func(*muteOptions)
func ReactivateUserWithCreatedBy ΒΆ
func ReactivateUserWithCreatedBy(userID string) func(*reactivateUserOptions)
func ReactivateUserWithName ΒΆ
func ReactivateUserWithName(name string) func(*reactivateUserOptions)
func ReactivateUserWithRestoreChannels ΒΆ
func ReactivateUserWithRestoreChannels() func(*reactivateUserOptions)
func ReactivateUserWithRestoreMessages ΒΆ
func ReactivateUserWithRestoreMessages() func(*reactivateUserOptions)
func TruncateWithHardDelete ΒΆ
func TruncateWithHardDelete() func(*truncateOptions)
func TruncateWithMessage ΒΆ
func TruncateWithMessage(message *Message) func(*truncateOptions)
func TruncateWithSkipPush ΒΆ
func TruncateWithSkipPush() func(*truncateOptions)
func TruncateWithUser ΒΆ
func TruncateWithUser(user *User) func(*truncateOptions)
func TruncateWithUserID ΒΆ
func TruncateWithUserID(userID string) func(*truncateOptions)
func WithTimeout ΒΆ
Types ΒΆ
type APNConfig ΒΆ
type APNConfig struct { Enabled bool `json:"enabled"` Development bool `json:"development"` AuthType string `json:"auth_type,omitempty"` AuthKey string `json:"auth_key,omitempty"` NotificationTemplate string `json:"notification_template"` Host string `json:"host,omitempty"` BundleID string `json:"bundle_id,omitempty"` TeamID string `json:"team_id,omitempty"` KeyID string `json:"key_id,omitempty"` }
type AddMembersOptions ΒΆ
type AddMembersOptions func(*addMembersOptions)
type AppResponse ΒΆ
type AppResponse struct { App *AppSettings `json:"app"` Response }
type AppSettings ΒΆ
type AppSettings struct { Name string `json:"name"` OrganizationName string `json:"organization"` Suspended bool `json:"suspended"` SuspendedExplanation string `json:"suspended_explanation"` ConfigNameMap map[string]*ChannelConfig `json:"channel_configs"` RevokeTokensIssuedBefore *time.Time `json:"revoke_tokens_issued_before"` DisableAuth *bool `json:"disable_auth_checks,omitempty"` DisablePermissions *bool `json:"disable_permissions_checks,omitempty"` PushNotifications PushNotificationFields `json:"push_notifications"` PushConfig *PushConfigRequest `json:"push_config,omitempty"` APNConfig *APNConfig `json:"apn_config,omitempty"` FirebaseConfig *FirebaseConfigRequest `json:"firebase_config,omitempty"` XiaomiConfig *XiaomiConfigRequest `json:"xiaomi_config,omitempty"` HuaweiConfig *HuaweiConfigRequest `json:"huawei_config,omitempty"` WebhookURL *string `json:"webhook_url,omitempty"` WebhookEvents []string `json:"webhook_events,omitempty"` SqsURL *string `json:"sqs_url,omitempty"` SqsKey *string `json:"sqs_key,omitempty"` SqsSecret *string `json:"sqs_secret,omitempty"` BeforeMessageSendHookURL *string `json:"before_message_send_hook_url,omitempty"` CustomActionHandlerURL *string `json:"custom_action_handler_url,omitempty"` FileUploadConfig *FileUploadConfig `json:"file_upload_config,omitempty"` ImageUploadConfig *FileUploadConfig `json:"image_upload_config,omitempty"` ImageModerationLabels []string `json:"image_moderation_labels,omitempty"` ImageModerationEnabled *bool `json:"image_moderation_enabled,omitempty"` PermissionVersion *string `json:"permission_version,omitempty"` MigratePermissionsToV2 *bool `json:"migrate_permissions_to_v2,omitempty"` Policies map[string][]Policy `json:"policies"` Grants map[string][]string `json:"grants,omitempty"` MultiTenantEnabled *bool `json:"multi_tenant_enabled,omitempty"` AsyncURLEnrichEnabled *bool `json:"async_url_enrich_enabled,omitempty"` AutoTranslationEnabled *bool `json:"auto_translation_enabled,omitempty"` RemindersInterval int `json:"reminders_interval,omitempty"` UserSearchDisallowedRoles []string `json:"user_search_disallowed_roles,omitempty"` EnforceUniqueUsernames *string `json:"enforce_unique_usernames,omitempty"` ChannelHideMembersOnly *bool `json:"channel_hide_members_only,omitempty"` }
func NewAppSettings ΒΆ
func NewAppSettings() *AppSettings
func (*AppSettings) SetAPNConfig ΒΆ
func (a *AppSettings) SetAPNConfig(c APNConfig) *AppSettings
func (*AppSettings) SetDisableAuth ΒΆ
func (a *AppSettings) SetDisableAuth(b bool) *AppSettings
func (*AppSettings) SetDisablePermissions ΒΆ
func (a *AppSettings) SetDisablePermissions(b bool) *AppSettings
func (*AppSettings) SetFirebaseConfig ΒΆ
func (a *AppSettings) SetFirebaseConfig(c FirebaseConfigRequest) *AppSettings
func (*AppSettings) SetGrants ΒΆ
func (a *AppSettings) SetGrants(g map[string][]string) *AppSettings
func (*AppSettings) SetMultiTenant ΒΆ
func (a *AppSettings) SetMultiTenant(b bool) *AppSettings
func (*AppSettings) SetWebhookURL ΒΆ
func (a *AppSettings) SetWebhookURL(s string) *AppSettings
type AsyncTaskResponse ΒΆ
type Attachment ΒΆ
type Attachment struct { Type string `json:"type,omitempty"` // text, image, audio, video AuthorName string `json:"author_name,omitempty"` Title string `json:"title,omitempty"` TitleLink string `json:"title_link,omitempty"` Text string `json:"text,omitempty"` ImageURL string `json:"image_url,omitempty"` ThumbURL string `json:"thumb_url,omitempty"` AssetURL string `json:"asset_url,omitempty"` OGScrapeURL string `json:"og_scrape_url,omitempty"` ExtraData map[string]interface{} `json:"-"` }
func (Attachment) MarshalJSON ΒΆ
func (a Attachment) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*Attachment) UnmarshalJSON ΒΆ
func (a *Attachment) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Blocklist ΒΆ
type Blocklist struct { CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` BlocklistBase }
type BlocklistBase ΒΆ
type BlocklistCreateRequest ΒΆ
type BlocklistCreateRequest struct {
BlocklistBase
}
type Channel ΒΆ
type Channel struct { ID string `json:"id"` Type string `json:"type"` CID string `json:"cid"` // full id in format channel_type:channel_ID Team string `json:"team"` Config ChannelConfig `json:"config"` CreatedBy *User `json:"created_by"` Disabled bool `json:"disabled"` Frozen bool `json:"frozen"` MemberCount int `json:"member_count"` Members []*ChannelMember `json:"members"` Messages []*Message `json:"messages"` PinnedMessages []*Message `json:"pinned_messages"` Read []*ChannelRead `json:"read"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` LastMessageAt time.Time `json:"last_message_at"` TruncatedBy *User `json:"truncated_by"` TruncatedAt *time.Time `json:"truncated_at"` ExtraData map[string]interface{} `json:"-"` // contains filtered or unexported fields }
func (*Channel) AcceptInvite ΒΆ
func (ch *Channel) AcceptInvite(ctx context.Context, userID string, message *Message) (*Response, error)
AcceptInvite accepts an invite to the channel.
func (*Channel) AddMembers ΒΆ
func (ch *Channel) AddMembers(ctx context.Context, userIDs []string, options ...AddMembersOptions) (*Response, error)
AddMembers adds members with given user IDs to the channel.
func (*Channel) AddModerators ΒΆ
AddModerators adds moderators with given IDs to the channel.
Example ΒΆ
See https://getstream.io/chat/docs/channel_members/ for more details.
channel := &Channel{} newModerators := []string{"bob", "sue"} ctx := context.Background() _, _ = channel.AddModerators(ctx, "thierry", "josh") _, _ = channel.AddModerators(ctx, newModerators...) _, _ = channel.DemoteModerators(ctx, newModerators...)
Output:
func (*Channel) AddModeratorsWithMessage ΒΆ
func (ch *Channel) AddModeratorsWithMessage(ctx context.Context, userIDs []string, msg *Message) (*Response, error)
AddModerators adds moderators with given IDs to the channel and produce system message.
func (*Channel) AssignRole ΒΆ
func (ch *Channel) AssignRole(ctx context.Context, assignments []*RoleAssignment, msg *Message) (*Response, error)
AssignRoles assigns roles to members with given IDs.
func (*Channel) BanUser ΒΆ
func (ch *Channel) BanUser(ctx context.Context, targetID, bannedBy string, options ...BanOption) (*Response, error)
BanUser bans targetID on the channel ch.
func (*Channel) DeleteFile ΒΆ
DeleteFile removes uploaded file.
func (*Channel) DeleteImage ΒΆ
DeleteImage removes uploaded image.
func (*Channel) DeleteReaction ΒΆ
func (ch *Channel) DeleteReaction(ctx context.Context, messageID, reactionType, userID string) (*ReactionResponse, error)
DeleteReaction removes a reaction from message with given ID. Deprecated: DeleteReaction is deprecated, use client.DeleteReaction instead.
func (*Channel) DemoteModerators ΒΆ
DemoteModerators moderators with given IDs from the channel.
func (*Channel) DemoteModeratorsWithMessage ΒΆ
func (ch *Channel) DemoteModeratorsWithMessage(ctx context.Context, userIDs []string, msg *Message) (*Response, error)
DemoteModerators moderators with given IDs from the channel and produce system message.
func (*Channel) GetMessages ΒΆ
func (ch *Channel) GetMessages(ctx context.Context, messageIds []string) (*GetMessagesResponse, error)
GetMessages returns messages for multiple message ids.
func (*Channel) GetReplies ΒΆ
func (ch *Channel) GetReplies(ctx context.Context, parentID string, options map[string][]string) (*RepliesResponse, error)
GetReplies returns list of the message replies for a parent message. options: Pagination params, ie {limit:10, idlte: 10}
func (*Channel) HideWithHistoryClear ΒΆ
HideWithHistoryClear clear marks channel as hidden and remove all messages for user.
func (*Channel) InviteMembers ΒΆ
InviteMembers invites users with given IDs to the channel.
func (*Channel) InviteMembersWithMessage ΒΆ
func (ch *Channel) InviteMembersWithMessage(ctx context.Context, userIDs []string, msg *Message) (*Response, error)
InviteMembers invites users with given IDs to the channel and produce system message.
func (*Channel) MarkRead ΒΆ
func (ch *Channel) MarkRead(ctx context.Context, userID string, options ...MarkReadOption) (*Response, error)
MarkRead sends the mark read event for user with given ID, only works if the `read_events` setting is enabled.
func (Channel) MarshalJSON ΒΆ
MarshalJSON implements json.Marshaler.
func (*Channel) Mute ΒΆ
func (ch *Channel) Mute(ctx context.Context, userID string, expiration *time.Duration) (*ChannelMuteResponse, error)
Mute mutes the channel. The user will stop receiving messages from the channel.
func (*Channel) PartialUpdate ΒΆ
PartialUpdate set and unset specific fields when it is necessary to retain additional custom data fields on the object. AKA a patch style update.
func (*Channel) Query ΒΆ
func (ch *Channel) Query(ctx context.Context, q *QueryRequest) (*QueryResponse, error)
Query makes request to channel api and updates channel internal state.
Example ΒΆ
ctx := context.Background() channel := &Channel{} msg, _ := channel.SendMessage(ctx, &Message{Text: "test message", Pinned: true}, channel.CreatedBy.ID) q := &QueryRequest{ Messages: &MessagePaginationParamsRequest{PaginationParamsRequest: PaginationParamsRequest{Limit: 1, IDLT: msg.Message.ID}}, Members: &PaginationParamsRequest{Limit: 1, Offset: 0}, Watchers: &PaginationParamsRequest{Limit: 1, Offset: 0}, } _, _ = channel.Query(ctx, q)
Output:
func (*Channel) QueryMembers ΒΆ
func (ch *Channel) QueryMembers(ctx context.Context, q *QueryOption, sorters ...*SortOption) (*QueryMembersResponse, error)
QueryMembers queries members of a channel.
func (*Channel) RefreshState ΒΆ
func (ch *Channel) RefreshState(ctx context.Context) (*QueryResponse, error)
RefreshState makes request to channel api and updates channel internal state.
func (*Channel) RejectInvite ΒΆ
func (ch *Channel) RejectInvite(ctx context.Context, userID string, message *Message) (*Response, error)
RejectInvite rejects an invite to the channel.
func (*Channel) RemoveMembers ΒΆ
func (ch *Channel) RemoveMembers(ctx context.Context, userIDs []string, message *Message) (*Response, error)
RemoveMembers deletes members with given IDs from the channel.
func (*Channel) SendAction ΒΆ
func (ch *Channel) SendAction(ctx context.Context, msgID string, formData map[string]string) (*MessageResponse, error)
SendAction for a message.
func (*Channel) SendFile ΒΆ
func (ch *Channel) SendFile(ctx context.Context, request SendFileRequest) (*SendFileResponse, error)
SendFile sends file to the channel. Returns file url or error.
func (*Channel) SendImage ΒΆ
func (ch *Channel) SendImage(ctx context.Context, request SendFileRequest) (*SendFileResponse, error)
SendFile sends image to the channel. Returns file url or error.
func (*Channel) SendMessage ΒΆ
func (ch *Channel) SendMessage(ctx context.Context, message *Message, userID string, options ...SendMessageOption) (*MessageResponse, error)
SendMessage sends a message to the channel. Returns full message details from server.
func (*Channel) SendReaction ΒΆ
func (ch *Channel) SendReaction(ctx context.Context, reaction *Reaction, messageID, userID string) (*ReactionResponse, error)
SendReaction sends a reaction to message with given ID. Deprecated: SendReaction is deprecated, use client.SendReaction instead.
func (*Channel) ShadowBan ΒΆ
func (ch *Channel) ShadowBan(ctx context.Context, targetID, bannedByID string, options ...BanOption) (*Response, error)
ShadowBan shadow bans targetID on the channel ch.
func (*Channel) Truncate ΒΆ
Truncate removes all messages from the channel. You can pass in options such as hard_delete, skip_push or a custom message.
func (*Channel) UnmarshalJSON ΒΆ
UnmarshalJSON implements json.Unmarshaler.
func (*Channel) Unmute ΒΆ
Unmute removes a mute from a channel so the user will receive messages again.
func (*Channel) Update ΒΆ
func (ch *Channel) Update(ctx context.Context, properties map[string]interface{}, message *Message) (*Response, error)
Update edits the channel's custom properties.
properties: the object to update the custom properties of this channel with message: optional update message
Example ΒΆ
client := &Client{} ctx := context.Background() data := map[string]interface{}{ "image": "https://path/to/image", "created_by": "elon", "roles": map[string]string{"elon": "admin", "gwynne": "moderator"}, } spacexChannel := client.Channel("team", "spacex") if _, err := spacexChannel.Update(ctx, data, nil); err != nil { log.Fatalf("Error: %v", err) }
Output:
type ChannelConfig ΒΆ
type ChannelConfig struct { Name string `json:"name"` // features // show typing indicators or not (probably auto disable if more than X users in a channel) TypingEvents bool `json:"typing_events"` // store who has read the message, or at least when they last viewed the chat ReadEvents bool `json:"read_events"` // connect events can get very noisy for larger chat groups ConnectEvents bool `json:"connect_events"` // make messages searchable Search bool `json:"search"` Reactions bool `json:"reactions"` Reminders bool `json:"reminders"` Replies bool `json:"replies"` Mutes bool `json:"mutes"` // enable/disable push notifications PushNotifications bool `json:"push_notifications"` Uploads bool `json:"uploads"` URLEnrichment bool `json:"url_enrichment"` CustomEvents bool `json:"custom_events"` // number of days to keep messages, must be MessageRetentionForever or numeric string MessageRetention string `json:"message_retention"` MaxMessageLength int `json:"max_message_length"` Automod modType `json:"automod"` // disabled, simple or AI ModBehavior modBehaviour `json:"automod_behavior"` BlockList string `json:"blocklist"` BlockListBehavior modBehaviour `json:"blocklist_behavior"` AutomodThresholds *Thresholds `json:"automod_thresholds"` }
ChannelConfig is the configuration for a channel.
type ChannelMember ΒΆ
type ChannelMember struct { UserID string `json:"user_id,omitempty"` User *User `json:"user,omitempty"` IsModerator bool `json:"is_moderator,omitempty"` Invited bool `json:"invited,omitempty"` InviteAcceptedAt *time.Time `json:"invite_accepted_at,omitempty"` InviteRejectedAt *time.Time `json:"invite_rejected_at,omitempty"` Role string `json:"role,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
type ChannelMute ΒΆ
type ChannelMute struct { User User `json:"user"` Channel Channel `json:"channel"` Expires *time.Time `json:"expires"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
ChannelMute represents a channel mute.
type ChannelMuteResponse ΒΆ
type ChannelMuteResponse struct { ChannelMute ChannelMute `json:"channel_mute"` Response }
type ChannelRead ΒΆ
type ChannelRequest ΒΆ
type ChannelRequest struct { CreatedBy *User `json:"created_by,omitempty"` Team string `json:"team,omitempty"` AutoTranslationEnabled bool `json:"auto_translation_enabled,omitempty"` AutoTranslationLanguage string `json:"auto_translation_language,omitempty"` Frozen *bool `json:"frozen,omitempty"` Disabled *bool `json:"disabled,omitempty"` Members []string `json:"members,omitempty"` Invites []string `json:"invites,omitempty"` ExtraData map[string]interface{} `json:"-"` }
func (ChannelRequest) MarshalJSON ΒΆ
func (c ChannelRequest) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*ChannelRequest) UnmarshalJSON ΒΆ
func (c *ChannelRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ChannelType ΒΆ
type ChannelType struct { ChannelConfig Commands []*Command `json:"commands"` // Deprecated: Use Permissions V2 API instead, // that can be found in permission_client.go. // See https://getstream.io/chat/docs/go-golang/migrating_from_legacy/?language=go Permissions []*ChannelTypePermission `json:"permissions"` Grants map[string][]string `json:"grants"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func NewChannelType ΒΆ
func NewChannelType(name string) *ChannelType
NewChannelType returns initialized ChannelType with default values.
type ChannelTypePermission ΒΆ
type ChannelTypeResponse ΒΆ
type ChannelTypesResponse ΒΆ
type ChannelTypesResponse struct { ChannelTypes map[string]*ChannelType `json:"channel_types"` Response }
type CheckPushRequest ΒΆ
type CheckPushRequest struct { MessageID string `json:"message_id,omitempty"` ApnTemplate string `json:"apn_template,omitempty"` FirebaseTemplate string `json:"firebase_template,omitempty"` FirebaseDataTemplate string `json:"firebase_data_template,omitempty"` SkipDevices *bool `json:"skip_devices,omitempty"` PushProviderName string `json:"push_provider_name,omitempty"` PushProviderType string `json:"push_provider_type,omitempty"` UserID string `json:"user_id,omitempty"` User *User `json:"user,omitempty"` }
type CheckPushResponse ΒΆ
type CheckPushResponse struct { DeviceErrors map[string]DeviceError `json:"device_errors"` GeneralErrors []string `json:"general_errors"` SkipDevices *bool `json:"skip_devices"` RenderedApnTemplate string `json:"rendered_apn_template"` RenderedFirebaseTemplate string `json:"rendered_firebase_template"` RenderedMessage map[string]string `json:"rendered_message"` Response }
type CheckSQSRequest ΒΆ
type CheckSQSResponse ΒΆ
type Client ΒΆ
type Client struct { BaseURL string HTTP *http.Client `json:"-"` // contains filtered or unexported fields }
func NewClient ΒΆ
func NewClient(apiKey, apiSecret string, options ...ClientOption) (*Client, error)
NewClient creates new stream chat api client.
func NewClientFromEnvVars ΒΆ
NewClientFromEnvVars creates a new Client where the API key is retrieved from STREAM_KEY and the secret from STREAM_SECRET environmental variables.
func (*Client) AddDevice ΒΆ
AddDevice adds new device.
Example ΒΆ
client, _ := NewClient("XXXX", "XXXX") ctx := context.Background() _, _ = client.AddDevice(ctx, &Device{ ID: "2ffca4ad6599adc9b5202d15a5286d33c19547d472cd09de44219cda5ac30207", UserID: "elon", PushProvider: PushProviderAPNS, })
Output:
func (*Client) BanUser ΒΆ
func (c *Client) BanUser(ctx context.Context, targetID, bannedBy string, options ...BanOption) (*Response, error)
BanUser bans targetID.
Example ΒΆ
client, _ := NewClient("XXXX", "XXXX") ctx := context.Background() // ban a user for 60 minutes from all channel _, _ = client.BanUser(ctx, "eviluser", "modUser", BanWithExpiration(60), BanWithReason("Banned for one hour")) // ban a user from the livestream:fortnite channel channel := client.Channel("livestream", "fortnite") _, _ = channel.BanUser(ctx, "eviluser", "modUser", BanWithReason("Profanity is not allowed here")) // remove ban from channel channel = client.Channel("livestream", "fortnite") _, _ = channel.UnBanUser(ctx, "eviluser") // remove global ban _, _ = client.UnBanUser(ctx, "eviluser")
Output:
func (*Client) CheckPush ΒΆ
func (c *Client) CheckPush(ctx context.Context, req *CheckPushRequest) (*CheckPushResponse, error)
CheckPush initiates a push test.
func (*Client) CheckSqs ΒΆ
func (c *Client) CheckSqs(ctx context.Context, req *CheckSQSRequest) (*CheckSQSResponse, error)
CheckSqs checks whether the AWS credentials are valid for the SQS queue access.
func (*Client) CreateBlocklist ΒΆ
func (c *Client) CreateBlocklist(ctx context.Context, blocklist *BlocklistCreateRequest) (*Response, error)
CreateBlocklist creates a blocklist.
func (*Client) CreateChannel ΒΆ
func (c *Client) CreateChannel(ctx context.Context, chanType, chanID, userID string, data *ChannelRequest) (*CreateChannelResponse, error)
CreateChannel creates new channel of given type and id or returns already created one.
func (*Client) CreateChannelType ΒΆ
func (c *Client) CreateChannelType(ctx context.Context, chType *ChannelType) (*ChannelTypeResponse, error)
CreateChannelType adds new channel type.
Example ΒΆ
See https://getstream.io/chat/docs/channel_features/ for more details.
client := &Client{} ctx := context.Background() newChannelType := &ChannelType{ // Copy the default settings. ChannelConfig: DefaultChannelConfig, } newChannelType.Name = "public" newChannelType.Mutes = false newChannelType.Reactions = false newChannelType.Permissions = append(newChannelType.Permissions, &ChannelTypePermission{ Name: "Allow reads for all", Priority: 999, Resources: []string{"ReadChannel", "CreateMessage"}, Action: "Allow", }, &ChannelTypePermission{ Name: "Deny all", Priority: 1, Resources: []string{"*"}, Action: "Deny", }, ) _, _ = client.CreateChannelType(ctx, newChannelType)
Output:
func (*Client) CreateChannelWithMembers ΒΆ
func (c *Client) CreateChannelWithMembers(ctx context.Context, chanType, chanID, userID string, memberIDs ...string) (*CreateChannelResponse, error)
CreateChannelWithMembers creates new channel of given type and id or returns already created one.
func (*Client) CreateCommand ΒΆ
CreateCommand registers a new custom command.
Example ΒΆ
See https://getstream.io/chat/docs/custom_commands/ for more details.
client := &Client{} ctx := context.Background() newCommand := &Command{ Name: "my-command", Description: "my command", Args: "[@username]", Set: "custom_cmd_set", } _, _ = client.CreateCommand(ctx, newCommand)
Output:
func (*Client) CreateGuestUser ΒΆ
CreateGuestUser creates a new guest user.
func (*Client) CreateImport ΒΆ
func (c *Client) CreateImport(ctx context.Context, filePath string, mode ImportMode) (*CreateImportResponse, error)
CreateImport creates a new import task. Note: Do not use this. It is present for internal usage only. This function can, and will, break and/or be removed at any point in time.
func (*Client) CreateImportURL ΒΆ
func (c *Client) CreateImportURL(ctx context.Context, filename string) (*CreateImportURLResponse, error)
CreateImportURL creates a new import URL. Note: Do not use this. It is present for internal usage only. This function can, and will, break and/or be removed at any point in time.
func (*Client) CreateToken ΒΆ
func (c *Client) CreateToken(userID string, expire time.Time, issuedAt ...time.Time) (string, error)
CreateToken creates a new token for user with optional expire time. Zero time is assumed to be no expire.
func (*Client) DeactivateUser ΒΆ
func (c *Client) DeactivateUser(ctx context.Context, targetID string, options ...DeactivateUserOptions) (*Response, error)
DeactivateUser deactivates the user with the given target user ID.
Example ΒΆ
client, _ := NewClient("XXXX", "XXXX") ctx := context.Background() _, _ = client.DeactivateUser(ctx, "userID")
Output:
func (*Client) DeactivateUsers ΒΆ
func (c *Client) DeactivateUsers(ctx context.Context, targetIDs []string, options ...DeactivateUserOptions) (*Response, error)
DeactivateUsers deactivates the users with the given target user IDs.
func (*Client) DeleteBlocklist ΒΆ
DeleteBlocklist deletes a blocklist.
func (*Client) DeleteChannelType ΒΆ
DeleteChannelType deletes channel type.
Example ΒΆ
client := &Client{} ctx := context.Background() _, _ = client.DeleteChannelType(ctx, "public")
Output:
func (*Client) DeleteChannels ΒΆ
func (c *Client) DeleteChannels(ctx context.Context, cids []string, hardDelete bool) (*AsyncTaskResponse, error)
DeleteChannels deletes channels asynchronously. Channels and messages will be hard deleted if hardDelete is true. It returns an AsyncTaskResponse object which contains the task ID, the status of the task can be check with client.GetTask method.
func (*Client) DeleteCommand ΒΆ
DeleteCommand deletes a custom command referenced by cmdName.
Example ΒΆ
client := &Client{} ctx := context.Background() _, _ = client.DeleteCommand(ctx, "my-command")
Output:
func (*Client) DeleteDevice ΒΆ
DeleteDevice deletes a device from the user.
Example ΒΆ
client, _ := NewClient("XXXX", "XXXX") ctx := context.Background() deviceID := "2ffca4ad6599adc9b5202d15a5286d33c19547d472cd09de44219cda5ac30207" userID := "elon" _, _ = client.DeleteDevice(ctx, userID, deviceID)
Output:
func (*Client) DeleteMessage ΒΆ
DeleteMessage soft deletes the message with given msgID.
func (*Client) DeletePushProvider ΒΆ
func (c *Client) DeletePushProvider(ctx context.Context, providerType, name string) (*Response, error)
DeletePushProvider deletes a push provider.
func (*Client) DeleteReaction ΒΆ
func (c *Client) DeleteReaction(ctx context.Context, messageID, reactionType, userID string) (*ReactionResponse, error)
DeleteReaction removes a reaction from message with given ID.
func (*Client) DeleteUser ΒΆ
func (c *Client) DeleteUser(ctx context.Context, targetID string, options ...DeleteUserOption) (*Response, error)
DeleteUser deletes the user with the given target user ID.
Example ΒΆ
client, _ := NewClient("XXXX", "XXXX") ctx := context.Background() _, _ = client.DeleteUser(ctx, "userID")
Output:
Example (Hard) ΒΆ
client, _ := NewClient("XXXX", "XXXX") ctx := context.Background() _, _ = client.DeleteUser(ctx, "userID", DeleteUserWithHardDelete(), DeleteUserWithMarkMessagesDeleted(), )
Output:
func (*Client) DeleteUsers ΒΆ
func (c *Client) DeleteUsers(ctx context.Context, userIDs []string, options DeleteUserOptions) (*AsyncTaskResponse, error)
DeleteUsers deletes users asynchronously. User will be deleted either "hard" or "soft" Conversations (1to1 channels) will be deleted if either "hard" or "soft" Messages will be deleted if either "hard" or "soft" NewChannelOwnerID any channels owned by the hard-deleted user will be transferred to this user ID It returns an AsyncTaskResponse object which contains the task ID, the status of the task can be check with client.GetTask method.
func (*Client) ExportChannels ΒΆ
func (c *Client) ExportChannels(ctx context.Context, channels []*ExportableChannel, options *ExportChannelOptions) (*AsyncTaskResponse, error)
ExportChannels requests an asynchronous export of the provided channels. It returns an AsyncTaskResponse object which contains the task ID, the status of the task can be check with client.GetTask method.
func (*Client) ExportUser ΒΆ
ExportUser exports the user with the given target user ID.
Example ΒΆ
client, _ := NewClient("XXXX", "XXXX") ctx := context.Background() user, _ := client.ExportUser(ctx, "userID") log.Printf("%#v", user)
Output:
func (*Client) FlagMessage ΒΆ
FlagMessage flags the message with given msgID.
func (*Client) GetAppSettings ΒΆ
func (c *Client) GetAppSettings(ctx context.Context) (*AppResponse, error)
GetAppSettings returns app settings.
func (*Client) GetBlocklist ΒΆ
GetBlocklist gets a blocklist.
func (*Client) GetChannelType ΒΆ
func (c *Client) GetChannelType(ctx context.Context, chanType string) (*GetChannelTypeResponse, error)
GetChannelType returns information about channel type.
Example ΒΆ
client := &Client{} ctx := context.Background() _, _ = client.GetChannelType(ctx, "public")
Output:
func (*Client) GetCommand ΒΆ
GetCommand retrieves a custom command referenced by cmdName.
Example ΒΆ
client := &Client{} ctx := context.Background() _, _ = client.GetCommand(ctx, "my-command")
Output:
func (*Client) GetDevices ΒΆ
GetDevices retrieves the list of devices for user.
func (*Client) GetExportChannelsTask ΒΆ
GetExportChannelsTask returns current state of the export task.
func (*Client) GetImport ΒΆ
GetImport returns an import task. Note: Do not use this. It is present for internal usage only. This function can, and will, break and/or be removed at any point in time.
func (*Client) GetMessage ΒΆ
GetMessage returns message by ID.
func (*Client) GetRateLimits ΒΆ
func (c *Client) GetRateLimits(ctx context.Context, options ...GetRateLimitsOption) (GetRateLimitsResponse, error)
GetRateLimits returns the current rate limit quotas and usage. If no options are passed, all the limits for all platforms are returned.
func (*Client) GetReactions ΒΆ
func (c *Client) GetReactions(ctx context.Context, messageID string, options map[string][]string) (*ReactionsResponse, error)
GetReactions returns list of the reactions for message with given ID. options: Pagination params, ie {"limit":{"10"}, "idlte": {"10"}}
func (*Client) HardDeleteMessage ΒΆ
HardDeleteMessage deletes the message with given msgID. This is permanent.
func (*Client) ListBlocklists ΒΆ
func (c *Client) ListBlocklists(ctx context.Context) (*ListBlocklistsResponse, error)
ListBlocklists lists all blocklists.
func (*Client) ListChannelTypes ΒΆ
func (c *Client) ListChannelTypes(ctx context.Context) (*ChannelTypesResponse, error)
ListChannelTypes returns all channel types.
Example ΒΆ
client := &Client{} ctx := context.Background() _, _ = client.ListChannelTypes(ctx)
Output:
func (*Client) ListCommands ΒΆ
func (c *Client) ListCommands(ctx context.Context) (*CommandsResponse, error)
ListCommands returns a list of custom commands.
Example ΒΆ
client := &Client{} ctx := context.Background() _, _ = client.ListCommands(ctx)
Output:
func (*Client) ListImports ΒΆ
func (c *Client) ListImports(ctx context.Context, opts *ListImportsOptions) (*ListImportsResponse, error)
ListImports returns all import tasks. Note: Do not use this. It is present for internal usage only. This function can, and will, break and/or be removed at any point in time.
func (*Client) ListPushProviders ΒΆ
func (c *Client) ListPushProviders(ctx context.Context) (*PushProviderListResponse, error)
ListPushProviders returns the list of push providers.
func (*Client) MarkAllRead ΒΆ
MarkAllRead marks all messages as read for userID.
func (*Client) MuteUser ΒΆ
func (c *Client) MuteUser(ctx context.Context, targetID, mutedBy string, options ...MuteOption) (*Response, error)
MuteUser mutes targetID.
func (*Client) MuteUsers ΒΆ
func (c *Client) MuteUsers(ctx context.Context, targetIDs []string, mutedBy string, options ...MuteOption) (*Response, error)
MuteUsers mutes all users in targetIDs.
func (*Client) PartialUpdateMessage ΒΆ
func (c *Client) PartialUpdateMessage(ctx context.Context, messageID string, updates *MessagePartialUpdateRequest) (*MessageResponse, error)
PartialUpdateMessage partially updates message with given msgID.
func (*Client) PartialUpdateUser ΒΆ
PartialUpdateUser makes partial update for single user.
func (*Client) PartialUpdateUsers ΒΆ
func (c *Client) PartialUpdateUsers(ctx context.Context, updates []PartialUserUpdate) (*UsersResponse, error)
PartialUpdateUsers makes partial update for users.
func (*Client) Permissions ΒΆ
func (c *Client) Permissions() *PermissionClient
Permissions returns a client for handling app permissions.
func (*Client) PinMessage ΒΆ
func (c *Client) PinMessage(ctx context.Context, msgID, pinnedByID string, expiration *time.Time) (*MessageResponse, error)
PinMessage pins the message with given msgID.
func (*Client) QueryBannedUsers ΒΆ
func (c *Client) QueryBannedUsers(ctx context.Context, q *QueryBannedUsersOptions, sorters ...*SortOption) (*QueryBannedUsersResponse, error)
QueryBannedUsers filters and returns a list of banned users. Banned users can be retrieved in different ways: 1) Using the dedicated query bans endpoint 2) User Search: you can add the banned:true condition to your search. Please note that this will only return users that were banned at the app-level and not the ones that were banned only on channels.
func (*Client) QueryChannels ΒΆ
func (c *Client) QueryChannels(ctx context.Context, q *QueryOption, sort ...*SortOption) (*QueryChannelsResponse, error)
QueryChannels returns list of channels with members and messages, that match QueryOption. If any number of SortOption are set, result will be sorted by field and direction in oder of sort options.
func (*Client) QueryFlagReports ΒΆ
func (c *Client) QueryFlagReports(ctx context.Context, q *QueryFlagReportsRequest) (*QueryFlagReportsResponse, error)
QueryFlagReports returns list of flag reports that match the filter.
func (*Client) QueryMessageFlags ΒΆ
func (c *Client) QueryMessageFlags(ctx context.Context, q *QueryOption) (*QueryMessageFlagsResponse, error)
QueryMessageFlags returns list of message flags that match QueryOption.
func (*Client) QueryUsers ΒΆ
func (c *Client) QueryUsers(ctx context.Context, q *QueryOption, sorters ...*SortOption) (*QueryUsersResponse, error)
QueryUsers returns list of users that match QueryOption. If any number of SortOption are set, result will be sorted by field and direction in the order of sort options.
func (*Client) ReactivateUser ΒΆ
func (c *Client) ReactivateUser(ctx context.Context, targetID string, options ...ReactivateUserOptions) (*Response, error)
ReactivateUser reactivates a deactivated user with the given target user ID.
Example ΒΆ
client, _ := NewClient("XXXX", "XXXX") ctx := context.Background() _, _ = client.ReactivateUser(ctx, "userID")
Output:
func (*Client) ReactivateUsers ΒΆ
func (c *Client) ReactivateUsers(ctx context.Context, targetIDs []string, options ...ReactivateUserOptions) (*Response, error)
ReactivateUsers reactivates deactivated users with the given target user IDs.
func (*Client) ReviewFlagReport ΒΆ
func (c *Client) ReviewFlagReport(ctx context.Context, reportID string, req *ReviewFlagReportRequest) (*ReviewFlagReportResponse, error)
ReviewFlagReports sends a review of the flag report ID.
func (*Client) RevokeTokens ΒΆ
RevokeTokens revokes all tokens for an application issued before given time.
func (*Client) RevokeUserToken ΒΆ
func (c *Client) RevokeUserToken(ctx context.Context, userID string, before *time.Time) (*Response, error)
RevokeUserToken revoke token for a user issued before given time.
func (*Client) RevokeUsersTokens ΒΆ
func (c *Client) RevokeUsersTokens(ctx context.Context, userIDs []string, before *time.Time) (*Response, error)
RevokeUsersTokens revoke tokens for users issued before given time.
func (*Client) Search ΒΆ
func (c *Client) Search(ctx context.Context, request SearchRequest) (*SearchResponse, error)
Search returns messages matching for given keyword.
func (*Client) SearchWithFullResponse ΒΆ
func (c *Client) SearchWithFullResponse(ctx context.Context, request SearchRequest) (*SearchFullResponse, error)
SearchWithFullResponse performs a search and returns the full results.
func (*Client) SendReaction ΒΆ
func (c *Client) SendReaction(ctx context.Context, reaction *Reaction, messageID, userID string) (*ReactionResponse, error)
SendReaction sends a reaction to message with given ID.
Example ΒΆ
client := &Client{} msgID := "123" userID := "bob-1" ctx := context.Background() reaction := &Reaction{ Type: "love", ExtraData: map[string]interface{}{"my_custom_field": 123}, } _, err := client.SendReaction(ctx, reaction, msgID, userID) if err != nil { log.Fatalf("Found Error: %v", err) }
Output:
func (*Client) SendUserCustomEvent ΒΆ
func (c *Client) SendUserCustomEvent(ctx context.Context, targetUserID string, event *UserCustomEvent) (*Response, error)
SendUserCustomEvent sends a custom event to all connected clients for the target user id.
func (*Client) ShadowBan ΒΆ
func (c *Client) ShadowBan(ctx context.Context, targetID, bannedByID string, options ...BanOption) (*Response, error)
ShadowBan shadow bans targetID.
func (*Client) TranslateMessage ΒΆ
func (c *Client) TranslateMessage(ctx context.Context, msgID, language string) (*TranslationResponse, error)
TranslateMessage translates the message with given msgID to the given language.
func (*Client) UnPinMessage ΒΆ
UnPinMessage unpins the message with given msgID.
func (*Client) UnmuteUser ΒΆ
UnmuteUser unmute targetID.
func (*Client) UnmuteUsers ΒΆ
func (c *Client) UnmuteUsers(ctx context.Context, targetIDs []string, unmutedBy string) (*Response, error)
UnmuteUsers unmute all users in targetIDs.
func (*Client) UpdateAppSettings ΒΆ
UpdateAppSettings makes request to update app settings Example of usage:
settings := NewAppSettings().SetDisableAuth(true) err := client.UpdateAppSettings(settings)
Example (Disable_auth) ΒΆ
See https://getstream.io/chat/docs/app_settings_auth/ for more details.
client, err := NewClient("XXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") if err != nil { log.Fatalf("Err: %v", err) } ctx := context.Background() // disable auth checks, allows dev token usage settings := NewAppSettings().SetDisableAuth(true) _, err = client.UpdateAppSettings(ctx, settings) if err != nil { log.Fatalf("Err: %v", err) } // re-enable auth checks _, err = client.UpdateAppSettings(ctx, NewAppSettings().SetDisableAuth(false)) if err != nil { log.Fatalf("Err: %v", err) }
Output:
Example (Disable_permission) ΒΆ
client, err := NewClient("XXXX", "XXXX") if err != nil { log.Fatalf("Err: %v", err) } ctx := context.Background() // disable permission checkse settings := NewAppSettings().SetDisablePermissions(true) _, err = client.UpdateAppSettings(ctx, settings) if err != nil { log.Fatalf("Err: %v", err) } // re-enable permission checks _, err = client.UpdateAppSettings(ctx, NewAppSettings().SetDisablePermissions(false)) if err != nil { log.Fatalf("Err: %v", err) }
Output:
func (*Client) UpdateBlocklist ΒΆ
func (c *Client) UpdateBlocklist(ctx context.Context, name string, words []string) (*Response, error)
UpdateBlocklist updates a blocklist.
func (*Client) UpdateChannelType ΒΆ
func (c *Client) UpdateChannelType(ctx context.Context, name string, options map[string]interface{}) (*Response, error)
UpdateChannelType updates channel type.
Example ΒΆ
client := &Client{} ctx := context.Background() _, _ = client.UpdateChannelType(ctx, "public", map[string]interface{}{ "permissions": []map[string]interface{}{ { "name": "Allow reads for all", "priority": 999, "resources": []string{"ReadChannel", "CreateMessage"}, "role": "*", "action": "Allow", }, { "name": "Deny all", "priority": 1, "resources": []string{"*"}, "role": "*", "action": "Deny", }, }, "replies": false, "commands": []string{"all"}, })
Output:
Example (Bool) ΒΆ
client := &Client{} ctx := context.Background() _, _ = client.UpdateChannelType(ctx, "public", map[string]interface{}{ "typing_events": false, "read_events": true, "connect_events": true, "search": false, "reactions": true, "replies": false, "mutes": true, })
Output:
Example (Other) ΒΆ
client := &Client{} ctx := context.Background() _, _ = client.UpdateChannelType(ctx, "public", map[string]interface{}{ "automod": "disabled", "message_retention": "7", "max_message_length": 140, "commands": []interface{}{"ban", "unban"}, }, )
Output:
Example (Permissions) ΒΆ
client := &Client{} ctx := context.Background() _, _ = client.UpdateChannelType(ctx, "public", map[string]interface{}{ "permissions": []map[string]interface{}{ { "name": "Allow reads for all", "priority": 999, "resources": []string{"ReadChannel", "CreateMessage"}, "role": "*", "action": "Allow", }, { "name": "Deny all", "priority": 1, "resources": []string{"*"}, "action": "Deny", }, }, }, )
Output:
func (*Client) UpdateCommand ΒΆ
func (c *Client) UpdateCommand(ctx context.Context, cmdName string, update *Command) (*CommandResponse, error)
UpdateCommand updates a custom command referenced by cmdName.
Example ΒΆ
client := &Client{} ctx := context.Background() update := Command{Description: "updated description"} _, _ = client.UpdateCommand(ctx, "my-command", &update)
Output:
func (*Client) UpdateMessage ΒΆ
func (c *Client) UpdateMessage(ctx context.Context, msg *Message, msgID string) (*MessageResponse, error)
UpdateMessage updates message with given msgID.
func (*Client) UpsertPushProvider ΒΆ
UpsertPushProvider inserts or updates a push provider.
func (*Client) UpsertUser ΒΆ
UpsertUser is a single user version of UpsertUsers for convenience.
Example ΒΆ
client, _ := NewClient("XXXX", "XXXX") ctx := context.Background() _, err := client.UpsertUser(ctx, &User{ ID: "tommaso", Name: "Tommaso", Role: "Admin", }) if err != nil { log.Fatalf("Err: %v", err) }
Output:
func (*Client) UpsertUsers ΒΆ
UpsertUsers creates the given users. If a user doesn't exist, it will be created. Otherwise, custom data will be extended or updated. Missing data is never removed.
func (*Client) VerifyWebhook ΒΆ
VerifyWebhook validates if hmac signature is correct for message body.
type ClientOption ΒΆ
type ClientOption func(c *Client)
type Command ΒΆ
type Command struct { Name string `json:"name"` Description string `json:"description"` Args string `json:"args"` Set string `json:"set"` }
Command represents a custom command.
type CommandResponse ΒΆ
CommandResponse represents an API response containing one Command.
type CommandsResponse ΒΆ
type CommandsResponse struct {
Commands []*Command
}
CommandsResponse represents an API response containing a list of Command.
type CreateChannelResponse ΒΆ
type CreateImportResponse ΒΆ
type CreateImportResponse struct { ImportTask *ImportTask `json:"import_task"` Response }
type DeactivateUserOptions ΒΆ
type DeactivateUserOptions func(*deactivateUserOptions)
type DeleteType ΒΆ
type DeleteType string
const ( HardDelete DeleteType = "hard" SoftDelete DeleteType = "soft" )
type DeleteUserOption ΒΆ
type DeleteUserOption func(*deleteUserOptions)
type DeleteUserOptions ΒΆ
type DeleteUserOptions struct { User DeleteType `json:"user"` Messages DeleteType `json:"messages,omitempty"` Conversations DeleteType `json:"conversations,omitempty"` NewChannelOwnerID string `json:"new_channel_owner_id,omitempty"` }
type Device ΒΆ
type Device struct { ID string `json:"id"` // The device ID. UserID string `json:"user_id"` // The user ID for this device. PushProvider PushProviderType `json:"push_provider"` // The push provider for this device. One of constants PushProvider* PushProviderName string `json:"push_provider_name"` // The push provider name for this device. }
type DeviceError ΒΆ
type DevicesResponse ΒΆ
type Error ΒΆ
type Event ΒΆ
type Event struct { CID string `json:"cid,omitempty"` // Channel ID Type EventType `json:"type"` // Event type, one of Event* constants Message *Message `json:"message,omitempty"` Reaction *Reaction `json:"reaction,omitempty"` Channel *Channel `json:"channel,omitempty"` Member *ChannelMember `json:"member,omitempty"` Members []*ChannelMember `json:"members,omitempty"` User *User `json:"user,omitempty"` UserID string `json:"user_id,omitempty"` OwnUser *User `json:"me,omitempty"` WatcherCount int `json:"watcher_count,omitempty"` ExtraData map[string]interface{} `json:"-"` CreatedAt time.Time `json:"created_at,omitempty"` }
Event is received from a webhook, or sent with the SendEvent function.
func (Event) MarshalJSON ΒΆ
func (*Event) UnmarshalJSON ΒΆ
type EventType ΒΆ
type EventType string
EventType marks which of the various sub-types of a webhook event you are receiving or sending.
const ( // EventMessageNew is fired when a new message is added. EventMessageNew EventType = "message.new" // EventMessageUpdated is fired when a message is updated. EventMessageUpdated EventType = "message.updated" // EventMessageDeleted is fired when a message is deleted. EventMessageDeleted EventType = "message.deleted" // EventMessageRead is fired when a user calls mark as read. EventMessageRead EventType = "message.read" // EventReactionNew is fired when a message reaction is added. EventReactionNew EventType = "reaction.new" // EventReactionDeleted is fired when a message reaction deleted. EventReactionDeleted EventType = "reaction.deleted" // EventMemberAdded is fired when a member is added to a channel. EventMemberAdded EventType = "member.added" // EventMemberUpdated is fired when a member is updated. EventMemberUpdated EventType = "member.updated" // EventMemberRemoved is fired when a member is removed from a channel. EventMemberRemoved EventType = "member.removed" // EventChannelCreated is fired when a channel is created. EventChannelCreated EventType = "channel.created" // EventChannelUpdated is fired when a channel is updated. EventChannelUpdated EventType = "channel.updated" // EventChannelDeleted is fired when a channel is deleted. EventChannelDeleted EventType = "channel.deleted" // EventChannelTruncated is fired when a channel is truncated. EventChannelTruncated EventType = "channel.truncated" // EventHealthCheck is fired when a user is updated. EventHealthCheck EventType = "health.check" // EventNotificationNewMessage and family are fired when a notification is // created, marked read, invited to a channel, and so on. EventNotificationNewMessage EventType = "notification.message_new" EventNotificationMarkRead EventType = "notification.mark_read" EventNotificationInvited EventType = "notification.invited" EventNotificationInviteAccepted EventType = "notification.invite_accepted" EventNotificationAddedToChannel EventType = "notification.added_to_channel" EventNotificationRemovedFromChannel EventType = "notification.removed_from_channel" EventNotificationMutesUpdated EventType = "notification.mutes_updated" // EventTypingStart and EventTypingStop are fired when a user starts or stops typing. EventTypingStart EventType = "typing.start" EventTypingStop EventType = "typing.stop" // EventUserMuted is fired when a user is muted. EventUserMuted EventType = "user.muted" // EventUserUnmuted is fired when a user is unmuted. EventUserUnmuted EventType = "user.unmuted" EventUserPresenceChanged EventType = "user.presence.changed" EventUserWatchingStart EventType = "user.watching.start" EventUserWatchingStop EventType = "user.watching.stop" EventUserUpdated EventType = "user.updated" EventUserUnreadMessageReminder EventType = "user.unread_message_reminder" )
type ExportChannelOptions ΒΆ
type ExportUserResponse ΒΆ
type ExportableChannel ΒΆ
type ExtendedFlagReport ΒΆ
type FileUploadConfig ΒΆ
type FileUploadConfig struct { AllowedFileExtensions []string `json:"allowed_file_extensions,omitempty"` BlockedFileExtensions []string `json:"blocked_file_extensions,omitempty"` AllowedMimeTypes []string `json:"allowed_mime_types,omitempty"` BlockedMimeTypes []string `json:"blocked_mime_types,omitempty"` }
type FirebaseConfig ΒΆ
type FirebaseConfigRequest ΒΆ
type FirebaseConfigRequest struct { ServerKey string `json:"server_key"` NotificationTemplate string `json:"notification_template,omitempty"` DataTemplate string `json:"data_template,omitempty"` APNTemplate *string `json:"apn_template,omitempty"` CredentialsJSON string `json:"credentials_json,omitempty"` }
type FlagReport ΒΆ
type GetBlocklistResponse ΒΆ
type GetChannelTypeResponse ΒΆ
type GetChannelTypeResponse struct { *ChannelType Response }
type GetCommandResponse ΒΆ
type GetImportResponse ΒΆ
type GetImportResponse struct { ImportTask *ImportTask `json:"import_task"` Response }
type GetMessagesResponse ΒΆ
type GetPermissionResponse ΒΆ
type GetPermissionResponse struct { Permission *Permission `json:"permission"` Response }
type GetRateLimitsOption ΒΆ
type GetRateLimitsOption func(p *getRateLimitsParams)
GetRateLimitsOption configures the Client.GetRateLimits call.
func WithAndroid ΒΆ
func WithAndroid() GetRateLimitsOption
WithAndroid restricts the returned limits to Android clients only.
func WithEndpoints ΒΆ
func WithEndpoints(endpoints ...string) GetRateLimitsOption
WithEndpoints restricts the returned limits info to the specified endpoints.
func WithIOS ΒΆ
func WithIOS() GetRateLimitsOption
WithIOS restricts the returned limits to iOS clients only.
func WithServerSide ΒΆ
func WithServerSide() GetRateLimitsOption
WithServerSide restricts the returned limits to server-side clients only.
func WithWeb ΒΆ
func WithWeb() GetRateLimitsOption
WithWeb restricts the returned limits to web clients only.
type GetRateLimitsResponse ΒΆ
type GetRateLimitsResponse struct { ServerSide RateLimitsMap `json:"server_side,omitempty"` Android RateLimitsMap `json:"android,omitempty"` IOS RateLimitsMap `json:"ios,omitempty"` Web RateLimitsMap `json:"web,omitempty"` }
GetRateLimitsResponse is the response of the Client.GetRateLimits call. It includes, if present, the rate limits for the supported platforms, namely server-side, Android, iOS, and web.
type GuestUserResponse ΒΆ
type HuaweiConfig ΒΆ
type HuaweiConfig struct {
Enabled bool `json:"enabled"`
}
type HuaweiConfigRequest ΒΆ
type ImportMode ΒΆ
type ImportMode string
const ( InsertMode ImportMode = "insert" UpsertMode ImportMode = "upsert" )
type ImportTask ΒΆ
type ImportTask struct { CreatedAt time.Time `json:"created_at"` Path string `json:"path"` Mode ImportMode `json:"mode"` History []*ImportTaskHistory `json:"history"` ID string `json:"id"` State string `json:"state"` UpdatedAt time.Time `json:"updated_at"` Result interface{} `json:"result"` Size *int `json:"size"` }
type ImportTaskHistory ΒΆ
type LabelThresholds ΒΆ
type ListBlocklistsResponse ΒΆ
type ListImportsOptions ΒΆ
type ListImportsResponse ΒΆ
type ListImportsResponse struct { ImportTasks []*ImportTask `json:"import_tasks"` Response }
type ListPermissionsResponse ΒΆ
type ListPermissionsResponse struct { Permissions []*Permission `json:"permissions"` Response }
type MarkReadOption ΒΆ
type MarkReadOption func(*markReadOption)
type Message ΒΆ
type Message struct { ID string `json:"id"` CID string `json:"cid"` Text string `json:"text"` HTML string `json:"html"` Type MessageType `json:"type,omitempty"` // one of MessageType* constants Silent bool `json:"silent,omitempty"` User *User `json:"user"` Attachments []*Attachment `json:"attachments"` LatestReactions []*Reaction `json:"latest_reactions"` // last reactions OwnReactions []*Reaction `json:"own_reactions"` ReactionCounts map[string]int `json:"reaction_counts"` ReactionScores map[string]int `json:"reaction_scores"` ParentID string `json:"parent_id,omitempty"` // id of parent message if it's reply ShowInChannel bool `json:"show_in_channel,omitempty"` // show reply message also in channel ThreadParticipants []*User `json:"thread_participants,omitempty"` ReplyCount int `json:"reply_count,omitempty"` QuotedMessageID string `json:"quoted_message_id,omitempty"` MentionedUsers []*User `json:"mentioned_users"` Command string `json:"command,omitempty"` Shadowed bool `json:"shadowed,omitempty"` Pinned bool `json:"pinned,omitempty"` PinnedAt *time.Time `json:"pinned_at,omitempty"` PinnedBy *User `json:"pinned_by,omitempty"` PinExpires *time.Time `json:"pin_expires,omitempty"` ImageModerationLabels map[string][]string `json:"image_labels,omitempty"` MML string `json:"mml,omitempty"` I18n map[string]string `json:"i18n,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` DeletedAt *time.Time `json:"deleted_at,omitempty"` ExtraData map[string]interface{} `json:"-"` }
func (Message) MarshalJSON ΒΆ
MarshalJSON implements json.Marshaler.
func (*Message) UnmarshalJSON ΒΆ
UnmarshalJSON implements json.Unmarshaler.
type MessageFlag ΒΆ
type MessageFlag struct { CreatedByAutomod bool `json:"created_by_automod"` ModerationResult *struct { MessageID string `json:"message_id"` Action string `json:"action"` ModeratedBy string `json:"moderated_by"` BlockedWord string `json:"blocked_word"` BlocklistName string `json:"blocklist_name"` ModerationThresholds *struct { Explicit *struct { Flag float32 `json:"flag"` Block float32 `json:"block"` } `json:"explicit"` Spam *struct { Flag float32 `json:"flag"` Block float32 `json:"block"` } `json:"spam"` Toxic *struct { Flag float32 `json:"flag"` Block float32 `json:"block"` } `json:"toxic"` } `json:"moderation_thresholds"` AIModerationResponse *struct { Toxic float32 `json:"toxic"` Explicit float32 `json:"explicit"` Spam float32 `json:"spam"` } `json:"ai_moderation_response"` UserKarma float64 `json:"user_karma"` UserBadKarma bool `json:"user_bad_karma"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } `json:"moderation_result"` User *User `json:"user"` Message *Message `json:"message"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` ReviewedAt time.Time `json:"reviewed_at"` ReviewedBy *User `json:"reviewed_by"` ApprovedAt time.Time `json:"approved_at"` RejectedAt time.Time `json:"rejected_at"` }
type MessagePaginationParamsRequest ΒΆ
type MessagePaginationParamsRequest struct { PaginationParamsRequest CreatedAtAfterEq *time.Time `json:"created_at_after_or_equal,omitempty"` CreatedAtAfter *time.Time `json:"created_at_after,omitempty"` CreatedAtBeforeEq *time.Time `json:"created_at_before_or_equal,omitempty"` CreatedAtBefore *time.Time `json:"created_at_before,omitempty"` IDAround string `json:"id_around,omitempty"` CreatedAtAround *time.Time `json:"created_at_around,omitempty"` }
type MessagePartialUpdateRequest ΒΆ
type MessagePartialUpdateRequest struct { PartialUpdate UserID string `json:"user_id"` SkipEnrichURL bool `json:"skip_enrich_url"` }
type MessageResponse ΒΆ
type MessageType ΒΆ
type MessageType string
const ( MessageTypeRegular MessageType = "regular" MessageTypeError MessageType = "error" MessageTypeReply MessageType = "reply" MessageTypeSystem MessageType = "system" MessageTypeEphemeral MessageType = "ephemeral" )
type Mute ΒΆ
type Mute struct { User User `json:"user"` Target User `json:"target"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Expires *time.Time `json:"expires"` }
Mute represents a user mute.
type MuteOption ΒΆ
type MuteOption func(*muteOptions)
type PartialUpdate ΒΆ
type PartialUserUpdate ΒΆ
type PartialUserUpdate struct { ID string `json:"id"` // User ID, required Set map[string]interface{} `json:"set,omitempty"` // map of field.name => value; optional Unset []string `json:"unset,omitempty"` // list of field names to unset }
PartialUserUpdate request; Set and Unset fields can be set at same time, but should not be same field, for example you cannot set 'field.path.name' and unset 'field.path' at the same time. Field path should not contain spaces or dots (dot is path separator).
type Permission ΒΆ
type Permission struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` Action string `json:"action"` Owner bool `json:"owner"` SameTeam bool `json:"same_team"` Condition map[string]interface{} `json:"condition"` Custom bool `json:"custom"` Level string `json:"level"` }
type PermissionClient ΒΆ
type PermissionClient struct {
// contains filtered or unexported fields
}
func (*PermissionClient) CreatePermission ΒΆ
func (p *PermissionClient) CreatePermission(ctx context.Context, perm *Permission) (*Response, error)
CreatePermission creates a new permission.
func (*PermissionClient) CreateRole ΒΆ
CreateRole creates a new role.
func (*PermissionClient) DeletePermission ΒΆ
DeletePermission deletes a permission by id.
func (*PermissionClient) DeleteRole ΒΆ
DeleteRole deletes an existing role by name.
func (*PermissionClient) GetPermission ΒΆ
func (p *PermissionClient) GetPermission(ctx context.Context, id string) (*GetPermissionResponse, error)
GetPermission returns a permission by id.
func (*PermissionClient) ListPermissions ΒΆ
func (p *PermissionClient) ListPermissions(ctx context.Context) (*ListPermissionsResponse, error)
ListPermissions returns all permissions of an app.
func (*PermissionClient) ListRoles ΒΆ
func (p *PermissionClient) ListRoles(ctx context.Context) (*RolesResponse, error)
ListRole returns all roles.
func (*PermissionClient) UpdatePermission ΒΆ
func (p *PermissionClient) UpdatePermission(ctx context.Context, id string, perm *Permission) (*Response, error)
UpdatePermission updates an existing permission by id. Only custom permissions can be updated.
type Policy ΒΆ
type Policy struct { Name string `json:"name"` Resources []string `json:"resources"` Roles []string `json:"roles"` Action int `json:"action"` // allow: 1, deny: 0 Owner bool `json:"owner"` Priority int `json:"priority"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
type PushConfigRequest ΒΆ
type PushNotificationFields ΒΆ
type PushNotificationFields struct { Version string `json:"version"` OfflineOnly bool `json:"offline_only"` APNConfig APNConfig `json:"apn"` FirebaseConfig FirebaseConfig `json:"firebase"` HuaweiConfig HuaweiConfig `json:"huawei"` XiaomiConfig XiaomiConfig `json:"xiaomi"` }
type PushProvider ΒΆ
type PushProvider struct { Type PushProviderType `json:"type"` Name string `json:"name"` Description string `json:"description,omitempty"` DisabledAt *time.Time `json:"disabled_at,omitempty"` DisabledReason string `json:"disabled_reason,omitempty"` APNAuthKey string `json:"apn_auth_key,omitempty"` APNKeyID string `json:"apn_key_id,omitempty"` APNTeamID string `json:"apn_team_id,omitempty"` APNTopic string `json:"apn_topic,omitempty"` FirebaseCredentials string `json:"firebase_credentials,omitempty"` FirebaseNotificationTemplate *string `json:"firebase_notification_template,omitempty"` FirebaseAPNTemplate *string `json:"firebase_apn_template,omitempty"` HuaweiAppID string `json:"huawei_app_id,omitempty"` HuaweiAppSecret string `json:"huawei_app_secret,omitempty"` XiaomiPackageName string `json:"xiaomi_package_name,omitempty"` XiaomiAppSecret string `json:"xiaomi_app_secret,omitempty"` }
type PushProviderListResponse ΒΆ
type PushProviderListResponse struct { Response PushProviders []PushProvider `json:"push_providers"` }
type PushProviderType ΒΆ
type PushProviderType = string
type QueryBannedUsersOptions ΒΆ
type QueryBannedUsersOptions struct {
*QueryOption
}
type QueryChannelsResponse ΒΆ
type QueryFlagReportsResponse ΒΆ
type QueryFlagReportsResponse struct { Response FlagReports []*FlagReport `json:"flag_reports"` }
type QueryMembersResponse ΒΆ
type QueryMembersResponse struct { Members []*ChannelMember `json:"members"` Response }
type QueryMessageFlagsResponse ΒΆ
type QueryMessageFlagsResponse struct { Flags []*MessageFlag `json:"flags"` Response }
type QueryOption ΒΆ
type QueryOption struct { // https://getstream.io/chat/docs/#query_syntax Filter map[string]interface{} `json:"filter_conditions,omitempty"` Sort []*SortOption `json:"sort,omitempty"` UserID string `json:"user_id,omitempty"` Limit int `json:"limit,omitempty"` // pagination option: limit number of results Offset int `json:"offset,omitempty"` // pagination option: offset to return items from MessageLimit *int `json:"message_limit,omitempty"` MemberLimit *int `json:"member_limit,omitempty"` }
type QueryRequest ΒΆ
type QueryRequest struct { Data *ChannelRequest `json:"data,omitempty"` Watch bool `json:"watch,omitempty"` State bool `json:"state,omitempty"` Presence bool `json:"presence,omitempty"` Messages *MessagePaginationParamsRequest `json:"messages,omitempty"` Members *PaginationParamsRequest `json:"members,omitempty"` Watchers *PaginationParamsRequest `json:"watchers,omitempty"` }
type QueryResponse ΒΆ
type QueryResponse struct { Channel *Channel `json:"channel,omitempty"` Messages []*Message `json:"messages,omitempty"` PinnedMessages []*Message `json:"pinned_messages,omitempty"` Members []*ChannelMember `json:"members,omitempty"` Read []*ChannelRead `json:"read,omitempty"` Response }
type QueryUsersResponse ΒΆ
type RateLimitInfo ΒΆ
type RateLimitInfo struct { // Limit is the maximum number of API calls for a single time window (1 minute). Limit int64 `json:"limit"` // Remaining is the number of API calls remaining in the current time window (1 minute). Remaining int64 `json:"remaining"` // Reset is the Unix timestamp of the expiration of the current rate limit time window. Reset int64 `json:"reset"` }
RateLimitInfo represents the quota and usage for a single endpoint.
func NewRateLimitFromHeaders ΒΆ
func NewRateLimitFromHeaders(headers http.Header) *RateLimitInfo
func (RateLimitInfo) ResetTime ΒΆ
func (i RateLimitInfo) ResetTime() time.Time
ResetTime is a simple helper to get the time.Time representation of the Reset field of the given limit window.
type RateLimitsMap ΒΆ
type RateLimitsMap map[string]RateLimitInfo
RateLimitsMap holds the rate limit information, where the keys are the names of the endpoints and the values are the related RateLimitInfo containing the quota, usage, and reset data.
type Reaction ΒΆ
type Reaction struct { MessageID string `json:"message_id"` UserID string `json:"user_id"` Type string `json:"type"` // any other fields the user wants to attach a reaction ExtraData map[string]interface{} `json:"-"` }
func (Reaction) MarshalJSON ΒΆ
func (*Reaction) UnmarshalJSON ΒΆ
type ReactionResponse ΒΆ
type ReactionsResponse ΒΆ
type ReactivateUserOptions ΒΆ
type ReactivateUserOptions func(*reactivateUserOptions)
type RepliesResponse ΒΆ
type Response ΒΆ
type Response struct {
RateLimitInfo *RateLimitInfo `json:"ratelimit"`
}
Response is the base response returned to client. It contains rate limit information. All specific response returned to the client should embed this type.
type ReviewFlagReportResponse ΒΆ
type ReviewFlagReportResponse struct { Response FlagReport *ExtendedFlagReport `json:"flag_report"` }
type RoleAssignment ΒΆ
type RolesResponse ΒΆ
type SearchFullResponse ΒΆ
type SearchFullResponse struct { Results []SearchMessageResponse `json:"results"` Next string `json:"next,omitempty"` Previous string `json:"previous,omitempty"` Response }
type SearchMessageResponse ΒΆ
type SearchMessageResponse struct {
Message *Message `json:"message"`
}
type SearchRequest ΒΆ
type SearchRequest struct { // Required Query string `json:"query"` Filters map[string]interface{} `json:"filter_conditions"` MessageFilters map[string]interface{} `json:"message_filter_conditions"` // Pagination, optional Limit int `json:"limit,omitempty"` Offset int `json:"offset,omitempty"` Next string `json:"next,omitempty"` // Sort, optional Sort []SortOption `json:"sort,omitempty"` }
type SearchResponse ΒΆ
type SendFileRequest ΒΆ
type SendFileResponse ΒΆ
type SendMessageOption ΒΆ
type SendMessageOption func(*messageRequest)
SendMessageOption is an option that modifies behavior of send message request.
func MessagePendingMessageMetadata ΒΆ
func MessagePendingMessageMetadata(metadata map[string]string) SendMessageOption
MessagePendingMessageMetadata saves metadata to the pending message
type SortOption ΒΆ
type TaskResponse ΒΆ
type TaskStatus ΒΆ
type TaskStatus string
const ( TaskStatusWaiting TaskStatus = "waiting" TaskStatusPending TaskStatus = "pending" TaskStatusRunning TaskStatus = "running" TaskStatusCompleted TaskStatus = "completed" TaskStatusFailed TaskStatus = "failed" )
type Thresholds ΒΆ
type Thresholds struct { Explicit *LabelThresholds `json:"explicit"` Spam *LabelThresholds `json:"spam"` Toxic *LabelThresholds `json:"toxic"` }
type TranslationResponse ΒΆ
type TruncateOption ΒΆ
type TruncateOption func(*truncateOptions)
type TruncateResponse ΒΆ
type UpsertUserResponse ΒΆ
type User ΒΆ
type User struct { ID string `json:"id"` Name string `json:"name,omitempty"` Image string `json:"image,omitempty"` Role string `json:"role,omitempty"` Teams []string `json:"teams,omitempty"` Language string `json:"language,omitempty"` Online bool `json:"online,omitempty"` Invisible bool `json:"invisible,omitempty"` ChannelUnreadCount int `json:"channel_unread_count,omitempty"` TotalUnreadCount int `json:"total_unread_count,omitempty"` UnreadChannels int `json:"unread_channels,omitempty"` UnreadCount int `json:"unread_count,omitempty"` ChannelLastReadAt *time.Time `json:"channel_last_read_at,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` LastActive *time.Time `json:"last_active,omitempty"` Mutes []*Mute `json:"mutes,omitempty"` ChannelMutes []*ChannelMute `json:"channel_mutes,omitempty"` ExtraData map[string]interface{} `json:"-"` RevokeTokensIssuedBefore *time.Time `json:"revoke_tokens_issued_before,omitempty"` }
func (User) MarshalJSON ΒΆ
MarshalJSON implements json.Marshaler.
func (*User) UnmarshalJSON ΒΆ
UnmarshalJSON implements json.Unmarshaler.
type UserCustomEvent ΒΆ
type UserCustomEvent struct { // Type should be a custom type. Using a built-in event is not supported here. Type string `json:"type"` ExtraData map[string]interface{} `json:"-"` CreatedAt time.Time `json:"created_at,omitempty"` }
UserCustomEvent is a custom event sent to a particular user.
func (UserCustomEvent) MarshalJSON ΒΆ
func (e UserCustomEvent) MarshalJSON() ([]byte, error)
func (*UserCustomEvent) UnmarshalJSON ΒΆ
func (e *UserCustomEvent) UnmarshalJSON(data []byte) error
type UsersResponse ΒΆ
type XiaomiConfig ΒΆ
type XiaomiConfig struct {
Enabled bool `json:"enabled"`
}