internal

package
v2.8.2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	UUID  string `json:"uuid"`
	Login string `json:"username"`
	Name  string `json:"display_name"`
	Type  string `json:"type"`
	Links Links  `json:"links"`
}

type Branch

type Branch struct {
	Name string `json:"name"`
}

type BranchResp

type BranchResp struct {
	Values []*Branch `json:"values"`
}

type Change

type Change struct {
	New struct {
		Type   string `json:"type"`
		Name   string `json:"name"`
		Target struct {
			Type    string    `json:"type"`
			Hash    string    `json:"hash"`
			Message string    `json:"message"`
			Date    time.Time `json:"date"`
			Links   Links     `json:"links"`
			Author  struct {
				Raw  string  `json:"raw"`
				User Account `json:"user"`
			} `json:"author"`
		} `json:"target"`
	} `json:"new"`
}

type Client

type Client struct {
	*http.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, url string, client *http.Client) *Client

func NewClientToken

func NewClientToken(ctx context.Context, url, client, secret string, token *oauth2.Token) *Client

func (*Client) CreateHook

func (c *Client) CreateHook(owner, name string, hook *Hook) error

func (*Client) CreateStatus

func (c *Client) CreateStatus(owner, name, revision string, status *PipelineStatus) error

func (*Client) DeleteHook

func (c *Client) DeleteHook(owner, name, id string) error

func (*Client) FindCurrent

func (c *Client) FindCurrent() (*Account, error)

func (*Client) FindHook

func (c *Client) FindHook(owner, name, id string) (*Hook, error)

func (*Client) FindRepo

func (c *Client) FindRepo(owner, name string) (*Repo, error)

func (*Client) FindSource

func (c *Client) FindSource(owner, name, revision, path string) (*string, error)

func (*Client) GetBranchHead

func (c *Client) GetBranchHead(owner, name, branch string) (*Commit, error)

func (*Client) GetPermission

func (c *Client) GetPermission(fullName string) (*RepoPerm, error)

func (*Client) GetRepoFiles

func (c *Client) GetRepoFiles(owner, name, revision, path string, page *string) (*DirResp, error)

func (*Client) GetUserWorkspaceMembership

func (c *Client) GetUserWorkspaceMembership(workspace, user string) (string, error)

func (*Client) GetWorkspace

func (c *Client) GetWorkspace(name string) (*Workspace, error)

func (*Client) ListBranches

func (c *Client) ListBranches(owner, name string, opts *ListOpts) ([]*Branch, error)

func (*Client) ListEmail

func (c *Client) ListEmail() (*EmailResp, error)

func (*Client) ListHooks

func (c *Client) ListHooks(owner, name string, opts *ListOpts) (*HookResp, error)

func (*Client) ListPermissions added in v2.2.0

func (c *Client) ListPermissions(opts *ListOpts) (*RepoPermResp, error)

func (*Client) ListPermissionsAll added in v2.2.0

func (c *Client) ListPermissionsAll() ([]*RepoPerm, error)

func (*Client) ListPullRequests

func (c *Client) ListPullRequests(owner, name string, opts *ListOpts) ([]*PullRequest, error)

func (*Client) ListRepos

func (c *Client) ListRepos(workspace string, opts *ListOpts) (*RepoResp, error)

func (*Client) ListReposAll

func (c *Client) ListReposAll(workspace string) ([]*Repo, error)

func (*Client) ListWorkspaces

func (c *Client) ListWorkspaces(opts *ListWorkspacesOpts) (*WorkspacesResp, error)

type Commit

type Commit struct {
	Hash  string `json:"hash"`
	Links struct {
		HTML struct {
			Href string `json:"href"`
		} `json:"html"`
	} `json:"links"`
}

type CommitsResp

type CommitsResp struct {
	Values []*Commit `json:"values"`
}

type Dir

type Dir struct {
	Path string `json:"path"`
	Type string `json:"type"`
	Size uint   `json:"size"`
}

type DirResp

type DirResp struct {
	Page    uint    `json:"page"`
	PageLen uint    `json:"pagelen"`
	Next    *string `json:"next"`
	Values  []*Dir  `json:"values"`
}

type Email

type Email struct {
	Email       string `json:"email"`
	IsConfirmed bool   `json:"is_confirmed"`
	IsPrimary   bool   `json:"is_primary"`
}

type EmailResp

type EmailResp struct {
	Page   int      `json:"page"`
	Pages  int      `json:"pagelen"`
	Size   int      `json:"size"`
	Next   string   `json:"next"`
	Values []*Email `json:"values"`
}

type Error

type Error struct {
	Status int
	Body   struct {
		Message string `json:"message"`
	} `json:"error"`
}

func (Error) Error

func (e Error) Error() string

type Hook

type Hook struct {
	UUID   string   `json:"uuid,omitempty"`
	Desc   string   `json:"description"`
	URL    string   `json:"url"`
	Events []string `json:"events"`
	Active bool     `json:"active"`
}

type HookResp

