readthedocs

package module
v3.0.10 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2022 License: MPL-2.0 Imports: 8 Imported by: 1

Documentation

Overview

API client for readthedocs.org.

Index

Constants

View Source
const BaseURLV3 = "https://readthedocs.org/api/v3"

APIs default base URL.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL string

	HTTPClient *http.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(apiKey string) *Client

Create the API client using the default URL, providing the authentication key.

func NewClientWithURL added in v3.0.10

func NewClientWithURL(apiKey string, baseUrl string) *Client

Create the API client using a custom URL, providing the authentication key.

func (*Client) CreateProject

func (c *Client) CreateProject(ctx context.Context, createProject CreateUpdateProject) (string, error)

func (*Client) DeleteProject added in v3.0.3

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

func (*Client) GetProject

func (c *Client) GetProject(ctx context.Context, slug string) (Project, error)

func (*Client) GetProjects

func (c *Client) GetProjects(ctx context.Context) ([]Project, error)

func (*Client) UpdateProject

func (c *Client) UpdateProject(ctx context.Context, slug string, updateProject CreateUpdateProject) error

type CreateProject added in v3.0.1

type CreateProject struct {
	Name                string     `json:"name"`
	Repository          Repository `json:"repository"`
	Homepage            string     `json:"homepage,omitempty"`
	ProgrammingLanguage string     `json:"programming_language,omitempty"`
	Language            string     `json:"language,omitempty"`
	Organization        string     `json:"organization,omitempty"`
	Teams               string     `json:"teams,omitempty"`
}

type CreateUpdateProject

type CreateUpdateProject struct {
	CreateProject
	DefaultVersion        string `json:"default_version,omitempty"`
	DefaultBranch         string `json:"default_branch,omitempty"`
	AnalyticsCode         string `json:"analytics_code,omitempty"`
	AnalyticsDisabled     bool   `json:"analytics_disabled"`
	ShowVersionWarning    bool   `json:"show_version_warning"`
	SingleVersion         bool   `json:"single_version"`
	ExternalBuildsEnabled bool   `json:"external_builds_enabled"`
}

type Project

type Project struct {
	ID       int       `json:"id"`
	Name     string    `json:"name"`
	Slug     string    `json:"slug"`
	Created  time.Time `json:"created"`
	Modified time.Time `json:"modified"`
	Language struct {
		Code string `json:"code"`
		Name string `json:"name"`
	} `json:"language"`
	ProgrammingLanguage struct {
		Code string `json:"code"`
		Name string `json:"name"`
	} `json:"programming_language"`
	Repository struct {
		URL  string `json:"url"`
		Type string `json:"type"`
	} `json:"repository"`
	DefaultVersion string `json:"default_version"`
	DefaultBranch  string `json:"default_branch"`
	SubprojectOf   string `json:"subproject_of"`
	TranslationOf  string `json:"translation_of"`
	URLs           struct {
		Documentation string `json:"documentation"`
		Home          string `json:"home"`
	} `json:"urls"`
	Tags  []string `json:"tags"`
	Users []struct {
		Username string `json:"username"`
	}
	ActiveVersions map[string]string `json:"active_versions"`
}

type Repository added in v3.0.2

type Repository struct {
	URL  string `json:"url"`
	Type string `json:"type"`
}

Directories

Path Synopsis
cmd
create_project
Example of creating a project
Example of creating a project
read_projects
Example of listing projects
Example of listing projects

Jump to

Keyboard shortcuts

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