Documentation ¶
Index ¶
- Constants
- type Account
- type ChatWorkError
- type Client
- func (c *Client) ApproveIncomingRequests(requestID int) (incomingRequest IncomingRequest, err error)
- func (c *Client) Contacts() (contacts []Contact, err error)
- func (c *Client) CreateRoom(params map[string]string) ([]byte, error)
- func (c *Client) Delete(endpoint string, params map[string]string) ([]byte, error)
- func (c *Client) DeleteIncomingRequests(requestID int) error
- func (c *Client) DeleteInvitationLink(roomID string) (invitationLink InvitationLink, err error)
- func (c *Client) DeleteRoom(roomID string, params map[string]string) ([]byte, error)
- func (c *Client) DeleteRoomMessage(roomID, messageID string) ([]byte, error)
- func (c *Client) Get(endpoint string, params map[string]string) ([]byte, error)
- func (c *Client) GetIncomingRequests() (incomingRequests []IncomingRequest, err error)
- func (c *Client) GetInvitationLink(roomID string) (invitationLink InvitationLink, err error)
- func (c *Client) Me() (me Me, err error)
- func (c *Client) MyStatus() (status Status, err error)
- func (c *Client) MyTasks(params map[string]string) (tasks []MyTask, err error)
- func (c *Client) Post(endpoint string, params map[string]string) ([]byte, error)
- func (c *Client) PostInvitationLink(roomID, code, description string, needAcceptance bool) (invitationLink InvitationLink, err error)
- func (c *Client) PostRoomFile(roomID, message, fileName string, file io.Reader) ([]byte, error)
- func (c *Client) PostRoomMessage(roomID string, body string) ([]byte, error)
- func (c *Client) PostRoomTask(roomID string, params map[string]string) ([]byte, error)
- func (c *Client) Put(endpoint string, params map[string]string) ([]byte, error)
- func (c *Client) RateLimit() *RateLimit
- func (c *Client) Room(roomID string) (room Room, err error)
- func (c *Client) RoomFile(roomID, fileID string, params map[string]string) (file File, err error)
- func (c *Client) RoomFiles(roomID string, params map[string]string) (files []File, err error)
- func (c *Client) RoomMembers(roomID string) (members []Member, err error)
- func (c *Client) RoomMessage(roomID, messageID string) (message Message, err error)
- func (c *Client) RoomMessageMarkAsRead(roomID, messageID string) ([]byte, error)
- func (c *Client) RoomMessageMarkAsUnread(roomID, messageID string) ([]byte, error)
- func (c *Client) RoomMessages(roomID string, params map[string]string) (msgs Messages, err error)
- func (c *Client) RoomTask(roomID, taskID string) (task Task, err error)
- func (c *Client) RoomTasks(roomID string, params map[string]string) (tasks []Task, err error)
- func (c *Client) Rooms() (rooms []Room, err error)
- func (c *Client) UpdateInvitationLink(roomID, code, description string, needAcceptance bool) (invitationLink InvitationLink, err error)
- func (c *Client) UpdateRoom(roomID string, params map[string]string) ([]byte, error)
- func (c *Client) UpdateRoomMembers(roomID string, params map[string]string) ([]byte, error)
- func (c *Client) UpdateRoomMessage(roomID, messageID, body string) ([]byte, error)
- type Contact
- type File
- type HTTP
- type IncomingRequest
- type InvitationLink
- type Me
- type Member
- type Message
- type Messages
- type MyTask
- type RateLimit
- type Room
- type Status
- type Task
Constants ¶
const BaseURL = `https://api.chatwork.com/v2`
BaseURL ChatWork API endpooint URL
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { AccountID int `json:"account_id"` Name string `json:"name"` AvatarImageURL string `json:"avatar_image_url"` }
Account model
type ChatWorkError ¶
type ChatWorkError struct {
Errors []string `json:"errors"`
}
ChatWorkError is error model
type Client ¶
type Client struct { APIKey string BaseURL string HTTP HTTPClient *http.Client // contains filtered or unexported fields }
Client ChatWork HTTP client
func (*Client) ApproveIncomingRequests ¶
func (c *Client) ApproveIncomingRequests(requestID int) (incomingRequest IncomingRequest, err error)
ApproveIncomingRequests PUT "/incoming_requests/{request_id}"
func (*Client) CreateRoom ¶
CreateRoom POST "/rooms" params keys
- name
- members_admin_ids
- description
- icon_preset
- members_member_ids
- members_readonly_ids
func (*Client) DeleteIncomingRequests ¶
DeleteIncomingRequests DELETE "/incoming_requests/{request_id}"
func (*Client) DeleteInvitationLink ¶
func (c *Client) DeleteInvitationLink(roomID string) (invitationLink InvitationLink, err error)
DeleteInvitationLink DELETE "/rooms/{room_id}/link" params keys
- code
- description
- need_acceptance
func (*Client) DeleteRoom ¶
DeleteRoom DELETE "/rooms/{room_id}" params key
- action_type: [leave, delete]
func (*Client) DeleteRoomMessage ¶
DeleteRoomMessage DELETE "/rooms/{room_id}/messages/{message_id}"
func (*Client) GetIncomingRequests ¶
func (c *Client) GetIncomingRequests() (incomingRequests []IncomingRequest, err error)
GetIncomingRequests GET "/incoming_requests"
func (*Client) GetInvitationLink ¶
func (c *Client) GetInvitationLink(roomID string) (invitationLink InvitationLink, err error)
GetInvitationLink GET "/rooms/{room_id}/link"
func (*Client) MyTasks ¶
MyTasks GET "/my/tasks" params keys
- assigned_by_account_id
- status: [open, done]
func (*Client) PostInvitationLink ¶
func (c *Client) PostInvitationLink(roomID, code, description string, needAcceptance bool) (invitationLink InvitationLink, err error)
PostInvitationLink POST "/rooms/{room_id}/link" params keys
- code
- description
- need_acceptance
func (*Client) PostRoomFile ¶
PostRoomFile POST "/rooms/{room_id}/files"
func (*Client) PostRoomMessage ¶
PostRoomMessage POST "/rooms/{room_id}/messages"
func (*Client) PostRoomTask ¶
PostRoomTask POST "/rooms/{room_id}/tasks" params keys
- body
- to_ids
- limit
func (*Client) RoomFile ¶
RoomFile GET "/rooms/{room_id}/files/{file_id}" params key
- create_download_url: ["0", "1"]
func (*Client) RoomMembers ¶
RoomMembers GET "/rooms/{room_id}/members"
func (*Client) RoomMessage ¶
RoomMessage GET "/rooms/{room_id}/messages/{message_id}"
func (*Client) RoomMessageMarkAsRead ¶
RoomMessageMarkAsRead PUT "/rooms/{room_id}/messages/read"
func (*Client) RoomMessageMarkAsUnread ¶
RoomMessageMarkAsUnread PUT "/rooms/{room_id}/messages/unread"
func (*Client) RoomMessages ¶
RoomMessages GET "/rooms/{room_id}/messages"
func (*Client) RoomTasks ¶
RoomTasks GET "/rooms/{room_id}/tasks" params keys
- account_id
- assigned_by_account_id
- status: [open, done]
func (*Client) UpdateInvitationLink ¶
func (c *Client) UpdateInvitationLink(roomID, code, description string, needAcceptance bool) (invitationLink InvitationLink, err error)
UpdateInvitationLink PUT "/rooms/{room_id}/link" params keys
- code
- description
- need_acceptance
func (*Client) UpdateRoom ¶
UpdateRoom PUT "/rooms/{room_id}" params keys
- description
- icon_preset
- name
func (*Client) UpdateRoomMembers ¶
UpdateRoomMembers PUT "/rooms/{room_id}/members" params keys
- members_admin_ids
- members_member_ids
- members_readonly_ids
type Contact ¶
type Contact struct { AccountID int `json:"account_id"` RoomID int `json:"room_id"` Name string `json:"name"` ChatworkID string `json:"chatwork_id"` OrganizationID int `json:"organization_id"` OrganizationName string `json:"organization_name"` Department string `json:"department"` AvatarImageURL string `json:"avatar_image_url"` }
Contact model
type File ¶
type File struct { FileID int `json:"file_id"` Account Account `json:"account"` MessageID string `json:"message_id"` Filename string `json:"filename"` Filesize int `json:"filesize"` UploadTime int64 `json:"upload_time"` DownloadURL string `json:"download_url"` }
File model
func (File) UploadDate ¶
UploadDate time.Time representation of UploadTime
type HTTP ¶
type HTTP interface { Get() Post() Put() Delete() }
HTTP interface of HTTP METHODS's methods
type IncomingRequest ¶
type IncomingRequest struct { RequestID int `json:"request_id"` AccountID int `json:"account_id"` Message string `json:"message"` Name string `json:"name"` ChatworkID string `json:"chatwork_id"` OrganizationID string `json:"organization_id"` OrganizationName string `json:"organization_name"` Department string `json:"department"` AvatarImageUrl string `json:"avatar_image_url"` }
IncomingRequest model
type InvitationLink ¶
type InvitationLink struct { IsPublic bool `json:"public"` URL string `json:"url"` NeedAcceptance bool `json:"need_acceptance"` Description string `json:"description"` }
InvitationLink model
type Me ¶
type Me struct { AccountID int `json:"account_id"` RoomID int `json:"room_id"` Name string `json:"name"` ChatworkID string `json:"chatwork_id"` OrganizationID int `json:"organization_id"` OrganizationName string `json:"organization_name"` Department string `json:"department"` Title string `json:"title"` URL string `json:"url"` Introduction string `json:"introduction"` Mail string `json:"mail"` TelOrganization string `json:"tel_organization"` TelExtension string `json:"tel_extension"` TelMobile string `json:"tel_mobile"` Skype string `json:"skype"` Facebook string `json:"facebook"` Twitter string `json:"twitter"` AvatarImageURL string `json:"avatar_image_url"` LoginMail string `json:"login_mail"` }
Me model
type Member ¶
type Member struct { AccountID int `json:"account_id"` Role string `json:"role"` Name string `json:"name"` ChatworkID string `json:"chatwork_id"` OrganizationID int `json:"organization_id"` OrganizationName string `json:"organization_name"` Department string `json:"department"` AvatarImageURL string `json:"avatar_image_url"` }
Member model
type Message ¶
type Message struct { MessageID string `json:"message_id"` Account Account `json:"account"` Body string `json:"body"` SendTime int64 `json:"send_time"` UpdateTime int64 `json:"update_time"` }
Message model
func (Message) UpdateDate ¶
UpdateDate time.Time representation of UpdateTime
type MyTask ¶
type MyTask struct { Task Room struct { Roomid int `json:"room_id"` Name string `json:"name"` IconPath string `json:"icon_path"` } }
MyTask model
type Room ¶
type Room struct { RoomID int `json:"room_id"` Name string `json:"name"` Type string `json:"type"` Role string `json:"role"` Sticky bool `json:"sticky"` UnreadNum int `json:"unread_num"` MentionNum int `json:"mention_num"` MytaskNum int `json:"mytask_num"` MessageNum int `json:"message_num"` FileNum int `json:"file_num"` TaskNum int `json:"task_num"` IconPath string `json:"icon_path"` LastUpdateTime int64 `json:"last_update_time"` Description string `json:"description"` }
Room model
type Status ¶
type Status struct { UnreadRoomNum int `json:"unread_room_num"` MentionRoomNum int `json:"mention_room_num"` MytaskRoomNum int `json:"mytask_room_num"` UnreadNum int `json:"unread_num"` MentionNum int `json:"mention_num"` MyTaskNum int `json:"mytask_num"` }
Status model