client

package module
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block added in v0.2.9

type Block struct {
	Type   string `json:"type"`
	CallId string `json:"call_id"`
}

type Call added in v0.2.9

type Call struct {
	// Return-only
	Id string `json:"id"`

	// Required for requests
	ExternalUniqueId string `json:"external_unique_id"`
	JoinUrl          string `json:"join_url"`

	// Optional
	StartTimeUnix     int64  `json:"date_start"`
	DesktopAppJoinUrl string `json:"desktop_app_join_url"`
	ExternalDisplayId string `json:"external_display_id"`
	Title             string `json:"title"`
}

Call is used for calls.add requests, and also part of the CallResponse.

func (Call) URL added in v0.2.9

func (r Call) URL() string

func (Call) Verb added in v0.2.9

func (r Call) Verb() string

type CallEnd added in v0.2.9

type CallEnd struct {
	Id string `json:"id"`
}

calls.end Request. Uses GenericResponse.

func (CallEnd) URL added in v0.2.9

func (r CallEnd) URL() string

func (CallEnd) Verb added in v0.2.9

func (r CallEnd) Verb() string

type CallResponse added in v0.2.9

type CallResponse struct {
	Ok      bool   `json:"ok"`
	Call    Call   `json:"call"`
	Warning string `json:"warning"`
	Error   string `json:"error"`
}

type Channel

type Channel struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

type ChannelArchiveRequest

type ChannelArchiveRequest struct {
	ChannelId string `json:"channel"`
}

conversations.archive request. Uses GenericResponse.

func (ChannelArchiveRequest) URL

func (r ChannelArchiveRequest) URL() string

func (ChannelArchiveRequest) Verb

func (r ChannelArchiveRequest) Verb() string

type ChannelListRequest

type ChannelListRequest struct {
	Cursor string
}

conversations.List request. Uses ChannelListResponse.

func (ChannelListRequest) URL

func (r ChannelListRequest) URL() string

func (ChannelListRequest) Verb

func (r ChannelListRequest) Verb() string

type ChannelListResponse

type ChannelListResponse struct {
	Ok       bool             `json:"ok"`
	Channels []Channel        `json:"channels"`
	Metadata ResponseMetadata `json:"response_metadata"`
	Warning  string           `json:"warning"`
	Error    string           `json:"error"`
}

type ChannelResponse

type ChannelResponse struct {
	Ok      bool    `json:"ok"`
	Channel Channel `json:"channel"`

	Error       string `json:"error"`
	ErrorDetail string `json:"detail"`
	Warning     string `json:"warning"`
}

type ChannelSetTopicRequest added in v0.9.0

type ChannelSetTopicRequest struct {
	ChannelId string `json:"channel"`
	Topic     string `json:"topic"`
}

conversations.setTopic request. Uses GenericResponse.

func (ChannelSetTopicRequest) URL added in v0.9.0

func (ChannelSetTopicRequest) Verb added in v0.9.0

func (r ChannelSetTopicRequest) Verb() string

type Client added in v0.9.0

type Client interface {
	// Execute makes an HTTP request with the given Request,
	// and populates resp with the JSON response.
	// Returns the raw response text, and an error (nil on success).
	Execute(req Request, resp interface{}) (string, error)
}

func NewClient added in v0.9.0

func NewClient(token string) Client

func NewClientWithHttpClient added in v0.9.0

func NewClientWithHttpClient(httpClient HttpClientInterface, token string) Client

type ClientImpl added in v0.9.0

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

func (ClientImpl) Execute added in v0.9.0

func (c ClientImpl) Execute(req Request, resp interface{}) (string, error)

Populates resp, returns the raw json string and an error.

type ConversationInvite

type ConversationInvite struct {
	ChannelId string   `json:"channel"`
	Users     []string `json:"users"`
}

conversations.invite request. Uses ChannelResponse.

func (ConversationInvite) URL

func (r ConversationInvite) URL() string

func (ConversationInvite) Verb

func (r ConversationInvite) Verb() string

type CreateChannelRequest

type CreateChannelRequest struct {
	Name string `json:"name"`
}

conversations.create request. Uses ChannelResponse.

func (CreateChannelRequest) URL

func (r CreateChannelRequest) URL() string

func (CreateChannelRequest) Verb

func (r CreateChannelRequest) Verb() string

type GenericResponse

type GenericResponse struct {
	Ok      bool   `json:"ok"`
	Warning string `json:"warning"`
	Error   string `json:"error"`
}

GenericResponse represents a generic response for methods that don't return more specific information.

type HttpClientInterface added in v0.9.0

type HttpClientInterface interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient interface, this is implemented by http.Client

type PostMessageRequest

type PostMessageRequest struct {
	ChannelId string  `json:"channel"`
	Text      string  `json:"text"`
	Blocks    []Block `json:"blocks"`
}

chat.postMessage request. Uses GenericResponse.

func (PostMessageRequest) URL

func (r PostMessageRequest) URL() string

func (PostMessageRequest) Verb

func (r PostMessageRequest) Verb() string

type Request

type Request interface {
	URL() string
	Verb() string
}

type ResponseMetadata

type ResponseMetadata struct {
	// NextCursor is used by paginating methods.
	NextCursor string `json:"next_cursor"`
}

type User

type User struct {
	Id      string `json:"id"`
	Name    string `json:"name"`
	Deleted bool   `json:"deleted"`
	IsBot   bool   `json:"is_bot"`
}

type UsersListRequest

type UsersListRequest struct {
	// These don't encode to JSON, since this isn't a POST request.
	Cursor string
	Limit  string
}

users.list request. Uses UsersListResponse.

func (UsersListRequest) URL

func (r UsersListRequest) URL() string

func (UsersListRequest) Verb

func (r UsersListRequest) Verb() string

type UsersListResponse

type UsersListResponse struct {
	Ok       bool             `json:"ok"`
	Members  []User           `json:"members"`
	Metadata ResponseMetadata `json:"response_metadata"`

	Error       string `json:"error"`
	ErrorDetail string `json:"detail"`
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL