timetree

package
v0.0.0-...-a912291 Latest Latest
Warning

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

Go to latest
Published: May 1, 2021 License: MIT Imports: 21 Imported by: 1

Documentation

Index

Constants

View Source
const (
	HeaderRateLimit     = "X-RateLimit-Limit"
	HeaderRateRemaining = "X-RateLimit-Remaining"
	HeaderRateReset     = "X-RateLimit-Reset"
)
View Source
const (
	APIEndpoint = "https://timetreeapis.com"
)

API endpoint base constants

View Source
const DefaultAccessTokenLifetime = 600

DefaultAccessTokenLifetime token expiration time (10 minute maximum)

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

Bool bool to pointer function

func Int

func Int(v int) *int

Int int to pointer function

func Int64

func Int64(v int64) *int64

Int64 int64 to pointer function

func MustParseInt64

func MustParseInt64(v string) int64

MustParseInt64 string to int64 without error function

func ParseInt64

func ParseInt64(v string) (int64, error)

ParseInt64 string to int64 function

func String

func String(v string) *string

String string to pointer function

Types

type AccessTokenResponse

type AccessTokenResponse struct {
	ErrorResponse
	AccessToken string `json:"access_token,omitempty"`
	ExpireAt    int64  `json:"expire_at,omitempty"`
	TokenType   string `json:"token_type,omitempty"`
}

AccessTokenResponse type

type Attributes

type Attributes struct {
	Category      string `json:"category,omitempty"`
	Title         string `json:"title,omitempty"`
	AllDay        *bool  `json:"all_day,omitempty"`
	StartAt       string `json:"start_at,omitempty"`
	StartTimezone string `json:"start_timezone,omitempty"`
	EndAt         string `json:"end_at,omitempty"`
	EndTimezone   string `json:"end_timezone,omitempty"`
	Description   string `json:"description,omitempty"`
	Location      string `json:"location,omitempty"`
	URL           string `json:"url,omitempty"`
}

type CalendarAppAuthenticator

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

func NewCalendarAppAuthenticator

func NewCalendarAppAuthenticator(
	applicationID string,
	accessTokenLifetimeInSec int,
	privateKey []byte,
	httpClient *http.Client,
) (*CalendarAppAuthenticator, error)

func (*CalendarAppAuthenticator) AccessToken

func (c *CalendarAppAuthenticator) AccessToken(ctx context.Context, installationID string) (*AccessTokenResponse, *http.Response, error)

AccessToken アクセストークンの取得

type CalendarAppClient

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

func NewCalendarAppClient

func NewCalendarAppClient(httpClient *http.Client) (*CalendarAppClient, error)

func (*CalendarAppClient) CreateCalendarEvent

CreateCalendarEvent 予定の作成

func (*CalendarAppClient) DeleteCalendarEvent

func (c *CalendarAppClient) DeleteCalendarEvent(ctx context.Context, accessToken string, eventID string) (*DeleteCalendarEventResponse, *http.Response, error)

DeleteCalendarEvent 予定の削除

func (*CalendarAppClient) UpdateCalendarEvent

func (c *CalendarAppClient) UpdateCalendarEvent(ctx context.Context, accessToken string, eventID string, req *UpdateCalendarEventRequest) (*UpdateCalendarEventResponse, *http.Response, error)

UpdateCalendarEvent 予定の更新

type CalendarAppWebhook

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

func NewCalendarAppWebhook

func NewCalendarAppWebhook(secret string) *CalendarAppWebhook

func (CalendarAppWebhook) Verify

func (c CalendarAppWebhook) Verify(httpRequest *http.Request) bool

Verify Webhookリクエストの検証

type CalendarEventRequest

type CalendarEventRequest struct {
	Data *CalendarEventRequestData `json:"data,omitempty"`
}

type CalendarEventRequestData

type CalendarEventRequestData struct {
	Attributes *Attributes `json:"attributes,omitempty"`
}

type CalendarEventResponse

type CalendarEventResponse struct {
	ErrorResponse
	Data *CalendarEventResponseData `json:"data,omitempty"`
}

type CalendarEventResponseData

type CalendarEventResponseData struct {
	ID         string      `json:"id,omitempty"`
	Type       string      `json:"type,omitempty"`
	Attributes *Attributes `json:"attributes,omitempty"`
}

type Client

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

Client type

func NewClient

func NewClient(httpClient *http.Client) (*Client, error)

NewClient returns a new client instance.

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)

Do method

func (*Client) NewCalendarRequest

func (c *Client) NewCalendarRequest(method, path string, accessToken string, body interface{}) (*http.Request, error)

NewCalendarRequest method

func (*Client) NewInstallationsRequest

func (c *Client) NewInstallationsRequest(method, path string, body interface{}) (*http.Request, error)

NewInstallationsRequest method

func (*Client) WithHTTPClient

func (c *Client) WithHTTPClient(httpClient *http.Client) *Client

WithHTTPClient function

type CreateCalendarEventRequest

type CreateCalendarEventRequest CalendarEventRequest

type CreateCalendarEventResponse

type CreateCalendarEventResponse CalendarEventResponse

type DeleteCalendarEventResponse

type DeleteCalendarEventResponse struct {
	ErrorResponse
}

type ErrorResponse

type ErrorResponse struct {
	Type   string `json:"type,omitempty"`
	Status int    `json:"status,omitempty"`
	Title  string `json:"title,omitempty"`
}

type RateLimit

type RateLimit struct {
	Limit     int   `json:"limit"`
	Remaining int   `json:"remaining"`
	Reset     int64 `json:"reset"`
}

func ParseRateLimit

func ParseRateLimit(r *http.Response) RateLimit

type UpdateCalendarEventRequest

type UpdateCalendarEventRequest CalendarEventRequest

type UpdateCalendarEventResponse

type UpdateCalendarEventResponse CalendarEventResponse

Jump to

Keyboard shortcuts

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