Documentation ¶
Overview ¶
Package openapi implements BearyChat's OpenAPI methods.
For full api doc, please visit https://github.com/bearyinnovative/OpenAPI
Usage:
import "github.com/bearyinnovative/bearychat-go/openapi"
API methods are bound to a API client. To construct a new client:
client := openapi.NewClient(token)
API methods are grouped by "namespace":
team, _, err := client.Team.Info()
Index ¶
- Variables
- func CheckResponse(r *http.Response) error
- func NewClientWithBaseURL(u *url.URL) clientOpt
- func NewClientWithHTTPClient(httpClient *http.Client) clientOpt
- type Channel
- type ChannelArchiveOptions
- type ChannelCreateOptions
- type ChannelInfoOptions
- type ChannelInviteOptions
- type ChannelJoinOptions
- type ChannelKickOptions
- type ChannelLeaveOptions
- type ChannelService
- func (c *ChannelService) Archive(ctx context.Context, opt *ChannelArchiveOptions) (*Channel, *http.Response, error)
- func (c *ChannelService) Create(ctx context.Context, opt *ChannelCreateOptions) (*Channel, *http.Response, error)
- func (c *ChannelService) Info(ctx context.Context, opt *ChannelInfoOptions) (*Channel, *http.Response, error)
- func (c *ChannelService) Invite(ctx context.Context, opt *ChannelInviteOptions) (*ResponseNoContent, *http.Response, error)
- func (c *ChannelService) Join(ctx context.Context, opt *ChannelJoinOptions) (*Channel, *http.Response, error)
- func (c *ChannelService) Kick(ctx context.Context, opt *ChannelKickOptions) (*ResponseNoContent, *http.Response, error)
- func (c *ChannelService) Kickout(ctx context.Context, opt *ChannelKickOptions) (*ResponseNoContent, *http.Response, error)
- func (c *ChannelService) Leave(ctx context.Context, opt *ChannelLeaveOptions) (*ResponseNoContent, *http.Response, error)
- func (c *ChannelService) List(ctx context.Context) ([]*Channel, *http.Response, error)
- func (c *ChannelService) Unarchive(ctx context.Context, opt *ChannelUnarchiveOptions) (*Channel, *http.Response, error)
- type ChannelUnarchiveOptions
- type Client
- type Emoji
- type EmojiService
- type ErrorResponse
- type Message
- type MessageAttachment
- type MessageAttachmentImage
- type MessageCreateOptions
- type MessageDeleteOptions
- type MessageForwardOptions
- type MessageInfoOptions
- type MessageKey
- type MessagePin
- type MessagePinCreateOptions
- type MessagePinDeleteOptions
- type MessagePinListOptions
- type MessagePinService
- func (m *MessagePinService) Create(ctx context.Context, opt *MessagePinCreateOptions) (*MessagePin, *http.Response, error)
- func (m *MessagePinService) Delete(ctx context.Context, opt *MessagePinDeleteOptions) (*ResponseNoContent, *http.Response, error)
- func (m *MessagePinService) List(ctx context.Context, opt *MessagePinListOptions) ([]*MessagePin, *http.Response, error)
- type MessageQuery
- type MessageQueryByLatest
- type MessageQueryBySince
- type MessageQueryByWindow
- type MessageQueryOptions
- type MessageQueryResult
- type MessageService
- func (m *MessageService) Create(ctx context.Context, opt *MessageCreateOptions) (*Message, *http.Response, error)
- func (m *MessageService) Delete(ctx context.Context, opt *MessageDeleteOptions) (*ResponseNoContent, *http.Response, error)
- func (m *MessageService) Forward(ctx context.Context, opt *MessageForwardOptions) (*Message, *http.Response, error)
- func (m *MessageService) Info(ctx context.Context, opt *MessageInfoOptions) (*Message, *http.Response, error)
- func (m *MessageService) Query(ctx context.Context, opt *MessageQueryOptions) (*MessageQueryResult, *http.Response, error)
- func (m *MessageService) UpdateText(ctx context.Context, opt *MessageUpdateTextOptions) (*Message, *http.Response, error)
- type MessageSubtype
- type MessageUpdateTextOptions
- type Meta
- type MetaService
- type P2P
- type P2PCreateOptions
- type P2PInfoOptions
- type P2PService
- type RTMService
- type RTMStart
- type Reaction
- type Repost
- type ResponseNoContent
- type ResponseOK
- type SessionChannel
- type SessionChannelArchiveOptions
- type SessionChannelConvertOptions
- type SessionChannelCreateOptions
- type SessionChannelInfoOptions
- type SessionChannelInviteOptions
- type SessionChannelKickOptions
- type SessionChannelLeaveOptions
- type SessionChannelService
- func (s *SessionChannelService) Archive(ctx context.Context, opt *SessionChannelArchiveOptions) (*SessionChannel, *http.Response, error)
- func (s *SessionChannelService) ConvertToChannel(ctx context.Context, opt *SessionChannelConvertOptions) (*Channel, *http.Response, error)
- func (s *SessionChannelService) Create(ctx context.Context, opt *SessionChannelCreateOptions) (*SessionChannel, *http.Response, error)
- func (s *SessionChannelService) Info(ctx context.Context, opt *SessionChannelInfoOptions) (*SessionChannel, *http.Response, error)
- func (s *SessionChannelService) Invite(ctx context.Context, opt *SessionChannelInviteOptions) (*ResponseNoContent, *http.Response, error)
- func (s *SessionChannelService) Kick(ctx context.Context, opt *SessionChannelKickOptions) (*ResponseNoContent, *http.Response, error)
- func (s *SessionChannelService) Leave(ctx context.Context, opt *SessionChannelLeaveOptions) (*ResponseNoContent, *http.Response, error)
- func (s *SessionChannelService) List(ctx context.Context) ([]*SessionChannel, *http.Response, error)
- type Sticker
- type StickerPack
- type StickerService
- type Team
- type TeamPlan
- type TeamService
- type Time
- type User
- type UserAvatar
- type UserInfoOptions
- type UserProfile
- type UserRole
- type UserService
- type UserType
- type VChannelTS
- type VChannelType
Constants ¶
This section is empty.
Variables ¶
var ( // Shorthand function for passing limit value as pointer. MessageQueryWithLimit = uintp // Shorthand function for passing forward value as pointer. MessageQueryWithForward = uintp // Shorthand function for passing backward value as pointer. MessageQueryWithBackward = uintp )
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present.
func NewClientWithBaseURL ¶
NewClientWithBaseURL binds BaseURL to client.
func NewClientWithHTTPClient ¶
NewClientWithHTTPClient binds http client to client.
Types ¶
type Channel ¶
type Channel struct { ID *string `json:"id,omitempty"` TeamID *string `json:"team_id,omitempty"` VChannelID *string `json:"vchannel_id,omitempty"` UserID *string `json:"uid,omitempty"` Name *string `json:"name,omitempty"` Type *VChannelType `json:"type,omitempty"` Private *bool `json:"private,omitempty"` General *bool `json:"general,omitempty"` Topic *string `json:"topic,omitempty"` IsMember *bool `json:"is_member,omitempty"` IsActive *bool `json:"is_active,omitempty"` MemberUserIDs []string `json:"member_uids,omitempty"` LatestTS *VChannelTS `json:"latest_ts,omitempty"` }
type ChannelArchiveOptions ¶
type ChannelArchiveOptions struct {
ChannelID string `json:"channel_id"`
}
type ChannelCreateOptions ¶
type ChannelInfoOptions ¶
type ChannelInfoOptions struct {
ChannelID string
}
type ChannelInviteOptions ¶
type ChannelJoinOptions ¶
type ChannelJoinOptions struct {
ChannelID string `json:"channel_id"`
}
type ChannelKickOptions ¶
type ChannelLeaveOptions ¶
type ChannelLeaveOptions struct {
ChannelID string `json:"channel_id"`
}
type ChannelService ¶
type ChannelService service
func (*ChannelService) Archive ¶
func (c *ChannelService) Archive(ctx context.Context, opt *ChannelArchiveOptions) (*Channel, *http.Response, error)
Archive implements `POST /channel.archive`
func (*ChannelService) Create ¶
func (c *ChannelService) Create(ctx context.Context, opt *ChannelCreateOptions) (*Channel, *http.Response, error)
Create implements `POST /channel.create`
func (*ChannelService) Info ¶
func (c *ChannelService) Info(ctx context.Context, opt *ChannelInfoOptions) (*Channel, *http.Response, error)
Info implements `GET /channel.info`
func (*ChannelService) Invite ¶
func (c *ChannelService) Invite(ctx context.Context, opt *ChannelInviteOptions) (*ResponseNoContent, *http.Response, error)
Invite implements `POST /channel.invite`
func (*ChannelService) Join ¶
func (c *ChannelService) Join(ctx context.Context, opt *ChannelJoinOptions) (*Channel, *http.Response, error)
Join implements `POST /channel.join`
func (*ChannelService) Kick ¶
func (c *ChannelService) Kick(ctx context.Context, opt *ChannelKickOptions) (*ResponseNoContent, *http.Response, error)
Kick implements `POST /channel.kick`
func (*ChannelService) Kickout ¶
func (c *ChannelService) Kickout(ctx context.Context, opt *ChannelKickOptions) (*ResponseNoContent, *http.Response, error)
Kickout implements `POST /channel.kickout`
func (*ChannelService) Leave ¶
func (c *ChannelService) Leave(ctx context.Context, opt *ChannelLeaveOptions) (*ResponseNoContent, *http.Response, error)
Leave implements `POST /channel.leave`
func (*ChannelService) Unarchive ¶
func (c *ChannelService) Unarchive(ctx context.Context, opt *ChannelUnarchiveOptions) (*Channel, *http.Response, error)
Unarchive implements `POST /channel.unarchive`
type ChannelUnarchiveOptions ¶
type ChannelUnarchiveOptions struct {
ChannelID string `json:"channel_id"`
}
type Client ¶
type Client struct { // Base URL for API requests. Defaults to BearyChat's OpenAPI host. // BaseURL should always be specified with a trailing slash. BaseURL *url.URL // Access token for the client. Token string Meta *MetaService Team *TeamService User *UserService Channel *ChannelService SessionChannel *SessionChannelService Message *MessageService P2P *P2PService Emoji *EmojiService Sticker *StickerService RTM *RTMService MessagePin *MessagePinService // contains filtered or unexported fields }
Client interacts with BearyChat's API.
type EmojiService ¶
type EmojiService service
type ErrorResponse ¶
type ErrorResponse struct { // HTTP response that caused this error Response *http.Response ErrorCode int `json:"code"` ErrorReason string `json:"error"` }
ErrorResponse represents errors caused by an API request.
func (ErrorResponse) Error ¶
func (r ErrorResponse) Error() string
type Message ¶
type Message struct { Repost *Repost `json:"repost,omitempty"` Key *MessageKey `json:"key,omitempty"` Updated *Time `json:"updated,omitempty"` UID *string `json:"uid,omitempty"` Created *Time `json:"created,omitempty"` VchannelID *string `json:"vchannel_id,omitempty"` ReferKey *string `json:"refer_key,omitempty"` RobotID *string `json:"robot_id,omitempty"` Edited *bool `json:"edited,omitempty"` CreatedTS *VChannelTS `json:"created_ts,omitempty"` PinID *string `json:"pin_id,omitempty"` StarID *string `json:"star_id,omitempty"` ID *string `json:"id,omitempty"` TeamID *string `json:"team_id,omitempty"` TextI18n *map[string]string `json:"text_i18n,omitempty"` Reactions []Reaction `json:"reactions,omitempty"` Subtype *MessageSubtype `json:"subtype,omitempty"` Text *string `json:"text,omitempty"` DisableMarkdown *bool `json:"disable_markdown,omitempty"` }
type MessageAttachment ¶
type MessageAttachment struct { Title *string `json:"title,omitempty"` Text *string `json:"text,omitempty"` Color *string `json:"color,omitempty"` Images []MessageAttachmentImage `json:"images,omitempty"` }
type MessageAttachmentImage ¶
type MessageAttachmentImage struct {
Url *string `json:"url,omitempty"`
}
type MessageCreateOptions ¶
type MessageCreateOptions struct { VChannelID string `json:"vchannel_id"` Text string `json:"text"` Attachments []MessageAttachment `json:"attachments"` }
type MessageDeleteOptions ¶
type MessageDeleteOptions struct { VChannelID string `json:"vchannel_id"` Key MessageKey `json:"message_key"` }
type MessageForwardOptions ¶
type MessageForwardOptions struct { VChannelID string `json:"vchannel_id"` Key MessageKey `json:"message_key"` ToVChannelID string `json:"to_vchannel_id"` }
type MessageInfoOptions ¶
type MessageInfoOptions struct { VChannelID string Key MessageKey }
type MessageKey ¶
type MessageKey string
type MessagePin ¶
type MessagePin struct { ID *string `json:"id,omitempty"` TeamID *string `json:"team_id,omitempty"` UID *string `json:"uid,omitempty"` VchannelID *string `json:"vchannel_id,omitempty"` MessageID *string `json:"message_id,omitempty"` MessageKey *MessageKey `json:"message_key,omitempty"` CreatedAt *Time `json:"create_at,omitempty"` UpdatedAt *Time `json:"update_at,omitempty"` }
type MessagePinCreateOptions ¶
type MessagePinCreateOptions struct { VChannelID string `json:"vchannel_id"` MessageKey MessageKey `json:"message_key"` }
type MessagePinDeleteOptions ¶
type MessagePinListOptions ¶
type MessagePinListOptions struct {
VChannelID string `json:"vchannel_id"`
}
type MessagePinService ¶
type MessagePinService service
func (*MessagePinService) Create ¶
func (m *MessagePinService) Create(ctx context.Context, opt *MessagePinCreateOptions) (*MessagePin, *http.Response, error)
Create implements `POST /message_pin.create`
func (*MessagePinService) Delete ¶
func (m *MessagePinService) Delete(ctx context.Context, opt *MessagePinDeleteOptions) (*ResponseNoContent, *http.Response, error)
Delete implements `POST /message_pin.delete`
func (*MessagePinService) List ¶
func (m *MessagePinService) List(ctx context.Context, opt *MessagePinListOptions) ([]*MessagePin, *http.Response, error)
List implements `GET /message_pin.list`
type MessageQuery ¶
type MessageQuery struct { Latest *MessageQueryByLatest `json:"latest,omitempty"` Since *MessageQueryBySince `json:"since,omitempty"` Window *MessageQueryByWindow `json:"window,omitempty"` }
TODO(hbc): introduce a query builder or map literal
type MessageQueryByLatest ¶
type MessageQueryByLatest struct {
Limit *uint `json:"limit,omitempty"`
}
type MessageQueryBySince ¶
type MessageQueryBySince struct { SinceKey *MessageKey `json:"key,omitempty"` SinceTS *VChannelTS `json:"ts,omitempty"` Forward *uint `json:"forward,omitempty"` Backward *uint `json:"backward,omitempty"` }
type MessageQueryByWindow ¶
type MessageQueryByWindow struct { FromKey *MessageKey `json:"from_key,omitempty"` ToKey *MessageKey `json:"to_key,omitempty"` FromTS *VChannelTS `json:"from_ts,omitempty"` ToTS *VChannelTS `json:"to_ts,omitempty"` Forward *uint `json:"forward,omitempty"` Backward *uint `json:"backward,omitempty"` }
type MessageQueryOptions ¶
type MessageQueryOptions struct { VChannelID string `json:"vchannel_id"` Query *MessageQuery `json:"query"` }
type MessageQueryResult ¶
type MessageQueryResult struct {
Messages []*Message `json:"messages"`
}
type MessageService ¶
type MessageService service
func (*MessageService) Create ¶
func (m *MessageService) Create(ctx context.Context, opt *MessageCreateOptions) (*Message, *http.Response, error)
Create implements `POST /message.create`
func (*MessageService) Delete ¶
func (m *MessageService) Delete(ctx context.Context, opt *MessageDeleteOptions) (*ResponseNoContent, *http.Response, error)
Delete implements `POST /message.delete`
func (*MessageService) Forward ¶
func (m *MessageService) Forward(ctx context.Context, opt *MessageForwardOptions) (*Message, *http.Response, error)
Forward implements `POST /message.forward`
func (*MessageService) Info ¶
func (m *MessageService) Info(ctx context.Context, opt *MessageInfoOptions) (*Message, *http.Response, error)
Info implements `GET /message.info`
func (*MessageService) Query ¶
func (m *MessageService) Query(ctx context.Context, opt *MessageQueryOptions) (*MessageQueryResult, *http.Response, error)
Query implements `POST /message.query`
func (*MessageService) UpdateText ¶
func (m *MessageService) UpdateText(ctx context.Context, opt *MessageUpdateTextOptions) (*Message, *http.Response, error)
UpdateText implements `POST /message.update_text`
type MessageSubtype ¶
type MessageSubtype string
const ( MessageSubtypeNormal MessageSubtype = "normal" MessageSubtypeInfo = "info" )
type MessageUpdateTextOptions ¶
type MessageUpdateTextOptions struct { VChannelID string `json:"vchannel_id"` Key MessageKey `json:"message_key"` Text string `json:"text"` }
type MetaService ¶
type MetaService service
type P2P ¶
type P2P struct { ID *string `json:"id,omitempty"` TeamID *string `json:"team_id,omitempty"` VChannelID *string `json:"vchannel_id,omitempty"` Type *VChannelType `json:"type,omitempty"` IsActive *bool `json:"is_active"` IsMember *bool `json:"is_member,omitempty"` MemberUserIDs []string `json:"member_uids,omitempty"` LatestTS *VChannelTS `json:"latest_ts,omitempty"` }
type P2PCreateOptions ¶
type P2PCreateOptions struct {
UserID string `json:"user_id"`
}
type P2PInfoOptions ¶
type P2PInfoOptions struct {
ChannelID string
}
type P2PService ¶
type P2PService service
func (*P2PService) Create ¶
func (p *P2PService) Create(ctx context.Context, opt *P2PCreateOptions) (*P2P, *http.Response, error)
Create implements `POST /p2p.create`
func (*P2PService) Info ¶
func (p *P2PService) Info(ctx context.Context, opt *P2PInfoOptions) (*P2P, *http.Response, error)
Info implements `GET /p2p.info`
type RTMService ¶
type RTMService service
type Reaction ¶
type Reaction struct { CreatedTS *VChannelTS `json:"created_ts,omitempty"` Reaction *string `json:"reaction,omitempty"` UIDs []string `json:"uids,omitempty"` }
type Repost ¶
type Repost struct { UID *string `json:"uid,omitempty"` VchannelID *string `json:"vchannel_id,omitempty"` RobotID *string `json:"robot_id,omitempty"` CreatedTS *VChannelTS `json:"created_ts,omitempty"` MessageKey *MessageKey `json:"message_key,omitempty"` ID *string `json:"id,omitempty"` TeamID *string `json:"team_id,omitempty"` Subtype *MessageSubtype `json:"subtype,omitempty"` Text *string `json:"text,omitempty"` }
type ResponseNoContent ¶
type ResponseNoContent struct{}
type ResponseOK ¶
type ResponseOK struct {
Code *int `json:"code,omitempty"`
}
type SessionChannel ¶
type SessionChannel struct { ID *string `json:"id,omitempty"` TeamID *string `json:"team_id,omitempty"` VChannelID *string `json:"vchannel_id,omitempty"` Name *string `json:"name,omitempty"` Type *VChannelType `json:"type,omitempty"` IsMember *bool `json:"is_member,omitempty"` IsActive *bool `json:"is_active,omitempty"` MemberUserIDs []string `json:"member_uids,omitempty"` LatestTS *VChannelTS `json:"latest_ts,omitempty"` }
type SessionChannelArchiveOptions ¶
type SessionChannelArchiveOptions struct {
ChannelID string `json:"session_channel_id"`
}
type SessionChannelInfoOptions ¶
type SessionChannelInfoOptions struct {
ChannelID string
}
type SessionChannelLeaveOptions ¶
type SessionChannelLeaveOptions struct {
ChannelID string `json:"session_channel_id"`
}
type SessionChannelService ¶
type SessionChannelService service
func (*SessionChannelService) Archive ¶
func (s *SessionChannelService) Archive(ctx context.Context, opt *SessionChannelArchiveOptions) (*SessionChannel, *http.Response, error)
Archive implements `POST /session_channel.archive`
func (*SessionChannelService) ConvertToChannel ¶
func (s *SessionChannelService) ConvertToChannel(ctx context.Context, opt *SessionChannelConvertOptions) (*Channel, *http.Response, error)
ConvertToChannel implements `POST /session_channel.convert_to_channel`
func (*SessionChannelService) Create ¶
func (s *SessionChannelService) Create(ctx context.Context, opt *SessionChannelCreateOptions) (*SessionChannel, *http.Response, error)
Create implements `POST /session_channel.create`
func (*SessionChannelService) Info ¶
func (s *SessionChannelService) Info(ctx context.Context, opt *SessionChannelInfoOptions) (*SessionChannel, *http.Response, error)
Info implements `GET /session_channel.info`
func (*SessionChannelService) Invite ¶
func (s *SessionChannelService) Invite(ctx context.Context, opt *SessionChannelInviteOptions) (*ResponseNoContent, *http.Response, error)
Invite implements `POST /session_channel.invite`
func (*SessionChannelService) Kick ¶
func (s *SessionChannelService) Kick(ctx context.Context, opt *SessionChannelKickOptions) (*ResponseNoContent, *http.Response, error)
Kick implements `POST /session_channel.kick`
func (*SessionChannelService) Leave ¶
func (s *SessionChannelService) Leave(ctx context.Context, opt *SessionChannelLeaveOptions) (*ResponseNoContent, *http.Response, error)
Leave implements `POST /session_channel.leave`
func (*SessionChannelService) List ¶
func (s *SessionChannelService) List(ctx context.Context) ([]*SessionChannel, *http.Response, error)
List implements `GET /session_channel.list`
type StickerPack ¶
type StickerService ¶
type StickerService service
func (*StickerService) List ¶
func (s *StickerService) List(ctx context.Context) ([]*StickerPack, *http.Response, error)
List implements `GET /sticker.list`
type Team ¶
type Team struct { ID *string `json:"id,omitempty"` Subdomain *string `json:"subdomain,omitempty"` Name *string `json:"name,omitempty"` EmailDomain *string `json:"email_domain,omitempty"` LogoURL *string `json:"logo_url,omitempty"` Description *string `json:"description,omitempty"` Plan *TeamPlan `json:"plan,omitempty"` Created *Time `json:"created,omitempty"` }
type TeamService ¶
type TeamService service
type User ¶
type User struct { ID *string `json:"id,omitempty"` TeamID *string `json:"team_id,omitempty"` Email *string `json:"email,omitempty"` Name *string `json:"name,omitempty"` FullName *string `json:"full_name,omitempty"` Type *UserType `json:"type,omitempty"` Role *UserRole `json:"role,omitempty"` Avatars *UserAvatar `json:"avatars,omitempty"` Profile *UserProfile `json:"profile,omitempty"` Inactive *bool `json:"inactive,omitempty"` Created *Time `json:"created,omitempty"` }
type UserAvatar ¶
type UserInfoOptions ¶
type UserInfoOptions struct {
UserID string
}
type UserProfile ¶
type UserService ¶
type UserService service
func (*UserService) Info ¶
func (u *UserService) Info(ctx context.Context, opt *UserInfoOptions) (*User, *http.Response, error)
Info implements `GET /user.info`