rest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

IsNotFound is a 404 error

func NotFoundError

func NotFoundError() error

NotFoundError is 404

Types

type Client

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

Client defines the API client

func (*Client) CreateAccessKey

func (c *Client) CreateAccessKey(ctx context.Context, repo bitbucket.Repo, key bitbucket.AccessKey) (bitbucket.AccessKey, error)

CreateAccessKey on a repository by providing the public key

func (*Client) CreateWebhook

func (c *Client) CreateWebhook(ctx context.Context, repo bitbucket.Repo, hook bitbucket.Webhook) (bitbucket.Webhook, error)

CreateWebhook creates the web hook

func (*Client) DeleteAccessKey

func (c *Client) DeleteAccessKey(ctx context.Context, repo bitbucket.Repo, id int) error

DeleteAccessKey removes the key from the repository by provided access key id

func (*Client) DeleteWebhook

func (c *Client) DeleteWebhook(ctx context.Context, repo bitbucket.Repo, id int) error

DeleteWebhook deletes the web hook

func (*Client) GetAccessKey

func (c *Client) GetAccessKey(ctx context.Context, repo bitbucket.Repo, id int) (bitbucket.AccessKey, error)

GetAccessKey finds accesskey given by bitbucket server access key id

func (*Client) GetWebhook

func (c *Client) GetWebhook(ctx context.Context, repo bitbucket.Repo, id int) (bitbucket.Webhook, error)

GetWebhook gets the web hook

func (*Client) ListAccessKeys

func (c *Client) ListAccessKeys(ctx context.Context, repo bitbucket.Repo) ([]bitbucket.AccessKey, error)

ListAccessKeys returns all access keys for the given repository

func (*Client) UpdateAccessKeyPermission

func (c *Client) UpdateAccessKeyPermission(ctx context.Context, repo bitbucket.Repo, id int, permission string) error

UpdateAccessKeyPermission enables mutation of permissions on a accesskey by providing the id of the access key. Valid options are REPO_READ or REPO_WRITE

func (*Client) UpdateWebhook

func (c *Client) UpdateWebhook(ctx context.Context, repo bitbucket.Repo, id int, hook bitbucket.Webhook) (bitbucket.Webhook, error)

UpdateWebhook updates the web hook

type GetKeysPayload

type GetKeysPayload struct {
	// Pagination is defined by the bitbucket server api
	Pagination `json:",inline"`
	// Values is defined by the bitbucket server api
	Values []KeyDescription `json:"values"`
}

GetKeysPayload is the returned object from bitbucket server

type KeyDescription

type KeyDescription struct {
	// Key contains info about the access key
	Key KeyInfo `json:"key"`
	// Repository contains information about the repository where the access key is added
	Repository RepositoryInfo `json:"repository"`
	// Permission is the level of permission the access key has been granted
	Permission string `json:"permission"`
}

KeyDescription describes a specific accesskey in bitbucket server

type KeyInfo

type KeyInfo struct {
	ID    int    `json:"id"`
	Text  string `json:"text"`
	Label string `json:"label"`
}

KeyInfo contains the information about the access key

type Pagination

type Pagination struct {
	Size       int  `json:"size"`
	Limit      int  `json:"limit"`
	IsLastPage bool `json:"isLastPage"`
}

Pagination defines response pagination

type ProjectInfo

type ProjectInfo struct {
	Key string `json:"key"`
}

ProjectInfo contains information on the project

type PublicSSHKey

type PublicSSHKey struct {
	// Text contains the public key
	Text string `json:"text"`
	// Labels describes the public key
	Label string `json:"label"`
}

PublicSSHKey represents the public ssh key

type RepositoryInfo

type RepositoryInfo struct {
	Name    string `json:"name"`
	ID      int    `json:"id"`
	Project ProjectInfo
}

RepositoryInfo contains information about the repository

type UploadKeyPayload

type UploadKeyPayload struct {
	// Key defines the type of public ssh key
	Key PublicSSHKey `json:"key"`
	// Permissions defines the access level for the access key in bitbucket server
	Permission string `json:"permission"`
}

UploadKeyPayload defines api object for key upload

Jump to

Keyboard shortcuts

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