calendly

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

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

Go to latest
Published: Nov 16, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

README

Calendly

A Golang API wrapper for the Calendly platform

Usage

Create a new client with calendly.New(), advanced usage for custom API url and headers can be seen in the unit tests.

cw := calendly.New(&calendly.CalendlyWrapperInput{
    ApiKey: "api-key-here",
})

Use any of the build-in functions to query against the Calendly API

currentUser, err := cw.GetCurrentUser()
if err != nil {
    panic(err)
}

log.Printf("%+v\r\n", currentUser)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CalendlyWrapper

type CalendlyWrapper struct {
	// contains filtered or unexported fields
}

CalendlyWrapper holds the main Calendly client

func New

New returns a CalendlyWrapper to be used

func (cw *CalendlyWrapper) CreateSingleUseSchedulingLink(input *SchedulingLinkInput) (SchedulingLink, error)

CreateSingleUseSchedulingLink creates a single use link for Calendly

func (*CalendlyWrapper) GetCurrentUser

func (cw *CalendlyWrapper) GetCurrentUser() (User, error)

GetCurrentUser returns the current user for the given API key

func (*CalendlyWrapper) GetEvent

func (cw *CalendlyWrapper) GetEvent(id string) (Event, error)

GetEvent gets the specified Calendly event

func (*CalendlyWrapper) GetEventInvitee

func (cw *CalendlyWrapper) GetEventInvitee(eventid, inviteeid string) (Invitee, error)

GetEventInvitee returns an invitee for a specific event

func (*CalendlyWrapper) GetEventType

func (cw *CalendlyWrapper) GetEventType(id string) (EventType, error)

GetEventType returns the event type for the given id

func (*CalendlyWrapper) GetUser

func (cw *CalendlyWrapper) GetUser(id string) (User, error)

GetUser gets a user by ID

func (*CalendlyWrapper) GetWebhookSubscription

func (cw *CalendlyWrapper) GetWebhookSubscription(id string) (WebhookSubscription, error)

GetWebhookSubscription gets the webhook subscription by id

func (*CalendlyWrapper) ListEventInvitees

func (cw *CalendlyWrapper) ListEventInvitees(input *ListEventInviteesInput) ([]Invitee, error)

ListEventInvitees lists all the invitees for a specific event

func (*CalendlyWrapper) ListEvents

func (cw *CalendlyWrapper) ListEvents(input *ListEventsInput) ([]Event, error)

ListEvents returns an event list from the Calendly API

func (*CalendlyWrapper) ListUsersEventTypes

func (cw *CalendlyWrapper) ListUsersEventTypes(input *ListUsersEventTypesInput) ([]EventType, error)

ListUsersEventTypes list a users event types Either User or Organization are required

func (*CalendlyWrapper) ListWebhookSubscriptions

func (cw *CalendlyWrapper) ListWebhookSubscriptions(input *ListWebhookSubscriptionsInput) ([]WebhookSubscription, error)

ListWebhookSubscriptions lists the webhook subscriptions for the provided user or organization

func (*CalendlyWrapper) VerifyWebhookSignature

func (cw *CalendlyWrapper) VerifyWebhookSignature(body, secret []byte, sig *WebhookSignature) (bool, error)

VerifyWebhookSignature verifies the given webhook signature

type CalendlyWrapperInput

type CalendlyWrapperInput struct {
	ApiKey        string
	BaseApiUrl    string
	CustomHeaders map[string]string
}

CalendlyWrapperInput is used as input for the New function

type Cancellation

type Cancellation struct {
	CancelerType string `json:"canceler_type"`
	CanceledBy   string `json:"canceled_by"`
	Reason       string `json:"reason"`
}

type CustomQuestion

type CustomQuestion struct {
	Name          string   `json:"name"`
	Type          string   `json:"type"`
	Position      int      `json:"position"`
	Enabled       bool     `json:"enabled"`
	Required      bool     `json:"required"`
	AnswerChoices []string `json:"answer_choices"`
	IncludeOther  bool     `json:"include_other"`
}

CustomQuestion holds a Calendly CustomQuestion object

type CustomQuestionsAndAnswers

type CustomQuestionsAndAnswers struct {
	Answer   string `json:"answer"`
	Position int    `json:"position"`
	Question string `json:"question"`
}

