openapi

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAuthBaseURL = "https://dida365.com"
	DefaultAPIBaseURL  = "https://api.dida365.com/open/v1"
	DefaultScopes      = "tasks:read tasks:write"
	DefaultTokenType   = "Bearer"
)

Variables

This section is empty.

Functions

func AuthorizationURL

func AuthorizationURL(clientID string, redirectURI string, scope string, state string) string

func ClearClientConfig added in v0.1.3

func ClearClientConfig() error

func ClearToken

func ClearToken() error

func ClientConfigPath added in v0.1.3

func ClientConfigPath() string

func ClientConfigStatus added in v0.1.3

func ClientConfigStatus() map[string]any

func RedactForStatus added in v0.1.3

func RedactForStatus(value string) string

func ResolveClientID

func ResolveClientID(explicit string) (string, error)

func ResolveClientSecret

func ResolveClientSecret(explicit string) (string, error)

func SaveToken

func SaveToken(token *TokenResponse) error

func TokenPath

func TokenPath() string

func TokenStatus

func TokenStatus() map[string]any

Types

type Client

type Client struct {
	BaseURL    string
	Token      string
	HTTPClient *http.Client
}

func NewClient

func NewClient(token string) *Client

func (*Client) CompleteTask

func (c *Client) CompleteTask(ctx context.Context, projectID string, taskID string) error

func (*Client) CompletedTasks

func (c *Client) CompletedTasks(ctx context.Context, payload map[string]any) ([]map[string]any, error)

func (*Client) CreateHabit added in v0.1.1

func (c *Client) CreateHabit(ctx context.Context, payload map[string]any) (map[string]any, error)

func (*Client) CreateProject added in v0.1.7

func (c *Client) CreateProject(ctx context.Context, payload map[string]any) (map[string]any, error)

func (*Client) CreateTask

func (c *Client) CreateTask(ctx context.Context, payload map[string]any) (map[string]any, error)

func (*Client) DeleteFocus added in v0.1.1

func (c *Client) DeleteFocus(ctx context.Context, focusID string, focusType string) (map[string]any, error)

func (*Client) DeleteProject added in v0.1.7

func (c *Client) DeleteProject(ctx context.Context, projectID string) error

func (*Client) DeleteTask

func (c *Client) DeleteTask(ctx context.Context, projectID string, taskID string) error

func (*Client) Do

func (c *Client) Do(ctx context.Context, method string, path string, body io.Reader, out any) error

func (*Client) FilterTasks

func (c *Client) FilterTasks(ctx context.Context, payload map[string]any) ([]map[string]any, error)

func (*Client) Focus added in v0.1.1

func (c *Client) Focus(ctx context.Context, focusID string, focusType string) (map[string]any, error)

func (*Client) Focuses added in v0.1.1

func (c *Client) Focuses(ctx context.Context, from string, to string, focusType string) ([]map[string]any, error)

func (*Client) Habit added in v0.1.1

func (c *Client) Habit(ctx context.Context, habitID string) (map[string]any, error)

func (*Client) HabitCheckins added in v0.1.1

func (c *Client) HabitCheckins(ctx context.Context, habitIDs string, from string, to string) ([]map[string]any, error)

func (*Client) Habits added in v0.1.1

func (c *Client) Habits(ctx context.Context) ([]map[string]any, error)

func (*Client) MoveTasks

func (c *Client) MoveTasks(ctx context.Context, payload any) (any, error)

func (*Client) Project

func (c *Client) Project(ctx context.Context, projectID string) (map[string]any, error)

func (*Client) ProjectData

func (c *Client) ProjectData(ctx context.Context, projectID string) (map[string]any, error)

func (*Client) Projects

func (c *Client) Projects(ctx context.Context) ([]map[string]any, error)

func (*Client) Task

func (c *Client) Task(ctx context.Context, projectID string, taskID string) (map[string]any, error)

func (*Client) UpdateHabit added in v0.1.1

func (c *Client) UpdateHabit(ctx context.Context, habitID string, payload map[string]any) (map[string]any, error)

func (*Client) UpdateProject added in v0.1.7

func (c *Client) UpdateProject(ctx context.Context, projectID string, payload map[string]any) (map[string]any, error)

func (*Client) UpdateTask

func (c *Client) UpdateTask(ctx context.Context, taskID string, payload map[string]any) (map[string]any, error)

func (*Client) UpsertHabitCheckin added in v0.1.1

func (c *Client) UpsertHabitCheckin(ctx context.Context, habitID string, payload map[string]any) (map[string]any, error)

type ClientConfig added in v0.1.3

type ClientConfig struct {
	ClientID     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
	SavedAt      int64  `json:"saved_at"`
}

func LoadClientConfig added in v0.1.3

func LoadClientConfig() (*ClientConfig, error)

func SaveClientConfig added in v0.1.3

func SaveClientConfig(clientID string, clientSecret string) (*ClientConfig, error)

type OAuthToken

type OAuthToken struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type,omitempty"`
	Scope        string `json:"scope,omitempty"`
	ExpiresIn    int64  `json:"expires_in,omitempty"`
	CreatedAt    int64  `json:"created_at"`
	RefreshToken string `json:"refresh_token,omitempty"`
}

type TokenResponse

type TokenResponse struct {
	OAuthToken
}

func ExchangeCode

func ExchangeCode(ctx context.Context, clientID string, clientSecret string, code string, redirectURI string, scope string) (*TokenResponse, error)

func LoadToken

func LoadToken() (*TokenResponse, error)

Jump to

Keyboard shortcuts

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