Documentation ¶
Index ¶
- Constants
- func CheckResponse(r *http.Response) error
- func NewTokenAuthClient(config *Config) *http.Client
- type AboutMe
- type AboutMeResponse
- type Avatar
- type Client
- func (c *Client) Delete(urlStr string) (*http.Request, error)
- func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Response, error)
- func (c *Client) Echo(ctx context.Context) (*Echo, *Response, error)
- func (c *Client) Get(urlStr string) (*http.Request, error)
- func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)
- func (c *Client) Post(urlStr string, body interface{}) (*http.Request, error)
- func (c *Client) Put(urlStr string, body interface{}) (*http.Request, error)
- func (c *Client) SetBaseURL(bUrl string) error
- func (c *Client) SetUserAgent(ua string)
- type Config
- type Data
- type Echo
- type ErrorResponse
- type EventHookType
- type EventType
- type EventTypeAttributes
- type EventTypesOpts
- type EventTypesService
- type IncludeType
- type Owner
- type Relationships
- type Response
- type Transport
- type UserAttributes
- type UsersService
- type Webhook
- type WebhookAttributes
- type WebhooksOpts
- type WebhooksService
- func (s *WebhooksService) Create(ctx context.Context, opt *WebhooksOpts) (*Webhook, *Response, error)
- func (s *WebhooksService) Delete(ctx context.Context, id int64) (*Response, error)
- func (s *WebhooksService) GetByID(ctx context.Context, id int64) (*Webhook, *Response, error)
- func (s *WebhooksService) List(ctx context.Context) ([]*Webhook, *Response, error)
Constants ¶
const DefaultHeaderTokenKey = "X-Token"
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.
func NewTokenAuthClient ¶
NewTokenAuthClient returns a new http Client which signs requests via header Token.
Types ¶
type AboutMe ¶
type AboutMe struct { Type string `json:"type"` ID string `json:"id"` Attributes *UserAttributes `json:"attributes,omitempty"` }
type AboutMeResponse ¶
type AboutMeResponse struct {
AboutMe *AboutMe `json:"data"`
}
type Client ¶
type Client struct { // Base URL for API requests. BaseURL *url.URL // User agent for client UserAgent string // Event Types Service EventTypes EventTypesService // Users Service Users UsersService // Webhooks Service Webhooks WebhooksService // contains filtered or unexported fields }
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response will be written to v, without attempting to decode it.
func (*Client) NewRequest ¶
NewRequest creates an API request. A relative URL can be provided in urlStr, which will be resolved 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 in as the request body.
func (*Client) SetBaseURL ¶
SetBaseURL is a client option for setting the base URL.
func (*Client) SetUserAgent ¶
SetUserAgent is a client option for setting the user agent.
type Config ¶
type Config struct { // API Key (Client Identifier) ApiKey string // Header identifier for passing the API key HeaderKey string }
Config represents an OAuth1 consumer's (client's) key and secret, the callback URL, and the provider Endpoint to which the consumer corresponds.
type Echo ¶
type Echo struct {
Email string `json:"email"`
}
Test Authentication Token Use this endpoint to test your Authentication Token.
type ErrorResponse ¶
type ErrorResponse struct { // HTTP response that caused this error Response *http.Response // Error message Message string `json:"message"` // RequestID returned from the API, useful to contact support. RequestID string `json:"request_id"` }
An ErrorResponse reports the error caused by an API request
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type EventHookType ¶
type EventHookType string
const ( InviteeCreatedHookType EventHookType = "invitee.created" InviteeCancelledHookType EventHookType = "invitee.cancelled" )
type EventType ¶
type EventType struct { Type string `json:"type"` ID string `json:"id"` Attributes *EventTypeAttributes `json:"attributes,omitempty"` Relationships *Relationships `json:"relationships,omitempty"` }
type EventTypeAttributes ¶
type EventTypeAttributes struct { Name string `json:"name"` Description string `json:"description"` Duration int64 `json:"duration"` Slug string `json:"slug"` Color string `json:"color"` Active bool `json:"active"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` URL string `json:"url"` }
type EventTypesOpts ¶
type EventTypesOpts struct { // request extra information about the entity that owns the Event Type, // by adding ?include=owner to the URL of the request. Include IncludeType `url:"include,omitempty"` }
type EventTypesService ¶
type EventTypesService apiService
func (*EventTypesService) List ¶
func (s *EventTypesService) List(ctx context.Context, opt *EventTypesOpts) ([]*EventType, *Response, error)
Event Types contain the most important configurations in Calendly. If you need some basic information about your event types, you can use this endpoint.
type IncludeType ¶
type IncludeType string
Include Event type option
const ( // Owner event type option IncludeTypeOwner IncludeType = "owner" )
type Relationships ¶
type Relationships struct {
Owner Owner `json:"owner"`
}
type Response ¶
Response is a Calendly response. This wraps the standard http.Response returned from Calendly.
type Transport ¶
type Transport struct { // Base is the base RoundTripper used to make HTTP requests. If nil, then // http.DefaultTransport is used Base http.RoundTripper // contains filtered or unexported fields }
Transport is an http.RoundTripper which makes Authenticated HTTP requests. It wraps a base RoundTripper and adds an API header using the token from the config.
Transport is a low-level component, most users should use NewClient to create an http.Client instead.
type UserAttributes ¶
type UsersService ¶
type UsersService apiService
type Webhook ¶
type Webhook struct { Type string `json:"type"` ID int64 `json:"id"` Attributes *WebhookAttributes `json:"attributes,omitempty"` }
type WebhookAttributes ¶
type WebhookAttributes struct { URL string `json:"url"` CreatedAt string `json:"created_at"` State string `json:"state"` Events []EventHookType `json:"events"` }
type WebhooksOpts ¶
type WebhooksOpts struct { Url string Events []EventHookType }
type WebhooksService ¶
type WebhooksService apiService
func (*WebhooksService) Create ¶
func (s *WebhooksService) Create(ctx context.Context, opt *WebhooksOpts) (*Webhook, *Response, error)
Calendly supports webhooks which allow you to receive Calendly appointment data in real-time at a specified URL when a Calendly event is scheduled or cancelled.
Specifically, you can subscribe to:
- Invitee Created Events (allowing you to receive notifications when a new Calendly event is created)
- Invitee Canceled Events (allowing you to receive notifications when a Calendly event is canceled)
Creating a Webhook Subscription will not immediately trigger a webhook. So once it's set up, create or cancel an invitee to test it out.
func (*WebhooksService) Delete ¶
Any of your Webhook Subscriptions can be deleted by ID using this endpoint.