type Event

type Event struct {
	URI              string             `json:"uri"`
	Name             string             `json:"name"`
	Status           string             `json:"status"`
	StartTime        time.Time          `json:"start_time"`
	EndTime          time.Time          `json:"end_time"`
	EventType        string             `json:"event_type"`
	Location         Location           `json:"location"`
	InviteesCounter  InviteesCounter    `json:"invitees_counter"`
	CreatedAt        time.Time          `json:"created_at"`
	UpdatedAt        time.Time          `json:"updated_at"`
	EventMemberships []EventMemberships `json:"event_memberships"`
	EventGuests      []Guest            `json:"event_guests"`
	Cancellation     Cancellation       `json:"cancellation"`
}

Event holds a Calendly Event object

type EventMemberships

type EventMemberships struct {
	User string `json:"user"`
}

type EventType

type EventType struct {
	URI              string           `json:"uri"`
	Name             string           `json:"name"`
	Active           bool             `json:"active"`
	Slug             string           `json:"slug"`
	SchedulingUrl    string           `json:"scheduling_url"`
	Duration         int              `json:"duration"`
	Kind             string           `json:"kind"`
	PoolingType      string           `json:"pooling_type"`
	Type             string           `json:"type"`
	Color            string           `json:"color"`
	CreatedAt        time.Time        `json:"created_at"`
	UpdatedAt        time.Time        `json:"updated_at"`
	InternalNote     string           `json:"internal_note"`
	DescriptionPlain string           `json:"description_plain"`
	DescriptionHtml  string           `json:"description_html"`
	Profile          Profile          `json:"profile"`
	Secret           bool             `json:"secret"`
	CustomQuestions  []CustomQuestion `json:"custom_questions"`
}

EventType holds a Calendly EventType object

type Guest

