Documentation ¶
Overview ¶
Golang Flowdock client (REST API)
Index ¶
- func CheckResponse(r *http.Response) error
- type Client
- type CommentContent
- type Content
- type ErrorResponse
- type Flow
- type FlowsCreateOptions
- type FlowsGetOptions
- type FlowsListOptions
- type FlowsService
- func (s *FlowsService) Create(orgName string, opt *FlowsCreateOptions) (*Flow, *http.Response, error)
- func (s *FlowsService) Get(org, flowName string) (*Flow, *http.Response, error)
- func (s *FlowsService) GetById(id string) (*Flow, *http.Response, error)
- func (s *FlowsService) List(all bool, opt *FlowsListOptions) ([]Flow, *http.Response, error)
- func (s *FlowsService) Update(orgName, flowName string, flow *Flow) (*Flow, *http.Response, error)
- type InboxCreateOptions
- type InboxService
- type Message
- type MessageContent
- type MessagesCreateOptions
- type MessagesListOptions
- type MessagesService
- func (s *MessagesService) Create(opt *MessagesCreateOptions) (*Message, *http.Response, error)
- func (s *MessagesService) CreateComment(opt *MessagesCreateOptions) (*Message, *http.Response, error)
- func (s *MessagesService) List(org, flow string, opt *MessagesListOptions) ([]Message, *http.Response, error)
- type Organization
- type Time
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.
Types ¶
type Client ¶
type Client struct { // Base URL for API requests. BaseURL *url.URL // User agent used when communicating with the Flowdock API. UserAgent string // Services used for talking to different parts of the Flowdock API. Flows *FlowsService Messages *MessagesService Inbox *InboxService // contains filtered or unexported fields }
A Client manages communication with the Flowdock API.
func NewClient ¶
NewClient returns a new Flowdock API client. If a nil httpClient is provided, http.DefaultClient will be used. To use API methods which require authentication, provide an http.Client that will perform the authentication for you (such as that provided by the goauth2 library).
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred.
func (*Client) NewRequest ¶
NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.
type CommentContent ¶
CommentContent represents a Message's Content when Message.Event is "comment"
func (*CommentContent) String ¶
func (c *CommentContent) String() string
Return the string version of a CommentContent
It returns the *CommentContent.Text
type Content ¶
type Content interface {
String() string
}
Content should be implemented by any value that is parsed into Message.RawContent. Its API will likly expand as more Message types are implemented.
type ErrorResponse ¶
type ErrorResponse struct { Response *http.Response // HTTP response Data []byte // the error details }
An ErrorResponse reports the errors caused by an API request.
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type Flow ¶
type Flow struct { Id *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` ParameterizedName *string `json:"parameterized_name,omitempty"` UnreadMentions *int64 `json:"unread_mentions,omitempty"` Open *bool `json:"open,omitempty"` Disabled *bool `json:"disabled,omitempty"` Joined *bool `json:"joined,omitempty"` Url *string `json:"url,omitempty"` WebUrl *string `json:"web_url,omitempty"` JoinUrl *string `json:"join_url,omitempty"` AccessMode *string `json:"access_mode,omitempty"` Organization *Organization `json:"organization,omitempty"` Users *[]User `json:"users,omitempty"` }
Flow represents a Flowdock flow (room).
type FlowsCreateOptions ¶
type FlowsCreateOptions struct {
Name string `url:"name"`
}
FlowsCreateOptions specifies the optional parameters to the FlowsService.Create method.
type FlowsGetOptions ¶
type FlowsGetOptions struct {
Id string `url:"id,omitempty"`
}
FlowsGetOptions specifies the optional parameters to the FlowsService.Get method.
type FlowsListOptions ¶
type FlowsListOptions struct { // User a boolean value (1/0) that controls whether a list of users should // be included with each flow. User bool `url:"user,omitempty"` }
FlowsListOptions specifies the optional parameters to the FlowsService.List method.
type FlowsService ¶
type FlowsService struct {
// contains filtered or unexported fields
}
FlowsService handles communication with the flow related methods of the Flowdock API.
Flowdock API docs: https://www.flowdock.com/api/flows
func (*FlowsService) Create ¶
func (s *FlowsService) Create(orgName string, opt *FlowsCreateOptions) (*Flow, *http.Response, error)
Create a flow for the specified organization
Flowdock API docs: https://www.flowdock.com/api/flows
func (*FlowsService) Get ¶
Get a single flow. Single flow information always includes the flow's user list. Otherwise, the data format is identical to what is returned with the list of flows.
Flowdock API docs: https://www.flowdock.com/api/flows
func (*FlowsService) GetById ¶
Get a single flow. Single flow information always includes the flow's user list. Otherwise, the data format is identical to what is returned with the list of flows.
Flowdock API docs: https://www.flowdock.com/api/flows
func (*FlowsService) List ¶
func (s *FlowsService) List(all bool, opt *FlowsListOptions) ([]Flow, *http.Response, error)
Lists the flows that the authenticated user is a member of.
Flowdock API docs: https://www.flowdock.com/api/flows
type InboxCreateOptions ¶
type InboxCreateOptions struct { Source string `url:"source,omitempty"` FromAddress string `url:"from_address,omitempty"` Subject string `url:"subject,omitempty"` Content string `url:"content,omitempty"` FromName string `url:"from_name,omitempty"` ReplyTo string `url:"reply_to,omitempty"` Project string `url:"project,omitempty"` Tags []string `url:"tags,comma,omitempty"` Link string `url:"link,omitempty"` }
InboxCreateOptions specifies the optional parameters to the InboxCreate method.
type InboxService ¶
type InboxService struct {
// contains filtered or unexported fields
}
InboxService handles communication with the Team Inbox related methods of the Flowdock API.
Flowdock API docs: https://flowdock.com/api/team-inbox
func (*InboxService) Create ¶
func (s *InboxService) Create(flowApiToken string, opt *InboxCreateOptions) (*Message, *http.Response, error)
Create an Inbox mail message for the specified flow api token
Flowdock API docs: https://www.flowdock.com/api/team-inbox
type Message ¶
type Message struct { ID *int `json:"id,omitempty"` FlowID *string `json:"flow,omitempty"` Sent *Time `json:"sent,omitempty"` UserID *json.RawMessage `json:"user,omitempty"` Event *string `json:"event,omitempty"` RawContent *json.RawMessage `json:"content,omitempty"` MessageID *int `json:"message,omitempty"` Tags *[]string `json:"tags,omitempty"` UUID *string `json:"uuid,omitempty"` ExternalUserName *string `json:"external_user_name,omitempty"` App *string `json:"app,omitempty"` // deprecated }
Message represents a Flowdock chat message.
type MessageContent ¶
type MessageContent string
MessageContent represents a Message's Content when Message.Event is "message"
func (*MessageContent) String ¶
func (c *MessageContent) String() string
Return the string version of a MessageContent
type MessagesCreateOptions ¶
type MessagesCreateOptions struct { FlowID string `url:"flow,omitempty"` MessageID int `url:"message,omitempty"` Event string `url:"event,omitempty"` Content string `url:"content,omitempty"` Tags []string `url:"tags,comma,omitempty"` UUID string `url:"uuid,omitempty"` ExternalUserName string `url:"external_user_name,omitempty"` Subject string `url:"subject,omitempty"` FromAddress string `url:"from_address,omitempty"` Source string `url:"source,omitempty"` }
MessagesCreateOptions specifies the optional parameters to the MessageService.Create method.
type MessagesListOptions ¶
type MessagesListOptions struct { Event string `url:"event,omitempty"` Limit int `url:"limit,omitempty"` SinceId int `url:"since_id,omitempty"` UntilId int `url:"until_id,omitempty"` Tags []string `url:"tags,comma,omitempty"` TagMode string `url:"tag_mode,omitempty"` Search string `url:"search,omitempty"` }
MessagesListOptions specifies the optional parameters to the MessageService.List method.
type MessagesService ¶
type MessagesService struct {
// contains filtered or unexported fields
}
MessagesService handles communication with the messages related methods of the Flowdock API.
Flowdock API docs: https://www.flowdock.com/api/messages
func (*MessagesService) Create ¶
func (s *MessagesService) Create(opt *MessagesCreateOptions) (*Message, *http.Response, error)
Create a message for the specified organization
Flowdock API docs: https://www.flowdock.com/api/messages
func (*MessagesService) CreateComment ¶
func (s *MessagesService) CreateComment(opt *MessagesCreateOptions) (*Message, *http.Response, error)
Create a comment for the specified organization
Flowdock API docs: https://www.flowdock.com/api/messages
func (*MessagesService) List ¶
func (s *MessagesService) List(org, flow string, opt *MessagesListOptions) ([]Message, *http.Response, error)
Lists the messages for the given flow.
Flowdock API docs: https://www.flowdock.com/api/messages
type Organization ¶
type Organization struct { Id *int64 `json:"id,omitempty"` Name *string `json:"name,omitempty"` ParameterizedName *string `json:"paramererized_name,omitempty"` UserLimit *int64 `json:"user_limit,omitempty"` UserCount *int64 `json:"user_count,omitempty"` Active *bool `json:"active,omitempty"` Url *string `json:"url,omitempty"` }
Organization represents a Flowdock organization to which members belong
type Time ¶
Time represents a Flowdock time stamp which is milliseconds since Epoch based
func (*Time) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface. The time is expected to be an intger representing milliseconds since Epoch.