cha

package module
v0.0.0-...-e3d6a32 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

README

cha

Chatwork API Client for Go🍵

Documentation

Index

Constants

View Source
const CHATWORK_API = "https://api.chatwork.com/v2/"

Variables

This section is empty.

Functions

func BuildBody

func BuildBody(params map[string]string) url.Values

func BuildURL

func BuildURL(endpoint *url.URL, params map[string]string) *url.URL

Types

type Client

type Client struct {
	APIKey     string
	BaseURL    *url.URL
	Debug      bool
	HTTPClient *http.Client
	Logger     *log.Logger
	// contains filtered or unexported fields
}

func NewClient

func NewClient(apiKey string) (*Client, error)

func (Client) Contacts

func (c Client) Contacts() ([]cw.Contact, error)

func (Client) ContactsContext

func (c Client) ContactsContext(ctx context.Context) (contacts []cw.Contact, err error)

func (Client) CreateRoom

func (c Client) CreateRoom(params map[string]string) ([]byte, error)

func (Client) CreateRoomContext

func (c Client) CreateRoomContext(ctx context.Context, params map[string]string) ([]byte, error)

func (Client) DeleteRoom

func (c Client) DeleteRoom(roomId string, params map[string]string) ([]byte, error)

func (Client) DeleteRoomContext

func (c Client) DeleteRoomContext(
	ctx context.Context,
	roomId string,
	params map[string]string,
) ([]byte, error)

func (Client) Me

func (c Client) Me() (me cw.Me, err error)

func (Client) MeContext

func (c Client) MeContext(ctx context.Context) (me cw.Me, err error)

func (Client) MyStatus

func (c Client) MyStatus() (cw.Status, error)

func (Client) MyStatusContext

func (c Client) MyStatusContext(ctx context.Context) (status cw.Status, err error)

func (Client) MyTasks

func (c Client) MyTasks(params map[string]string) ([]cw.MyTask, error)

func (Client) MyTasksContext

func (c Client) MyTasksContext(
	ctx context.Context,
	params map[string]string,
) (tasks []cw.MyTask, err error)

func (Client) PostRoomMessage

func (c Client) PostRoomMessage(roomId string, body string) ([]byte, error)

func (Client) PostRoomMessageContext

func (c Client) PostRoomMessageContext(
	ctx context.Context,
	roomId string,
	body string,
) ([]byte, error)

func (Client) PostRoomTask

func (c Client) PostRoomTask(roomId string, params map[string]string) ([]byte, error)

func (Client) PostRoomTaskContext

func (c Client) PostRoomTaskContext(
	ctx context.Context,
	roomId string,
	params map[string]string,
) ([]byte, error)

func (Client) RateLimit

func (c Client) RateLimit() *RateLimit

func (Client) RoomFileContext

func (c Client) RoomFileContext(
	ctx context.Context,
	roomId, fileId string,
	params map[string]string,
) (file cw.File, err error)

func (Client) RoomFiles

func (c Client) RoomFiles(roomId string, params map[string]string) ([]cw.File, error)

func (Client) RoomFilesContext

func (c Client) RoomFilesContext(
	ctx context.Context,
	roomId string,
	params map[string]string,
) (files []cw.File, err error)

func (Client) RoomMembers

func (c Client) RoomMembers(roomId string) ([]cw.Member, error)

func (Client) RoomMembersContext

func (c Client) RoomMembersContext(
	ctx context.Context,
	roomId string,
) (members []cw.Member, err error)

func (Client) RoomMessage

func (c Client) RoomMessage(roomId, messageId string) (Message, error)

func (Client) RoomMessageContext

func (c Client) RoomMessageContext(
	ctx context.Context,
	roomId, messageId string,
) (msg Message, err error)

func (Client) RoomMessages

func (c Client) RoomMessages(roomId string, params map[string]string) ([]Message, error)

func (Client) RoomMessagesContext

func (c Client) RoomMessagesContext(
	ctx context.Context,
	roomId string,
	params map[string]string,
) (msgs []Message, err error)

func (Client) RoomTask

func (c Client) RoomTask(roomId, taskId string) (Task, error)

func (Client) RoomTaskContext

func (c Client) RoomTaskContext(ctx context.Context, roomId, taskId string) (task Task, err error)

func (Client) RoomTasks

func (c Client) RoomTasks(roomId string, params map[string]string) ([]Task, error)

func (Client) RoomTasksContext

func (c Client) RoomTasksContext(
	ctx context.Context,
	roomId string,
	params map[string]string,
) (tasks []Task, err error)

func (Client) Rooms

func (c Client) Rooms() ([]cw.Room, error)

func (Client) RoomsContext

func (c Client) RoomsContext(ctx context.Context) (rooms []cw.Room, err error)

func (*Client) SetBaseURL

func (c *Client) SetBaseURL(baseURL string) (err error)

func (Client) UpdateRoom

func (c Client) UpdateRoom(roomId string, params map[string]string) ([]byte, error)

func (Client) UpdateRoomContext

func (c Client) UpdateRoomContext(
	ctx context.Context,
	roomId string,
	params map[string]string,
) ([]byte, error)

func (Client) UpdateRoomMembers

func (c Client) UpdateRoomMembers(roomId string, params map[string]string) ([]byte, error)

func (Client) UpdateRoomMembersContext

func (c Client) UpdateRoomMembersContext(
	ctx context.Context,
	roomId string,
	params map[string]string,
) ([]byte, error)

type File

type File struct {
	FileID      int        `json:"file_id"`
	Account     cw.Account `json:"account"`
	MessageID   string     `json:"message_id"`
	Filename    string     `json:"filename"`
	Filesize    int        `json:"filesize"`
	UploadTime  time.Time  `json:"upload_time"`
	DownloadURL *url.URL   `json:"download_url"`
}

func (*File) UnmarshalJSON

func (f *File) UnmarshalJSON(data []byte) error

type HTTPHeader

type HTTPHeader interface {
	Get(string) string
}

type Message

type Message struct {
	MessageID  string     `json:"message_id"`
	Account    cw.Account `json:"account"`
	Body       string     `json:"body"`
	SendTime   time.Time  `json:"send_time"`
	UpdateTime time.Time  `json:"update_time"`
}

func (*Message) UnmarshalJSON

func (m *Message) UnmarshalJSON(data []byte) error

type RateLimit

type RateLimit struct {
	Limit     int
	Remaining int
	ResetTime time.Time
}

type Task

type Task struct {
	TaskID            int        `json:"task_id"`
	Account           cw.Account `json:"account"`
	AssignedByAccount cw.Account `json:"assigned_by_account"`
	MessageID         string     `json:"message_id"`
	Body              string     `json:"body"`
	LimitTime         time.Time  `json:"limit_time"`
	Status            string     `json:"status"`
}

func (*Task) UnmarshalJSON

func (t *Task) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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