Documentation ¶
Index ¶
- func DecodeResponse(target interface{}, res *http.Response) error
- func JSONReader(v interface{}) (io.Reader, error)
- func SendRequest(client *http.Client, req *http.Request) (*http.Response, error)
- type AddCommentRequest
- type AddHeaderTransport
- type Channel
- type Channels
- type ChannelsGetAllCall
- type ChannelsGetCall
- type ChannelsService
- type Comment
- type Comments
- type CommentsAddCall
- type CommentsGetAllCall
- type CommentsGetCall
- type CommentsRemoveCall
- type CommentsService
- func (r *CommentsService) Add(threadID int, addCommentRequest *AddCommentRequest) *CommentsAddCall
- func (r *CommentsService) Get(id int) *CommentsGetCall
- func (r *CommentsService) GetAll(threadID int, getAllCommentRequest *GetAllCommentRequest) *CommentsGetAllCall
- func (r *CommentsService) Remove(removeCommentRequest *RemoveCommentRequest) *CommentsRemoveCall
- func (r *CommentsService) Update(threadID int, updateCommentRequest *UpdateCommentRequest) *CommentsUpdateCall
- type CommentsUpdateCall
- type ErrorResponse
- type GetAllChannelRequest
- type GetAllCommentRequest
- type GetAllThreadRequest
- type GetChannelRequest
- type GetCommentRequest
- type GetThreadRequest
- type GetWorkspaceRequest
- type LoginUserRequest
- type LogoutUserResponse
- type RemoveCommentRequest
- type Service
- type Thread
- type Threads
- type ThreadsGetAllCall
- type ThreadsGetCall
- type ThreadsGetDefaultCall
- type ThreadsService
- type UpdateCommentRequest
- type User
- type Users
- type UsersCurrentSessionUserCall
- type UsersLoginCall
- type UsersLogoutCall
- type UsersService
- type Workspace
- type Workspaces
- type WorkspacesGetAllCall
- type WorkspacesGetCall
- type WorkspacesGetDefaultCall
- type WorkspacesGetUsersCall
- type WorkspacesService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeResponse ¶
DecodeResponse decodes the body of res into target. If there is no body, target is unchanged.
func JSONReader ¶
Types ¶
type AddCommentRequest ¶
type AddCommentRequest struct { // Required // The id of the thread. ThreadID int `json:"thread_id"` // Required // The content of the new comment. Mentions can be used as <twist-mention://user_id> or [Name](twist-mention://user_id) for a more verbose but safer way (the NAME is used in case the user is invalid somehow). Check limits for size restrictions for the content. Comment string `json:"comment"` // List of attachments to the new comment. It must follow the JSON format returned by attachment#upload. Attachments []interface{} `json:"attachments"` // An array of users (e.g. recipients: [10000, 10001]) to notify. It also accepts the strings EVERYONE or EVERYONE_IN_THREAD, which notifies everyone in the workspace or everyone mentioned in previous posts of this thread. If not provided, EVERYONE_IN_THREAD will be used. Recipients []int `json:"recipients"` // The groups that will be notified. Groups []int `json:"groups"` // The temporary id of the comment. TempID int `json:"temp_id"` // By default, the position of the thread is marked. MarkThreadPosition bool `json:"mark_thread_position"` // Displays the integration as the comment creator. SendAsIntegration bool `json:"send_as_integration"` }
type AddHeaderTransport ¶
type AddHeaderTransport struct { T http.RoundTripper // contains filtered or unexported fields }
func NewAddHeaderTransport ¶
func NewAddHeaderTransport(header string) *AddHeaderTransport
type Channel ¶
type Channel struct { // The id of the channel. ID int `json:"id"` // The name of the channel. Name string `json:"name"` // The description of the channel. Description string `json:"description"` // The user that created the channel. Creator int `json:"creator"` // The users that will participate in the channel. UserIds []int `json:"user_ids"` // The color of the channel. Color int `json:"color"` // If enabled, the channel will be marked as public. Public bool `json:"public"` // The id of the channel. ChannelID int `json:"channel_id"` // Whether the channel is archived. Archived bool `json:"archived"` // The Unix time when the channel was created. CreatedTs int `json:"created_ts"` }
type ChannelsGetAllCall ¶
type ChannelsGetAllCall struct {
// contains filtered or unexported fields
}
func (*ChannelsGetAllCall) Do ¶
func (c *ChannelsGetAllCall) Do() (*Channels, error)
type ChannelsGetCall ¶
type ChannelsGetCall struct {
// contains filtered or unexported fields
}
func (*ChannelsGetCall) Do ¶
func (c *ChannelsGetCall) Do() (*Channel, error)
type ChannelsService ¶
type ChannelsService struct {
// contains filtered or unexported fields
}
func NewChannelsService ¶
func NewChannelsService(s *Service) *ChannelsService
func (*ChannelsService) Get ¶
func (r *ChannelsService) Get(getChannelRequest *GetChannelRequest) *ChannelsGetCall
func (*ChannelsService) GetAll ¶
func (r *ChannelsService) GetAll(getAllChannelRequest *GetAllChannelRequest) *ChannelsGetAllCall
type Comment ¶
type Comment struct { // The id of the comment. ID int `json:"id"` // The content of the comment. Mentions can be used as <twist-mention://user_id> or [Name](twist-mention://user_id) for a more verbose but safer way (the NAME is used in case the user is invalid somehow). Check limits for size restrictions for the content. Content string `json:"content"` // The user that added the comment. Creator int `json:"creator"` // The id of the thread. ThreadID int `json:"thread_id"` // The id of the channel. ChannelID int `json:"channel_id"` // The id of the workspace. WorkspaceID int `json:"workspace_id"` // Files attached to the comment. ObjIndex int `json:"obj_index"` // Action buttons attached to the comment. Attachments []interface{} `json:"attachments"` // An array of users (e.g. recipients: [10000, 10001]) to notify. It also accepts the strings EVERYONE or EVERYONE_IN_THREAD, which notifies everyone in the workspace or everyone mentioned in previous posts of this thread. Recipients []int `json:"recipients"` // The groups that will be notified. Groups []interface{} `json:"groups"` // Reactions to the thread, where keys are the reactions and values the users that had that reaction. Reactions struct { NAMING_FAILED []int `json:"👍"` } `json:"reactions"` // Whether the thread is deleted. IsDeleted bool `json:"is_deleted"` // A system message. SystemMessage interface{} `json:"system_message"` // The Unix time when the thread was created. PostedTs int `json:"posted_ts"` // The Unix time when the comment was last edited or null if it hasn’t. LastEditedTs int `json:"last_edited_ts"` }
type CommentsAddCall ¶
type CommentsAddCall struct {
// contains filtered or unexported fields
}
func (*CommentsAddCall) Do ¶
func (c *CommentsAddCall) Do() (*Comments, error)
type CommentsGetAllCall ¶
type CommentsGetAllCall struct {
// contains filtered or unexported fields
}
func (*CommentsGetAllCall) Do ¶
func (c *CommentsGetAllCall) Do() (*Comments, error)
type CommentsGetCall ¶
type CommentsGetCall struct {
// contains filtered or unexported fields
}
func (*CommentsGetCall) Do ¶
func (c *CommentsGetCall) Do() (*Comment, error)
type CommentsRemoveCall ¶
type CommentsRemoveCall struct {
// contains filtered or unexported fields
}
func (*CommentsRemoveCall) Do ¶
func (c *CommentsRemoveCall) Do() (*Comments, error)
type CommentsService ¶
type CommentsService struct {
// contains filtered or unexported fields
}
func NewCommentsService ¶
func NewCommentsService(s *Service) *CommentsService
func (*CommentsService) Add ¶
func (r *CommentsService) Add(threadID int, addCommentRequest *AddCommentRequest) *CommentsAddCall
func (*CommentsService) Get ¶
func (r *CommentsService) Get(id int) *CommentsGetCall
func (*CommentsService) GetAll ¶
func (r *CommentsService) GetAll(threadID int, getAllCommentRequest *GetAllCommentRequest) *CommentsGetAllCall
func (*CommentsService) Remove ¶
func (r *CommentsService) Remove(removeCommentRequest *RemoveCommentRequest) *CommentsRemoveCall
func (*CommentsService) Update ¶
func (r *CommentsService) Update(threadID int, updateCommentRequest *UpdateCommentRequest) *CommentsUpdateCall
type CommentsUpdateCall ¶
type CommentsUpdateCall struct {
// contains filtered or unexported fields
}
func (*CommentsUpdateCall) Do ¶
func (c *CommentsUpdateCall) Do() (*Comments, error)
type ErrorResponse ¶
type ErrorResponse struct { ErrorUUID string `json:"error_uuid"` ErrorCode int `json:"error_code"` ErrorExtra interface{} `json:"error_extra"` ErrorString string `json:"error_string"` }
ref: https://developer.twist.com/v3/#errors
{ "error_uuid": "f699b0e0caa4446e847e17cc1d42801b", "error_code": 200, "error_extra": { }, "error_string": "Invalid token" }
func (*ErrorResponse) Error ¶
func (err *ErrorResponse) Error() string
type GetAllChannelRequest ¶
type GetAllCommentRequest ¶
type GetAllThreadRequest ¶
type GetAllThreadRequest struct { // Required // The id of the channel. ChannelID int `url:"channel_id"` // The id of the workspace. WorkspaceID int `url:"workspace_id,omitempty"` // A filter can be one of attached_to_me, everyone and is_starred. FilterBy string `url:"filter_by,omitempty"` // Limits threads to those newer when the specified Unix time. NewerThanTs int `url:"newer_than_ts,omitempty"` // Limits threads to those older when the specified Unix time. OlderThanTs int `url:"older_than_ts,omitempty"` // Limits the number of threads returned. Limit int `url:"limit,omitempty"` // If enabled, only the ids of the threads are returned. AsIDs bool `url:"as_ids,omitempty"` }
type GetChannelRequest ¶
type GetChannelRequest struct { // Required ID int `url:"id"` }
type GetCommentRequest ¶
type GetCommentRequest struct {
ID int `json:"id"`
}
type GetThreadRequest ¶
type GetThreadRequest struct {
ID int `json:"id"`
}
type GetWorkspaceRequest ¶
type GetWorkspaceRequest struct {
ID int `json:"id"`
}
type LoginUserRequest ¶
type LogoutUserResponse ¶
type LogoutUserResponse struct {
Status string `json:"status"`
}
type RemoveCommentRequest ¶
type RemoveCommentRequest struct { // Required // The id of the comment. ID int `json:"thread_id"` }
type Service ¶
type Service struct { BasePath string // API endpoint base URL Channels *ChannelsService Comments *CommentsService Threads *ThreadsService Users *UsersService Workspaces *WorkspacesService // contains filtered or unexported fields }
func NewService ¶
type Thread ¶
type Thread struct { // The id of the thread. ID int `json:"id"` // The title of the thread. Title string `json:"title"` // The content of the thread. Mentions can be used as <twist-mention://user_id> or [Name](twist-mention://user_id) for a more verbose but safer way (the NAME is used in case the user is invalid somehow). Check limits for size restrictions for the content. Content string `json:"content"` // Whether the thread is starred. Starred bool `json:"starred"` // The user that created the thread. Creator int `json:"creator"` // The id of the channel. ChannelID int `json:"channel_id"` // The id of the workspace. WorkspaceID int `json:"workspace_id"` // Files attached to the comment. Attachments []interface{} `json:"attachments"` // Action buttons attached to the comment. Actions []interface{} `json:"actions"` // An array of users (e.g. recipients: [10000, 10001]) who were notified in this thread or the string EVERYONE Recipients []int `json:"recipients"` // The users that were at some point attached to the thread or one of its comments. Participants []int `json:"participants"` // The groups that will be notified. Groups []interface{} `json:"groups"` // Reactions to the thread, where keys are the reactions and values the users that had that reaction. Reactions struct { } `json:"reactions"` // The number of comments. CommentCount int `json:"comment_count"` // The last comment’s index. LastObjIndex int `json:"last_obj_index"` // A part of the last comment. Snippet string `json:"snippet"` // The user id of the last comment. SnippetCreator int `json:"snippet_creator"` // The Unix time when the thread was last updated. LastUpdatedTs int `json:"last_updated_ts"` // The Unix time until when the thread is muted. MutedUntil interface{} `json:"muted_until"` // A system message. SystemMessage interface{} `json:"system_message"` // The Unix time when the thread was created. PostedTs int `json:"posted_ts"` // The Unix time when the thread was last edited or null if it hasn’t. LastEditedTs int `json:"last_edited_ts"` }
REF: https://developer.twist.com/v3/#threads Examples:
{ "id": 32038, "title": "Thread1", "content": "Let's discuss the Twist API...", "starred": false, "creator": 10073, "channel_id": 6984, "workspace_id": 5517, "attachments": [], "actions": [], "recipients": [ 10076 ], "participants": [ 10073, 10076 ], "groups": [], "reactions": {}, "comment_count": 3, "last_obj_index": 2, "snippet": "OK!", "snippet_creator": 10073, "last_updated_ts": 1494500713, "muted_until": null, "system_message": null, "posted_ts": 1494488709, "last_edited_ts": 1494488709 }
type ThreadsGetAllCall ¶
type ThreadsGetAllCall struct {
// contains filtered or unexported fields
}
func (*ThreadsGetAllCall) Do ¶
func (c *ThreadsGetAllCall) Do() (*Threads, error)
type ThreadsGetCall ¶
type ThreadsGetCall struct {
// contains filtered or unexported fields
}
func (*ThreadsGetCall) Do ¶
func (c *ThreadsGetCall) Do() (*Thread, error)
type ThreadsGetDefaultCall ¶
type ThreadsGetDefaultCall struct {
// contains filtered or unexported fields
}
func (*ThreadsGetDefaultCall) Do ¶
func (c *ThreadsGetDefaultCall) Do() (*Thread, error)
type ThreadsService ¶
type ThreadsService struct {
// contains filtered or unexported fields
}
func NewThreadsService ¶
func NewThreadsService(s *Service) *ThreadsService
func (*ThreadsService) Get ¶
func (r *ThreadsService) Get(id int) *ThreadsGetCall
func (*ThreadsService) GetAll ¶
func (r *ThreadsService) GetAll(getAllThreadRequest *GetAllThreadRequest) *ThreadsGetAllCall
func (*ThreadsService) GetDefault ¶
func (r *ThreadsService) GetDefault(id int) *ThreadsGetDefaultCall
type UpdateCommentRequest ¶
type UpdateCommentRequest struct { // Required // The id of the comment. ID int `json:"thread_id"` // The content of the comment. Mentions can be used as <twist-mention://user_id> or [Name](twist-mention://user_id) for a more verbose but safer way (the NAME is used in case the user is invalid somehow). Check limits for size restrictions for the content. Content string `json:"content"` // List of attachments to the new comment. It must follow the JSON format returned by attachment#upload. Attachments []interface{} `json:"attachments"` //List of action to the new comment. More information about the format of the object available at the add an action button submenu. Actions []interface{} `json:"actions"` }
type User ¶
type User struct { // The user’s avatar id. AvatarID string `json:"avatar_id"` // Away mode sets the user as away until some future date. AwayMode struct { // The start date of the away mode in a %Y-%m-%d format. The date_from parameter is inclusive. DateFrom string `json:"date_from"` // The end date of the away mode in a %Y-%m-%d format. The date_to parameter is exclusive, which means the user will start receiving notifications on this date. DateTo string `json:"date_to"` // The reason of being in away mode may be parental, vacation, sickleave, or other. Type string `json:"type"` } `json:"away_mode"` // Whether user is a bot. Bot bool `json:"bot"` // The user’s client id ClientID string `json:"client_id"` // The comet channel. CometChannel string `json:"comet_channel"` // The comet server. CometServer string `json:"comet_server"` // The user’s contact info. ContactInfo string `json:"contact_info"` // The user’s default workspace. DefaultWorkspace int64 `json:"default_workspace"` // The user’s email. Email string `json:"email"` // The user’s first name. FirstName string `json:"first_name"` // The id of the user. ID int64 `json:"id"` // The user’s language. Lang string `json:"lang"` // The user’s full name. Name string `json:"name"` // Sets the user’s off days (where they will get no notifications). It should be an array of integers representing ISO weekdays, e.g. 1 is Monday and 7 is Sunday. E.g. [6, 7]. OffDays []interface{} `json:"off_days"` // The user’s profession. Profession string `json:"profession"` // Whether the user has been removed. Removed bool `json:"removed"` // Whether the user is restricted. Restricted bool `json:"restricted"` // A list of banners to be shown to the user. ScheduledBanners []string `json:"scheduled_banners"` // Whether setup is pending. SetupPending bool `json:"setup_pending"` // The user’s short name. ShortName string `json:"short_name"` // Stop time of do-not-disturb snooze for notifications. SnoozeDndEnd interface{} `json:"snooze_dnd_end"` // Start time of do-not-disturb snooze for notifications. SnoozeDndStart interface{} `json:"snooze_dnd_start"` // Snooze notifications for the specified number of seconds. SnoozeUntil int64 `json:"snooze_until"` // Whether notifications are snoozed. Snoozed bool `json:"snoozed"` // The user’s timezone. Timezone string `json:"timezone"` // The user’s API token. Token string `json:"token"` }
REF: https://developer.twist.com/v3/#users
{ "scheduled_banners": [ "notification_permissions" ], "short_name": "User", "contact_info": "", "bot": false, "profession": "", "snooze_dnd_start": null, "client_id": "9ea8c3de-349e-11e7-976e-06b24c4507db", "timezone": "UTC", "removed": false, "avatar_id": "c5f14f4da3ee2479a26c65c630c21765", "id": 10073, "comet_channel": "10073-15c9c64dae211c526c77164d31dd5b6e9eabcdda", "lang": "en", "away_mode": { "date_from": "2018-08-09", "type": "other", "date_to": "2018-08-10" }, "first_name": "User", "comet_server": "https://comet.twist.com", "name": "User", "off_days": [], "restricted": false, "default_workspace": 5517, "token": "9b1bf97783c1ad5593dee12f3019079dbd3042cf", "snooze_dnd_end": null, "snoozed": false, "email": "user@example.com", "setup_pending": false, "snooze_until": -1 }
type UsersCurrentSessionUserCall ¶
type UsersCurrentSessionUserCall struct {
// contains filtered or unexported fields
}
func (*UsersCurrentSessionUserCall) Do ¶
func (c *UsersCurrentSessionUserCall) Do() (*User, error)
type UsersLoginCall ¶
type UsersLoginCall struct {
// contains filtered or unexported fields
}
func (*UsersLoginCall) Do ¶
func (c *UsersLoginCall) Do() (*User, error)
type UsersLogoutCall ¶
type UsersLogoutCall struct {
// contains filtered or unexported fields
}
func (*UsersLogoutCall) Do ¶
func (c *UsersLogoutCall) Do() (*LogoutUserResponse, error)
type UsersService ¶
type UsersService struct {
// contains filtered or unexported fields
}
func NewUsersService ¶
func NewUsersService(s *Service) *UsersService
func (*UsersService) CurrentSessionUser ¶
func (r *UsersService) CurrentSessionUser() *UsersCurrentSessionUserCall
func (*UsersService) Login ¶
func (r *UsersService) Login(loginUserRequest *LoginUserRequest) *UsersLoginCall
func (*UsersService) Logout ¶
func (r *UsersService) Logout() *UsersLogoutCall
type Workspace ¶
type Workspace struct { // The id of the workspace. ID int `json:"id"` // The name of the new workspace. Name string `json:"name"` // The color of the workspace. Color int `json:"color"` // The id of the default channel. DefaultChannel int `json:"default_channel"` // The id of the default conversation. DefaultConversation int `json:"default_conversation"` // The id of the user that created the workspace. Creator int `json:"creator"` // The Unix time when the workspace was created. CreatedTs int `json:"created_ts"` // The type of payment plan, either free or unlimited. Plan string `json:"plan"` }
REF: https://developer.twist.com/v3/#workspaces
{ "id": 5517, "name": "Workspace1", "color": 1, "default_channel": 6984, "default_conversation": 13030, "creator": 10073, "created_ts": 1494323073, "plan": "unlimited" }
type Workspaces ¶
type Workspaces []*Workspace
type WorkspacesGetAllCall ¶
type WorkspacesGetAllCall struct {
// contains filtered or unexported fields
}
func (*WorkspacesGetAllCall) Do ¶
func (c *WorkspacesGetAllCall) Do() (*Workspaces, error)
type WorkspacesGetCall ¶
type WorkspacesGetCall struct {
// contains filtered or unexported fields
}
func (*WorkspacesGetCall) Do ¶
func (c *WorkspacesGetCall) Do() (*Workspace, error)
type WorkspacesGetDefaultCall ¶
type WorkspacesGetDefaultCall struct {
// contains filtered or unexported fields
}
func (*WorkspacesGetDefaultCall) Do ¶
func (c *WorkspacesGetDefaultCall) Do() (*Workspace, error)
type WorkspacesGetUsersCall ¶
type WorkspacesGetUsersCall struct {
// contains filtered or unexported fields
}
func (*WorkspacesGetUsersCall) Do ¶
func (c *WorkspacesGetUsersCall) Do() (*Workspaces, error)
type WorkspacesService ¶
type WorkspacesService struct {
// contains filtered or unexported fields
}
func NewWorkspacesService ¶
func NewWorkspacesService(s *Service) *WorkspacesService
func (*WorkspacesService) Get ¶
func (r *WorkspacesService) Get(getWorkspaceRequest *GetWorkspaceRequest) *WorkspacesGetCall
func (*WorkspacesService) GetAll ¶
func (r *WorkspacesService) GetAll() *WorkspacesGetAllCall
func (*WorkspacesService) GetDefault ¶
func (r *WorkspacesService) GetDefault() *WorkspacesGetDefaultCall
func (*WorkspacesService) GetUsers ¶
func (r *WorkspacesService) GetUsers() *WorkspacesGetUsersCall
Source Files ¶
Click to show internal directories.
Click to hide internal directories.