Versions in this module Expand all Collapse all v4 v4.0.1 Dec 23, 2021 v4.0.0 Dec 17, 2021 Changes in this version + const AutoModAI + const AutoModDisabled + const AutoModSimple + const HeaderRateLimit + const HeaderRateRemaining + const HeaderRateReset + const MessageRetentionForever + const ModBehaviourBlock + const ModBehaviourFlag + const PushProviderAPNS + const PushProviderFirebase + var DefaultChannelConfig = ChannelConfig + func MessageSkipPush(r *messageRequest) + func TruncateWithHardDelete(hardDelete bool) func(*truncateOptions) + func TruncateWithMessage(message *Message) func(*truncateOptions) + func TruncateWithSkipPush(skipPush bool) func(*truncateOptions) + func TruncateWithTruncatedAt(truncatedAt *time.Time) func(*truncateOptions) + func Version() string + type APNConfig struct + AuthKey []byte + AuthType string + BundleID string + Development bool + Enabled bool + Host string + KeyID string + NotificationTemplate string + TeamID string + type AppConfig struct + AsyncURLEnrichEnabled bool + ConfigNameMap map[string]*ChannelConfig + DisableAuth bool + DisablePermissions bool + MultiTenantEnabled bool + Name string + OrganizationName string + Policies map[string][]Policy + PushNotifications PushNotificationFields + RevokeTokensIssuedBefore *time.Time + Suspended bool + SuspendedExplanation string + WebhookURL string + type AppResponse struct + App *AppConfig + type AppSettings struct + APNConfig *APNConfig + AsyncURLEnrichEnabled *bool + DisableAuth *bool + DisablePermissions *bool + FirebaseConfig *FirebaseConfig + MultiTenantEnabled *bool + WebhookURL *string + func NewAppSettings() *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 FirebaseConfig) *AppSettings + func (a *AppSettings) SetMultiTenant(b bool) *AppSettings + func (a *AppSettings) SetWebhookURL(s string) *AppSettings + type AsyncTaskResponse struct + TaskID string + type Attachment struct + AssetURL string + AuthorName string + ExtraData map[string]interface{} + ImageURL string + OGScrapeURL string + Text string + ThumbURL string + Title string + TitleLink string + Type string + func (a *Attachment) UnmarshalJSON(data []byte) error + func (a Attachment) MarshalJSON() ([]byte, error) + type Channel struct + CID string + Config ChannelConfig + CreatedAt time.Time + CreatedBy *User + Disabled bool + ExtraData map[string]interface{} + Frozen bool + ID string + LastMessageAt time.Time + MemberCount int + Members []*ChannelMember + Messages []*Message + Read []*ChannelRead + Team string + Type string + UpdatedAt time.Time + func (ch *Channel) AcceptInvite(ctx context.Context, userID string, message *Message) (*Response, error) + func (ch *Channel) AddMembers(ctx context.Context, userIDs []string, message *Message, ...) (*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, userID string, options map[string]interface{}) (*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) GetReactions(ctx context.Context, messageID string, options map[string][]string) (*ReactionsResponse, 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 map[string]interface{}) (*Response, 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, data map[string]interface{}) (*Response, error) + func (ch *Channel) QueryMembers(ctx context.Context, q *QueryOption, sorters ...*SortOption) (*QueryMembersResponse, 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) RemoveShadowBan(ctx context.Context, userID string) (*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, userID, bannedByID string, options map[string]interface{}) (*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, options map[string]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) + func (ch Channel) MarshalJSON() ([]byte, error) + type ChannelConfig struct + Automod modType + AutomodThresholds *Thresholds + BlockList string + BlockListBehavior modBehaviour + ConnectEvents bool + CustomEvents bool + MaxMessageLength int + MessageRetention string + ModBehavior modBehaviour + Mutes bool + Name string + PushNotifications bool + Reactions bool + ReadEvents bool + Replies bool + Search bool + TypingEvents bool + URLEnrichment bool + Uploads bool + type ChannelMember struct + CreatedAt time.Time + InviteAcceptedAt *time.Time + InviteRejectedAt *time.Time + Invited bool + IsModerator bool + Role string + UpdatedAt time.Time + User *User + UserID string + type ChannelMute struct + Channel Channel + CreatedAt time.Time + Expires *time.Time + UpdatedAt time.Time + User User + type ChannelMuteResponse struct + ChannelMute ChannelMute + type ChannelRead struct + LastRead time.Time + User *User + type ChannelType struct + Commands []*Command + CreatedAt time.Time + Permissions []*ChannelTypePermission + UpdatedAt time.Time + func NewChannelType(name string) *ChannelType + type ChannelTypePermission struct + Action string + Name string + Owner bool + Priority int + Resources []string + Roles []string + type ChannelTypeResponse struct + Commands []string + CreatedAt time.Time + UpdatedAt time.Time + type ChannelTypesResponse struct + ChannelTypes map[string]*ChannelType + type Client struct + BaseURL string + HTTP *http.Client + func NewClient(apiKey, apiSecret string) (*Client, error) + func (c *Client) AddDevice(ctx context.Context, device *Device) (*Response, error) + func (c *Client) BanUser(ctx context.Context, targetID, userID string, options map[string]interface{}) (*Response, error) + func (c *Client) Channel(channelType, channelID string) *Channel + func (c *Client) CreateChannel(ctx context.Context, chanType, chanID, userID string, ...) (*CreateChannelResponse, error) + func (c *Client) CreateChannelType(ctx context.Context, chType *ChannelType) (*ChannelTypeResponse, error) + func (c *Client) CreateCommand(ctx context.Context, cmd *Command) (*CommandResponse, 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 map[string]interface{}) (*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) DeleteUser(ctx context.Context, targetID string, options map[string][]string) (*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, options map[string][]string) (*ExportUserResponse, error) + func (c *Client) FlagMessage(ctx context.Context, msgID, userID string) (*Response, error) + func (c *Client) FlagUser(ctx context.Context, targetID string, options map[string]interface{}) (*Response, error) + func (c *Client) GetAppConfig(ctx context.Context) (*AppResponse, 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) GetMessage(ctx context.Context, msgID string) (*MessageResponse, error) + func (c *Client) GetRateLimits(ctx context.Context, options ...GetRateLimitsOption) (GetRateLimitsResponse, 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) ListChannelTypes(ctx context.Context) (*ChannelTypesResponse, error) + func (c *Client) ListCommands(ctx context.Context) (*CommandsResponse, error) + func (c *Client) MarkAllRead(ctx context.Context, userID string) (*Response, error) + func (c *Client) MuteUser(ctx context.Context, targetID, userID string, options map[string]interface{}) (*Response, error) + func (c *Client) MuteUsers(ctx context.Context, targetIDs []string, userID string, ...) (*Response, error) + func (c *Client) PartialUpdateMessage(ctx context.Context, messageID string, updates PartialUpdate, ...) (*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) QueryChannels(ctx context.Context, q *QueryOption, sort ...*SortOption) (*QueryChannelsResponse, 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 map[string]interface{}) (*Response, error) + func (c *Client) RemoveShadowBan(ctx context.Context, userID string, options map[string]string) (*Response, 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) SendUserCustomEvent(ctx context.Context, targetUserID string, event *UserCustomEvent) (*Response, error) + func (c *Client) ShadowBan(ctx context.Context, userID, bannedByID string, options map[string]interface{}) (*Response, error) + func (c *Client) UnBanUser(ctx context.Context, targetID string, options map[string]string) (*Response, error) + func (c *Client) UnPinMessage(ctx context.Context, msgID, userID string) (*MessageResponse, error) + func (c *Client) UnmuteUser(ctx context.Context, targetID, userID string) (*Response, error) + func (c *Client) UnmuteUsers(ctx context.Context, targetIDs []string, userID string) (*Response, error) + func (c *Client) UpdateAppSettings(ctx context.Context, settings *AppSettings) (*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, options map[string]interface{}) (*CommandResponse, error) + func (c *Client) UpdateMessage(ctx context.Context, msg *Message, msgID string) (*MessageResponse, 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 Command struct + Args string + Description string + Name string + Set string + type CommandResponse struct + Command *Command + type CommandsResponse struct + Commands []*Command + type CreateChannelResponse struct + Channel *Channel + type DeleteType string + const HardDelete + const SoftDelete + type DeleteUserOptions struct + Conversations DeleteType + Messages DeleteType + NewChannelOwnerID string + User DeleteType + type Device struct + ID string + PushProvider pushProvider + UserID string + type DevicesResponse struct + Devices []*Device + type Error struct + Code int + Duration string + ExceptionFields map[string]string + Message string + MoreInfo string + RateLimit *RateLimitInfo + StatusCode int + func (e Error) Error() string + type Event struct + CID string + Channel *Channel + CreatedAt time.Time + ExtraData map[string]interface{} + Member *ChannelMember + Members []*ChannelMember + Message *Message + OwnUser *User + Reaction *Reaction + Type EventType + User *User + UserID string + WatcherCount int + func (e *Event) UnmarshalJSON(data []byte) error + func (e Event) MarshalJSON() ([]byte, error) + type EventType string + const EventChannelCreated + const EventChannelDeleted + const EventChannelTruncated + const EventChannelUpdated + const EventHealthCheck + const EventMemberAdded + const EventMemberRemoved + const EventMemberUpdated + const EventMessageDeleted + const EventMessageNew + const EventMessageRead + const EventMessageUpdated + const EventNotificationAddedToChannel + const EventNotificationInviteAccepted + const EventNotificationInvited + const EventNotificationMarkRead + const EventNotificationMutesUpdated + const EventNotificationNewMessage + const EventNotificationRemovedFromChannel + const EventReactionDeleted + const EventReactionNew + const EventTypingStart + const EventTypingStop + const EventUserMuted + const EventUserPresenceChanged + const EventUserUnmuted + const EventUserUpdated + const EventUserWatchingStart + const EventUserWatchingStop + type ExportUserResponse struct + type ExportableChannel struct + ID string + MessagesSince *time.Time + MessagesUntil *time.Time + Type string + type FirebaseConfig struct + DataTemplate string + Enabled bool + NotificationTemplate string + ServerKey string + type GetChannelTypeResponse struct + type GetCommandResponse struct + type GetPermissionResponse struct + Permission *Permission + type GetRateLimitsOption func(p *getRateLimitsParams) + func WithAndroid() GetRateLimitsOption + func WithEndpoints(endpoints ...string) GetRateLimitsOption + func WithIOS() GetRateLimitsOption + func WithServerSide() GetRateLimitsOption + func WithWeb() GetRateLimitsOption + type GetRateLimitsResponse struct + Android RateLimitsMap + IOS RateLimitsMap + ServerSide RateLimitsMap + Web RateLimitsMap + type LabelThresholds struct + Block float32 + Flag float32 + type ListPermissionsResponse struct + Permissions []*Permission + type Message struct + Attachments []*Attachment + CreatedAt *time.Time + DeletedAt *time.Time + ExtraData map[string]interface{} + HTML string + ID string + LatestReactions []*Reaction + MentionedUsers []*User + OwnReactions []*Reaction + ParentID string + PinnedAt *time.Time + PinnedBy *User + ReactionCounts map[string]int + ReplyCount int + Shadowed bool + ShowInChannel bool + Silent bool + Text string + Type MessageType + UpdatedAt *time.Time + User *User + func (m *Message) UnmarshalJSON(data []byte) error + func (m Message) MarshalJSON() ([]byte, error) + type MessageFlag struct + ApprovedAt time.Time + CreatedAt time.Time + CreatedByAutomod bool + Message *Message + ModerationResult ... + RejectedAt time.Time + ReviewedAt time.Time + ReviewedBy *User + UpdatedAt time.Time + User *User + type MessageResponse struct + Message *Message + type MessageType string + const MessageTypeEphemeral + const MessageTypeError + const MessageTypeRegular + const MessageTypeReply + const MessageTypeSystem + type Mute struct + CreatedAt time.Time + Expires *time.Time + Target User + UpdatedAt time.Time + User User + type PartialUpdate struct + Set map[string]interface{} + Unset []string + type PartialUserUpdate struct + ID string + Set map[string]interface{} + Unset []string + type Permission struct + Action string + Condition map[string]interface{} + Custom bool + Description string + ID string + Level string + Name string + Owner bool + SameTeam bool + type PermissionClient struct + 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 struct + Action int + CreatedAt time.Time + Name string + Owner bool + Priority int + Resources []string + Roles []string + UpdatedAt time.Time + type PushNotificationFields struct + APNConfig APNConfig + FirebaseConfig FirebaseConfig + type QueryChannelsResponse struct + Channels []*Channel + type QueryMembersResponse struct + Members []*ChannelMember + type QueryMessageFlagsResponse struct + Flags []*MessageFlag + type QueryOption struct + Filter map[string]interface{} + Limit int + MemberLimit *int + MessageLimit *int + Offset int + Sort []*SortOption + UserID string + type QueryUsersResponse struct + Users []*User + type RateLimitInfo struct + Limit int64 + Remaining int64 + Reset int64 + func NewRateLimitFromHeaders(headers http.Header) *RateLimitInfo + func (i RateLimitInfo) ResetTime() time.Time + type RateLimitsMap map[string]RateLimitInfo + type Reaction struct + ExtraData map[string]interface{} + MessageID string + Type string + UserID string + func (s *Reaction) UnmarshalJSON(data []byte) error + func (s Reaction) MarshalJSON() ([]byte, error) + type ReactionResponse struct + Message *Message + Reaction *Reaction + type ReactionsResponse struct + Reactions []*Reaction + type RepliesResponse struct + Messages []*Message + type Response struct + RateLimitInfo *RateLimitInfo + type Role struct + CreatedAt time.Time + Custom bool + Name string + Scopes []string + UpdatedAt time.Time + type RoleAssignment struct + ChannelRole string + UserID string + type RolesResponse struct + Roles []*Role + type SearchFullResponse struct + Next string + Previous string + Results []SearchMessageResponse + type SearchMessageResponse struct + Message *Message + type SearchRequest struct + Filters map[string]interface{} + Limit int + MessageFilters map[string]interface{} + Next string + Offset int + Query string + Sort []SortOption + type SearchResponse struct + Messages []*Message + type SendFileRequest struct + ContentType string + FileName string + Reader io.Reader + User *User + type SendFileResponse struct + File string + type SendMessageOption func(*messageRequest) + type SortOption struct + Direction int + Field string + type TaskResponse struct + CreatedAt time.Time + Result map[string]interface{} + Status TaskStatus + TaskID string + UpdatedAt time.Time + type TaskStatus string + const TaskStatusCompleted + const TaskStatusFailed + const TaskStatusPending + const TaskStatusRunning + const TaskStatusWaiting + type Thresholds struct + Explicit *LabelThresholds + Spam *LabelThresholds + Toxic *LabelThresholds + type TruncateOption func(*truncateOptions) + type UpsertUserResponse struct + User *User + type User struct + ChannelMutes []*ChannelMute + CreatedAt *time.Time + ExtraData map[string]interface{} + ID string + Image string + Invisible bool + LastActive *time.Time + Mutes []*Mute + Name string + Online bool + RevokeTokensIssuedBefore *time.Time + Role string + Teams []string + UpdatedAt *time.Time + func (u *User) UnmarshalJSON(data []byte) error + func (u User) MarshalJSON() ([]byte, error) + type UserCustomEvent struct + CreatedAt time.Time + ExtraData map[string]interface{} + Type string + func (e *UserCustomEvent) UnmarshalJSON(data []byte) error + func (e UserCustomEvent) MarshalJSON() ([]byte, error) + type UsersResponse struct + Users map[string]*User Other modules containing this package github.com/GetStream/stream-chat-go github.com/GetStream/stream-chat-go/v2 github.com/GetStream/stream-chat-go/v3 github.com/GetStream/stream-chat-go/v5 github.com/GetStream/stream-chat-go/v6 github.com/GetStream/stream-chat-go/v7 github.com/GetStream/stream-chat-go/v8