type Guest struct {
	Email     string    `json:"email"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Guest holds a Calendly Guest object

type Invitee

type Invitee struct {
	CancelURL           string                      `json:"cancel_url"`
	CreatedAt           time.Time                   `json:"created_at"`
	Email               string                      `json:"email"`
	Event               string                      `json:"event"`
	FirstName           string                      `json:"first_name"`
	LastName            string                      `json:"last_name"`
	Name                string                      `json:"name"`
	NewInvitee          interface{}                 `json:"new_invitee"`
	OldInvitee          interface{}                 `json:"old_invitee"`
	QuestionsAndAnswers []CustomQuestionsAndAnswers `json:"questions_and_answers"`
	RescheduleURL       string                      `json:"reschedule_url"`
	Rescheduled         bool                        `json:"rescheduled"`
	Status              string                      `json:"status"`
	TextReminderNumber  interface{}                 `json:"text_reminder_number"`
	Timezone            string                      `json:"timezone"`
	Tracking            Tracking                    `json:"tracking"`
	UpdatedAt           time.Time                   `json:"updated_at"`
	URI                 string                      `json:"uri"`
	Canceled            bool                        `json:"canceled"`
	Cancellation        Cancellation                `json:"cancellation"`
	Payment             Payment                     `json:"payment"`
	NoShow              string                      `json:"no_show"`
}

Invitee holds a Calendly Invitee object

type InviteesCounter

type InviteesCounter struct {
	Total  int `json:"total"`
	Active int `json:"active"`
	Limit  int `json:"limit"`
}

type ListEventInviteesInput

type ListEventInviteesInput struct {
	ID        string
	Count     int
	Email     string
	PageToken string
	Sort      string
	Status    string
}

type ListEventsInput

type ListEventsInput struct {
	Count        int
	InviteeEmail string
	MaxStartTime string
	MinStartTime string
	Organization string
	PageToken    string
	Sort         string
	Status       string
	User         string
}

type ListUsersEventTypesInput

type ListUsersEventTypesInput struct {
	Active       string // This should be a bool, but Go doesn't have a null value for bools so we use string
	Count        int
	Organization string
	PageToken    string
	Sort         string
	User         string
}

ListUsersEventTypesInput is used as input for the ListUsersEventTypes function

type ListWebhookSubscriptionsInput

type ListWebhookSubscriptionsInput struct {
	Organization string
	Scope        string
	Count        int
	PageToken    string
	Sort         string
	User         string
}

ListWebhookSubscriptionsInput is used as input for the ListWebhookSubscriptions function

type Location

type Location struct {
	Type     string `json:"type"`
	Location string `json:"location"`
}

type Payload

type Payload struct {
	CancelURL           string                      `json:"cancel_url"`
	CreatedAt           time.Time                   `json:"created_at"`
	Email               string                      `json:"email"`
	Event               string                      `json:"event"`
	Name                string                      `json:"name"`
	NewInvitee          interface{}                 `json:"new_invitee"`
	OldInvitee          interface{}                 `json:"old_invitee"`
	QuestionsAndAnswers []CustomQuestionsAndAnswers `json:"questions_and_answers"`
	RescheduleURL       string                      `json:"reschedule_url"`
	Rescheduled         bool                        `json:"rescheduled"`
	Status              string                      `json:"status"`
	TextReminderNumber  interface{}                 `json:"text_reminder_number"`
	Timezone            string                      `json:"timezone"`
	Tracking            Tracking                    `json:"tracking"`
	UpdatedAt           time.Time                   `json:"updated_at"`
	URI                 string                      `json:"uri"`
	Canceled            bool                        `json:"canceled"`
	Cancellation        Cancellation                `json:"cancellation"`
}

type Payment

type Payment struct {
	ExternalID string  `json:"external_id"`
	Provider   string  `json:"provider"`
	Amount     float64 `json:"amount"`
	Currency   string  `json:"currency"`
	Terms      string  `json:"terms"`
	Successful bool    `json:"successful"`
}

type Profile

type Profile struct {
	Type  string `json:"type"`
	Name  string `json:"name"`
	Owner string `json:"owner"`
}

Profile holds a Calendly Profile object

type SchedulingLink struct {
	BookingURL string `json:"booking_url"`
	Owner      string `json:"owner"`
	OwnerType  string `json:"owner_type"`
}

SchedulingLink holds a Calendly Scheduled Link

type SchedulingLinkInput

type SchedulingLinkInput struct {
	MaxEventCount int    `json:"max_event_count"`
	Owner         string `json:"owner"`
	OwnerType     string `json:"owner_type"`
}

SchedulingLinkInput is used as input to the CreateSingleUseSchedulingLink function

type Tracking

type Tracking struct {
	UtmCampaign    interface{} `json:"utm_campaign"`
	UtmSource      interface{} `json:"utm_source"`
	UtmMedium      interface{} `json:"utm_medium"`
	UtmContent     interface{} `json:"utm_content"`
	UtmTerm        interface{} `json:"utm_term"`
	SalesforceUUID interface{} `json:"salesforce_uuid"`
}

type User

type User struct {
	URI                 string    `json:"uri"`
	Name                string    `json:"name"`
	Slug                string    `json:"slug"`
	Email               string    `json:"email"`
	SchedulingUrl       string    `json:"scheduling_url"`
	Timezone            string    `json:"timezone"`
	AvatarUrl           string    `json:"avatar_url"`
	CreatedAt           time.Time `json:"created_at"`
	UpdatedAt           time.Time `json:"updated_at"`
	CurrentOrganization string    `json:"current_organization"`
}

User holds a Calendly User object

type WebhookPayload

type WebhookPayload struct {
	CreatedAt time.Time `json:"created_at"`
	CreatedBy string    `json:"created_by"`
	Event     string    `json:"event"`
	Payload   Payload   `json:"payload"`
}

WebhookPayload holds a Calendly Webhook Payload object

type WebhookSignature

type WebhookSignature struct {
	Time int64
	V1   string
}

WebhookSignature holds a Calendly webhook signature

type WebhookSubscription

type WebhookSubscription struct {
	URI            string    `json:"uri"`
	CallbackUrl    string    `json:"callback_url"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
	RetryStartedAt time.Time `json:"retry_started_at"`
	State          string    `json:"state"`
	Events         []string  `json:"events"`
	Scope          string    `json:"scope"`
	Organization   string    `json:"organization"`
	User           string    `json:"user"`
	Creator        string    `json:"creator"`
}

WebhookSubscription holds a Calendly Webhook Subscription object

Jump to

Keyboard shortcuts

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