type HookResp struct {
	Page   int     `json:"page"`
	Pages  int     `json:"pagelen"`
	Size   int     `json:"size"`
	Next   string  `json:"next"`
	Values []*Hook `json:"values"`
}
type Link struct {
	Href string `json:"href"`
	Name string `json:"name"`
}

type LinkClone

type LinkClone struct {
	Link
}
type Links struct {
	Self   Link   `json:"self"`
	Avatar Link   `json:"avatar"`
	HTML   Link   `json:"html"`
	Clone  []Link `json:"clone"`
}

type ListOpts

type ListOpts struct {
	Page    int
	PageLen int
}

func (*ListOpts) Encode

func (o *ListOpts) Encode() string

type ListWorkspacesOpts

type ListWorkspacesOpts struct {
	Page    int
	PageLen int
	Role    string
}

func (*ListWorkspacesOpts) Encode

func (o *ListWorkspacesOpts) Encode() string

type PipelineStatus

type PipelineStatus struct {
	State string `json:"state"`
	Key   string `json:"key"`
	Name  string `json:"name,omitempty"`
	URL   string `json:"url"`
	Desc  string `json:"description,omitempty"`
}

type PullRequest

type PullRequest struct {
	ID    uint   `json:"id"`
	Title string `json:"title"`
}

type PullRequestHook

type PullRequestHook struct {
	Actor       Account `json:"actor"`
	Repo        Repo    `json:"repository"`
	PullRequest struct {
		ID      int       `json:"id"`
		Type    string    `json:"type"`
		Reason  string    `json:"reason"`
		Desc    string    `json:"description"`
		Title   string    `json:"title"`
		State   string    `json:"state"`
		Links   Links     `json:"links"`
		Created time.Time `json:"created_on"`
		Updated time.Time `json:"updated_on"`

		MergeCommit struct {
			Hash string `json:"hash"`
		} `json:"merge_commit"`

		Source struct {
			Repo   Repo `json:"repository"`
			Commit struct {
				Hash  string `json:"hash"`
				Links Links  `json:"links"`
			} `json:"commit"`
			Branch struct {
				Name string `json:"name"`
			} `json:"branch"`
		} `json:"source"`

		Dest struct {
			Repo   Repo `json:"repository"`
			Commit struct {
				Hash  string `json:"hash"`
				Links Links  `json:"links"`
			} `json:"commit"`
			Branch struct {
				Name string `json:"name"`
			} `json:"branch"`
		} `json:"destination"`
	} `json:"pullrequest"`
}

type PullRequestResp

type PullRequestResp struct {
	Page    uint           `json:"page"`
	PageLen uint           `json:"pagelen"`
	Size    uint           `json:"size"`
	Values  []*PullRequest `json:"values"`
}

type PushHook

type PushHook struct {
	Actor Account `json:"actor"`
	Repo  Repo    `json:"repository"`
	Push  struct {
		Changes []Change `json:"changes"`
	} `json:"push"`
}

type Repo

type Repo struct {
	UUID       string  `json:"uuid"`
	Owner      Account `json:"owner"`
	Name       string  `json:"name"`
	FullName   string  `json:"full_name"`
	Language   string  `json:"language"`
	IsPrivate  bool    `json:"is_private"`
	Scm        string  `json:"scm"`
	Desc       string  `json:"desc"`
	Links      Links   `json:"links"`
	MainBranch struct {
		Type string `json:"type"`
		Name string `json:"name"`
	} `json:"mainbranch"` // cspell:ignore mainbranch
}

type RepoPerm

type RepoPerm struct {
	Permission string `json:"permission"`
	Repo       Repo   `json:"repository"`
}

type RepoPermResp

type RepoPermResp struct {
	Page   int         `json:"page"`
	Pages  int         `json:"pagelen"`
	Values []*RepoPerm `json:"values"`
}

type RepoResp

type RepoResp struct {
	Page   int     `json:"page"`
	Pages  int     `json:"pagelen"`
	Size   int     `json:"size"`
	Next   string  `json:"next"`
	Values []*Repo `json:"values"`
}

type Workspace

type Workspace struct {
	UUID  string `json:"uuid"`
	Slug  string `json:"slug"`
	Name  string `json:"name"`
	Type  string `json:"type"`
	Links Links  `json:"links"`
}

type WorkspaceMembershipResp

type WorkspaceMembershipResp struct {
	Page   int    `json:"page"`
	Pages  int    `json:"pagelen"`
	Size   int    `json:"size"`
	Next   string `json:"next"`
	Values []struct {
		Permission string `json:"permission"`
		User       struct {
			Nickname string `json:"nickname"`
		}
	} `json:"values"`
}

type WorkspacesResp

type WorkspacesResp struct {
	Page   int          `json:"page"`
	Pages  int          `json:"pagelen"`
	Size   int          `json:"size"`
	Next   string       `json:"next"`
	Values []*Workspace `json:"values"`
}

Jump to

Keyboard shortcuts

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