Documentation ¶
Overview ¶
Package chatkit is the Golang server SDK for Pusher Chatkit. This package provides functionality to interact with various Chatkit services.
More information can be found in the Chatkit docs: https://docs.pusher.com/chatkit/overview/.
Please report any bugs or feature requests at: https://github.com/pusher/chatkit-server-go.
Index ¶
- Constants
- Variables
- type Attachment
- type AuthenticateOptions
- type AuthenticatePayload
- type Client
- func (c *Client) AddUsersToRoom(ctx context.Context, roomID string, userIDs []string) error
- func (c *Client) AssignGlobalRoleToUser(ctx context.Context, userID string, roleName string) error
- func (c *Client) AssignRoomRoleToUser(ctx context.Context, userID string, roomID string, roleName string) error
- func (c *Client) Authenticate(payload auth.Payload, options auth.Options) (*auth.Response, error)
- func (c *Client) AuthorizerRequest(ctx context.Context, options platformclient.RequestOptions) (*http.Response, error)
- func (c *Client) CoreRequest(ctx context.Context, options platformclient.RequestOptions) (*http.Response, error)
- func (c *Client) CreateGlobalRole(ctx context.Context, options CreateRoleOptions) error
- func (c *Client) CreateRoom(ctx context.Context, options CreateRoomOptions) (Room, error)
- func (c *Client) CreateRoomRole(ctx context.Context, options CreateRoleOptions) error
- func (c *Client) CreateUser(ctx context.Context, options CreateUserOptions) error
- func (c *Client) CreateUsers(ctx context.Context, users []CreateUserOptions) error
- func (c *Client) CursorsRequest(ctx context.Context, options platformclient.RequestOptions) (*http.Response, error)
- func (c *Client) DeleteGlobalRole(ctx context.Context, roleName string) error
- func (c *Client) DeleteMessage(ctx context.Context, options DeleteMessageOptions) error
- func (c *Client) DeleteRoom(ctx context.Context, roomID string) error
- func (c *Client) DeleteRoomRole(ctx context.Context, roleName string) error
- func (c *Client) DeleteUser(ctx context.Context, userID string) error
- func (c *Client) EditMessage(ctx context.Context, roomID string, messageID uint, options EditMessageOptions) error
- func (c *Client) EditMultipartMessage(ctx context.Context, roomID string, messageID uint, ...) error
- func (c *Client) EditSimpleMessage(ctx context.Context, roomID string, messageID uint, ...) error
- func (c *Client) FetchMultipartMessage(ctx context.Context, options FetchMultipartMessageOptions) (MultipartMessage, error)
- func (c *Client) FetchMultipartMessages(ctx context.Context, roomID string, options GetRoomMessagesOptions) ([]MultipartMessage, error)
- func (c *Client) GenerateAccessToken(options auth.Options) (auth.TokenWithExpiry, error)
- func (c *Client) GenerateSUToken(options auth.Options) (auth.TokenWithExpiry, error)
- func (c *Client) GetPermissionsForGlobalRole(ctx context.Context, roleName string) ([]string, error)
- func (c *Client) GetPermissionsForRoomRole(ctx context.Context, roleName string) ([]string, error)
- func (c *Client) GetReadCursor(ctx context.Context, userID string, roomID string) (Cursor, error)
- func (c *Client) GetReadCursorsForRoom(ctx context.Context, roomID string) ([]Cursor, error)
- func (c *Client) GetRoles(ctx context.Context) ([]Role, error)
- func (c *Client) GetRoom(ctx context.Context, roomID string) (Room, error)
- func (c *Client) GetRoomMessages(ctx context.Context, roomID string, options GetRoomMessagesOptions) ([]Message, error)
- func (c *Client) GetRooms(ctx context.Context, options GetRoomsOptions) ([]core.RoomWithoutMembers, error)
- func (c *Client) GetUser(ctx context.Context, userID string) (User, error)
- func (c *Client) GetUserJoinableRooms(ctx context.Context, userID string) ([]Room, error)
- func (c *Client) GetUserReadCursors(ctx context.Context, userID string) ([]Cursor, error)
- func (c *Client) GetUserRoles(ctx context.Context, userID string) ([]Role, error)
- func (c *Client) GetUserRooms(ctx context.Context, userID string) ([]Room, error)
- func (c *Client) GetUsers(ctx context.Context, options *GetUsersOptions) ([]User, error)
- func (c *Client) GetUsersByID(ctx context.Context, userIDs []string) ([]User, error)
- func (c *Client) RemoveGlobalRoleForUser(ctx context.Context, userID string) error
- func (c *Client) RemoveRoomRoleForUser(ctx context.Context, userID string, roomID string) error
- func (c *Client) RemoveUsersFromRoom(ctx context.Context, roomID string, userIDs []string) error
- func (c *Client) SendMessage(ctx context.Context, options SendMessageOptions) (uint, error)
- func (c *Client) SendMultipartMessage(ctx context.Context, options SendMultipartMessageOptions) (uint, error)
- func (c *Client) SendSimpleMessage(ctx context.Context, options SendSimpleMessageOptions) (uint, error)
- func (c *Client) SetReadCursor(ctx context.Context, userID string, roomID string, position uint) error
- func (c *Client) UpdatePermissionsForGlobalRole(ctx context.Context, roleName string, options UpdateRolePermissionsOptions) error
- func (c *Client) UpdatePermissionsForRoomRole(ctx context.Context, roleName string, options UpdateRolePermissionsOptions) error
- func (c *Client) UpdateRoom(ctx context.Context, roomID string, options UpdateRoomOptions) error
- func (c *Client) UpdateUser(ctx context.Context, userID string, options UpdateUserOptions) error
- type CreateRoleOptions
- type CreateRoomOptions
- type CreateUserOptions
- type Cursor
- type DeleteMessageOptions
- type EditMessageOptions
- type EditMultipartMessageOptions
- type EditSimpleMessageOptions
- type ErrorResponse
- type FetchMultipartMessageOptions
- type FetchMultipartMessagesOptions
- type GetRoomMessagesOptions
- type GetRoomsOptions
- type GetUsersOptions
- type Message
- type MultipartMessage
- type NewAttachmentPart
- type NewInlinePart
- type NewPart
- type NewURLPart
- type Part
- type RequestOptions
- type Role
- type Room
- type RoomWithoutMembers
- type SendMessageOptions
- type SendMultipartMessageOptions
- type SendSimpleMessageOptions
- type UpdateRolePermissionsOptions
- type UpdateRoomOptions
- type UpdateUserOptions
- type User
Constants ¶
const GrantTypeClientCredentials = auth.GrantTypeClientCredentials
Variables ¶
var ExplicitlyResetPushNotificationTitleOverride = &core.ExplicitlyResetPushNotificationTitleOverride
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Attachment = core.Attachment
type AuthenticateOptions ¶
type AuthenticatePayload ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Public interface for the library. It allows interacting with different Chatkit services.
func (*Client) AddUsersToRoom ¶
AddUsersToRoom adds new users to an existing room.
func (*Client) AssignGlobalRoleToUser ¶
AssignGlobalRoleToUser assigns a previously created globally scoped role to a user.
func (*Client) AssignRoomRoleToUser ¶
func (c *Client) AssignRoomRoleToUser( ctx context.Context, userID string, roomID string, roleName string, ) error
AssignRoomRoleToUser assigns a previously created room scoped role to a user.
func (*Client) Authenticate ¶
Authenticate returns a token response along with headers and status code to be used within the context of a token provider. Currently, the only supported GrantType is GrantTypeClientCredentials.
func (*Client) AuthorizerRequest ¶
func (c *Client) AuthorizerRequest( ctx context.Context, options platformclient.RequestOptions, ) (*http.Response, error)
AuthorizerRequest allows performing requests to the authorizer service and returns a raw HTTP response.
func (*Client) CoreRequest ¶
func (c *Client) CoreRequest( ctx context.Context, options platformclient.RequestOptions, ) (*http.Response, error)
CoreRequest allows making requests to the core chatkit service and returns a raw HTTP response.
func (*Client) CreateGlobalRole ¶
func (c *Client) CreateGlobalRole(ctx context.Context, options CreateRoleOptions) error
CreateGlobalRole allows creating a globally scoped role.
func (*Client) CreateRoom ¶
CreateRoom creates a new room.
func (*Client) CreateRoomRole ¶
func (c *Client) CreateRoomRole(ctx context.Context, options CreateRoleOptions) error
CreateRoomRole allows creating a room scoped role.
func (*Client) CreateUser ¶
func (c *Client) CreateUser(ctx context.Context, options CreateUserOptions) error
CreateUser creates a new chatkit user.
func (*Client) CreateUsers ¶
func (c *Client) CreateUsers(ctx context.Context, users []CreateUserOptions) error
CreateUsers creates a batch of users.
func (*Client) CursorsRequest ¶
func (c *Client) CursorsRequest( ctx context.Context, options platformclient.RequestOptions, ) (*http.Response, error)
CursorsRequest allows performing a request to the cursors service that returns a raw HTTP response.
func (*Client) DeleteGlobalRole ¶
DeleteGlobalRole deletes a previously created globally scoped role.
func (*Client) DeleteMessage ¶
func (c *Client) DeleteMessage(ctx context.Context, options DeleteMessageOptions) error
DeleteMessage allows a previously sent message to be deleted.
func (*Client) DeleteRoom ¶
DeleteRoom deletes an existing room.
func (*Client) DeleteRoomRole ¶
DeleteRoomRole deletes a previously created room scoped role.
func (*Client) DeleteUser ¶
DeleteUser deletes a previously created user.
func (*Client) EditMessage ¶
func (c *Client) EditMessage(ctx context.Context, roomID string, messageID uint, options EditMessageOptions) error
EditMessage identifies an existing message by both its room and message id in order to replace it's content and sender id with updated values.
func (*Client) EditMultipartMessage ¶
func (c *Client) EditMultipartMessage(ctx context.Context, roomID string, messageID uint, options EditMultipartMessageOptions) error
EditMultipartMessage identifies an existing message by both its room and message id in order to replace it's content and sender id with updated values.
func (*Client) EditSimpleMessage ¶
func (c *Client) EditSimpleMessage(ctx context.Context, roomID string, messageID uint, options EditSimpleMessageOptions) error
EditSimpleMessage identifies an existing message by both its room and message id in order to replace it's content and sender id with updated values.
func (*Client) FetchMultipartMessage ¶
func (c *Client) FetchMultipartMessage( ctx context.Context, options FetchMultipartMessageOptions, ) (MultipartMessage, error)
FetchMultipartMessage retrieves a single message previously sent to a room based on the options provided.
func (*Client) FetchMultipartMessages ¶
func (c *Client) FetchMultipartMessages( ctx context.Context, roomID string, options GetRoomMessagesOptions, ) ([]MultipartMessage, error)
FetchMultipartMessages retrieves messages previously sent to a room based on the options provided.
func (*Client) GenerateAccessToken ¶
GenerateAccessToken generates a JWT token based on the options provided.
func (*Client) GenerateSUToken ¶
GenerateSuToken generates a JWT token with the `su` claim.
func (*Client) GetPermissionsForGlobalRole ¶
func (c *Client) GetPermissionsForGlobalRole( ctx context.Context, roleName string, ) ([]string, error)
GetPermissionsForGlobalRole returns permissions associated with a previously created global role.
func (*Client) GetPermissionsForRoomRole ¶
func (c *Client) GetPermissionsForRoomRole( ctx context.Context, roleName string, ) ([]string, error)
GetPermissionsForRoomRole returns permissions associated with a previously created room role.
func (*Client) GetReadCursor ¶
GetReadCursor returns a single cursor that was set by a user in a room.
func (*Client) GetReadCursorsForRoom ¶
GetReadCursorsForRoom returns a list of cursors that have been set for a room. This returns cursors irrespective of the user that set them.
func (*Client) GetRoomMessages ¶
func (c *Client) GetRoomMessages( ctx context.Context, roomID string, options GetRoomMessagesOptions, ) ([]Message, error)
GetRoomMessages retrieves messages previously sent to a room based on the options provided.
func (*Client) GetRooms ¶
func (c *Client) GetRooms(ctx context.Context, options GetRoomsOptions) ([]core.RoomWithoutMembers, error)
GetRooms retrieves a list of rooms based on the options provided.
func (*Client) GetUserJoinableRooms ¶
GetUserJoinableRooms retrieves a list of rooms the use can join (not an existing member of) Private rooms are not returned as part of the response.
func (*Client) GetUserReadCursors ¶
GetUserReadCursors returns a list of cursors that have been set across different rooms for the user.
func (*Client) GetUserRoles ¶
GetUserRoles returns roles assosciated with a user.
func (*Client) GetUserRooms ¶
GetUserRooms retrieves a list of rooms the user is an existing member of.
func (*Client) GetUsersByID ¶
GetUsersByID retrieves a list of users for the given id's.
func (*Client) RemoveGlobalRoleForUser ¶
RemoveGlobalRoleForUser removes a previously assigned globally scoped role from a user. Users can only have one globall scoped role associated at any point.
func (*Client) RemoveRoomRoleForUser ¶
RemoveRoomRoleForUser removes a previously assigned room scoped role from a user. Users can have multiple room roles associated with them, but only one role per room.
func (*Client) RemoveUsersFromRoom ¶
RemoveUsersFromRoom removes existing members from a room.
func (*Client) SendMessage ¶
SendMessage publishes a new message to a room.
func (*Client) SendMultipartMessage ¶
func (c *Client) SendMultipartMessage( ctx context.Context, options SendMultipartMessageOptions, ) (uint, error)
SendMultipartMessage publishes a new multipart message to a room.
func (*Client) SendSimpleMessage ¶
func (c *Client) SendSimpleMessage( ctx context.Context, options SendSimpleMessageOptions, ) (uint, error)
SendSimpleMessage publishes a new simple multipart message to a room.
func (*Client) SetReadCursor ¶
func (c *Client) SetReadCursor(ctx context.Context, userID string, roomID string, position uint) error
SetReadCursor sets the cursor position for a room for a user. The position points to the message ID of a message that was sent to that room.
func (*Client) UpdatePermissionsForGlobalRole ¶
func (c *Client) UpdatePermissionsForGlobalRole( ctx context.Context, roleName string, options UpdateRolePermissionsOptions, ) error
UpdatePermissionsForGlobalRole allows adding or removing permissions from a previously created globally scoped role.
func (*Client) UpdatePermissionsForRoomRole ¶
func (c *Client) UpdatePermissionsForRoomRole( ctx context.Context, roleName string, options UpdateRolePermissionsOptions, ) error
UpdatePermissionsForRoomROle allows adding or removing permissions from a previously created room scoped role.
func (*Client) UpdateRoom ¶
UpdateRoom allows updating an existing room.
func (*Client) UpdateUser ¶
UpdateUser allows updating a previously created user.
type CreateRoleOptions ¶
type CreateRoleOptions = authorizer.CreateRoleOptions
type CreateRoomOptions ¶
type CreateRoomOptions = core.CreateRoomOptions
type CreateUserOptions ¶
type CreateUserOptions = core.CreateUserOptions
type DeleteMessageOptions ¶
type DeleteMessageOptions = core.DeleteMessageOptions
type EditMessageOptions ¶
type EditMessageOptions = core.EditMessageOptions
type EditMultipartMessageOptions ¶
type EditMultipartMessageOptions = core.EditMultipartMessageOptions
type EditSimpleMessageOptions ¶
type EditSimpleMessageOptions = core.EditSimpleMessageOptions
type ErrorResponse ¶
type ErrorResponse = platformclient.ErrorResponse
type FetchMultipartMessageOptions ¶
type FetchMultipartMessageOptions = core.FetchMultipartMessageOptions
type FetchMultipartMessagesOptions ¶
type FetchMultipartMessagesOptions = core.FetchMultipartMessagesOptions
type GetRoomMessagesOptions ¶
type GetRoomMessagesOptions = core.GetRoomMessagesOptions
type GetRoomsOptions ¶
type GetRoomsOptions = core.GetRoomsOptions
type GetUsersOptions ¶
type GetUsersOptions = core.GetUsersOptions
type MultipartMessage ¶
type MultipartMessage = core.MultipartMessage
type NewAttachmentPart ¶
type NewAttachmentPart = core.NewAttachmentPart
type NewInlinePart ¶
type NewInlinePart = core.NewInlinePart
type NewURLPart ¶
type NewURLPart = core.NewURLPart
type RequestOptions ¶
type RequestOptions = platformclient.RequestOptions
type Role ¶
type Role = authorizer.Role
type RoomWithoutMembers ¶
type RoomWithoutMembers = core.RoomWithoutMembers
type SendMessageOptions ¶
type SendMessageOptions = core.SendMessageOptions
type SendMultipartMessageOptions ¶
type SendMultipartMessageOptions = core.SendMultipartMessageOptions
type SendSimpleMessageOptions ¶
type SendSimpleMessageOptions = core.SendSimpleMessageOptions
type UpdateRolePermissionsOptions ¶
type UpdateRolePermissionsOptions = authorizer.UpdateRolePermissionsOptions
type UpdateRoomOptions ¶
type UpdateRoomOptions = core.UpdateRoomOptions
type UpdateUserOptions ¶
type UpdateUserOptions = core.UpdateUserOptions
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
authenticator
Package authenticator exposes an interface that performs authentication and authorization.
|
Package authenticator exposes an interface that performs authentication and authorization. |
authorizer
Package core expoeses the Authorizer API that allows making requests to the Chatkit Authorizer service.
|
Package core expoeses the Authorizer API that allows making requests to the Chatkit Authorizer service. |
common
Package common provides helpers that are shared across the other packages.
|
Package common provides helpers that are shared across the other packages. |
core
Package core exposes an interface that allows making requests to the core Chatkit API to allow operations to be performed against Users, Rooms and Messages.
|
Package core exposes an interface that allows making requests to the core Chatkit API to allow operations to be performed against Users, Rooms and Messages. |
cursors
Package cursors exposes an interface that allows making requests to the Chatkit cursors service.
|
Package cursors exposes an interface that allows making requests to the Chatkit cursors service. |