client

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithAuthorization

func WithAuthorization(username, password, token string) uhttp.RequestOption

func WithAuthorizationBearerHeader

func WithAuthorizationBearerHeader(token string) uhttp.RequestOption

func WithSetBasicAuthHeader

func WithSetBasicAuthHeader(username, password string) uhttp.RequestOption

func WithSetBearerAuthHeader

func WithSetBearerAuthHeader(token string) uhttp.RequestOption

Types

type BitbucketError added in v0.0.3

type BitbucketError struct {
	ErrorMessage     string                   `json:"error"`
	ErrorDescription string                   `json:"error_description"`
	ErrorCode        int                      `json:"errorCode,omitempty"`
	ErrorSummary     string                   `json:"errorSummary,omitempty" toml:"error_description"`
	ErrorLink        string                   `json:"errorLink,omitempty"`
	ErrorId          string                   `json:"errorId,omitempty"`
	ErrorCauses      []map[string]interface{} `json:"errorCauses,omitempty"`
}

func (*BitbucketError) Error added in v0.0.3

func (b *BitbucketError) Error() string

type DataCenterClient

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

func New

func New(ctx context.Context, baseUrl string, bitbucketClient *DataCenterClient) (*DataCenterClient, error)

func NewClient

func NewClient() *DataCenterClient

func (*DataCenterClient) AddUserToGroups

func (d *DataCenterClient) AddUserToGroups(ctx context.Context, groupName, userName string) error

AddUserToGroups Add a user to one or more groups. https://developer.atlassian.com/server/bitbucket/rest/v819/api-group-permission-management/#api-api-latest-admin-users-add-groups-post

func (*DataCenterClient) CheckCredentials

func (d *DataCenterClient) CheckCredentials() bool

func (*DataCenterClient) GetGlobalGroupPermissions

func (d *DataCenterClient) GetGlobalGroupPermissions(ctx context.Context, startPage, limit string) ([]GroupsPermissions, Page, error)

func (*DataCenterClient) GetGlobalUserPermissions

func (d *DataCenterClient) GetGlobalUserPermissions(ctx context.Context, startPage, limit string) ([]UsersPermissions, Page, error)

GetGlobalUserPermissions Get users with a global permission https://developer.atlassian.com/server/bitbucket/rest/v819/api-group-permission-management/#api-api-latest-admin-permissions-users-get

func (*DataCenterClient) GetGroupMembers

func (d *DataCenterClient) GetGroupMembers(ctx context.Context, startPage, limit, groupName string) ([]Members, Page, error)

GetGroupMembers Get group members. The authenticated user must have the LICENSED_USER permission to call this resource. https://developer.atlassian.com/server/bitbucket/rest/v819/api-group-permission-management/#api-api-latest-admin-groups-more-members-get

func (*DataCenterClient) GetGroupProjectsPermissions

func (d *DataCenterClient) GetGroupProjectsPermissions(ctx context.Context, startPage, limit, projectKey string) ([]GroupsPermissions, Page, error)

func (*DataCenterClient) GetGroupRepositoryPermissions

func (d *DataCenterClient) GetGroupRepositoryPermissions(ctx context.Context, startPage, limit, projectKey, repositorySlug string) ([]GroupsPermissions, Page, error)

func (*DataCenterClient) GetGroups

func (d *DataCenterClient) GetGroups(ctx context.Context, startPage, limit string) ([]string, Page, error)

GetGroups Get groups. The authenticated user must have LICENSED_USER permission or higher to call this resource. https://developer.atlassian.com/server/bitbucket/rest/v819/api-group-permission-management/#api-api-latest-admin-groups-get

func (*DataCenterClient) GetProjects

func (d *DataCenterClient) GetProjects(ctx context.Context, startPage, limit string) ([]Projects, Page, error)

GetProjects Get projects. Only projects for which the authenticated user has the PROJECT_VIEW permission will be returned. https://developer.atlassian.com/server/bitbucket/rest/v819/api-group-project/#api-api-latest-projects-get

func (*DataCenterClient) GetRepos

func (d *DataCenterClient) GetRepos(ctx context.Context, startPage, limit string) ([]Repos, Page, error)

func (*DataCenterClient) GetUserProjectsPermissions

func (d *DataCenterClient) GetUserProjectsPermissions(ctx context.Context, startPage, limit, projectKey string) ([]UsersPermissions, Page, error)

func (*DataCenterClient) GetUserRepositoryPermissions

func (d *DataCenterClient) GetUserRepositoryPermissions(ctx context.Context, startPage, limit, projectKey, repositorySlug string) ([]UsersPermissions, Page, error)

GetUserRepositoryPermissions Get users with permission to repository https://developer.atlassian.com/server/bitbucket/rest/v819/api-group-permission-management/#api-api-latest-projects-projectkey-repos-repositoryslug-permissions-users-get

func (*DataCenterClient) GetUsers

func (d *DataCenterClient) GetUsers(ctx context.Context, startPage, limit string) ([]Users, Page, error)

GetUsers Get all users. Only authenticated users may call this resource. https://developer.atlassian.com/server/bitbucket/rest/v819/api-group-system-maintenance/#api-api-latest-users-get

func (*DataCenterClient) IsBasicAuthentication added in v0.0.3

func (d *DataCenterClient) IsBasicAuthentication() bool

func (*DataCenterClient) IsTokenAuthentication added in v0.0.3

func (d *DataCenterClient) IsTokenAuthentication() bool

func (*DataCenterClient) ListGlobalGroupPermissions

func (d *DataCenterClient) ListGlobalGroupPermissions(ctx context.Context, opts PageOptions) ([]GroupsPermissions, string, error)

func (*DataCenterClient) ListGlobalUserPermissions

func (d *DataCenterClient) ListGlobalUserPermissions(ctx context.Context, opts PageOptions) ([]UsersPermissions, string, error)

func (*DataCenterClient) ListGroupMembers

func (d *DataCenterClient) ListGroupMembers(ctx context.Context, opts PageOptions, groupName string) ([]Members, string, error)

func (*DataCenterClient) ListGroupProjectsPermissions

func (d *DataCenterClient) ListGroupProjectsPermissions(ctx context.Context, opts PageOptions, projectKey string) ([]GroupsPermissions, string, error)

func (*DataCenterClient) ListGroupRepositoryPermissions

func (d *DataCenterClient) ListGroupRepositoryPermissions(ctx context.Context, opts PageOptions, projectKey, repositorySlug string) ([]GroupsPermissions, string, error)

func (*DataCenterClient) ListGroups

func (d *DataCenterClient) ListGroups(ctx context.Context, opts PageOptions) ([]string, string, error)

func (*DataCenterClient) ListProjects

func (d *DataCenterClient) ListProjects(ctx context.Context, opts PageOptions) ([]Projects, string, error)

func (*DataCenterClient) ListRepos

func (d *DataCenterClient) ListRepos(ctx context.Context, opts PageOptions) ([]Repos, string, error)

func (*DataCenterClient) ListUserProjectsPermissions

func (d *DataCenterClient) ListUserProjectsPermissions(ctx context.Context, opts PageOptions, projectKey string) ([]UsersPermissions, string, error)

func (*DataCenterClient) ListUserRepositoryPermissions

func (d *DataCenterClient) ListUserRepositoryPermissions(ctx context.Context, opts PageOptions, projectKey, repositorySlug string) ([]UsersPermissions, string, error)

func (*DataCenterClient) ListUsers

func (d *DataCenterClient) ListUsers(ctx context.Context, opts PageOptions) ([]Users, string, error)

func (*DataCenterClient) RemoveUserFromGroup

func (d *DataCenterClient) RemoveUserFromGroup(ctx context.Context, userName, groupName string) error

RemoveUserFromGroup Remove user from group https://developer.atlassian.com/server/bitbucket/rest/v819/api-group-permission-management/#api-api-latest-admin-users-remove-group-post

func (*DataCenterClient) RevokeGroupProjectPermission

func (d *DataCenterClient) RevokeGroupProjectPermission(ctx context.Context, projectKey, groupName string) error

RevokeGroupProjectPermission Revoke group project permission. https://developer.atlassian.com/server/bitbucket/rest/v819/api-group-project/#api-api-latest-projects-projectkey-permissions-groups-delete

func (*DataCenterClient) RevokeGroupRepositoryPermission

func (d *DataCenterClient) RevokeGroupRepositoryPermission(ctx context.Context, projectKey, repositorySlug, groupName string) error

RevokeGroupRepositoryPermission Revoke group repository permission https://developer.atlassian.com/server/bitbucket/rest/v819/api-group-permission-management/#api-api-latest-projects-projectkey-repos-repositoryslug-permissions-groups-delete

func (*DataCenterClient) RevokeUserProjectPermission

func (d *DataCenterClient) RevokeUserProjectPermission(ctx context.Context, projectKey, userName string) error

RevokeUserProjectPermission Revoke user project permission https://developer.atlassian.com/server/bitbucket/rest/v819/api-group-project/#api-api-latest-projects-projectkey-permissions-users-delete

func (*DataCenterClient) RevokeUserRepositoryPermission

func (d *DataCenterClient) RevokeUserRepositoryPermission(ctx context.Context, projectKey, repositorySlug, userName string) error

RevokeUserRepositoryPermission Revoke user repository permission https://developer.atlassian.com/server/bitbucket/rest/v819/api-group-permission-management/#api-api-latest-projects-projectkey-repos-repositoryslug-permissions-users-delete

func (*DataCenterClient) UpdateGroupProjectPermission

func (d *DataCenterClient) UpdateGroupProjectPermission(ctx context.Context, projectKey, groupName, permission string) error

UpdateGroupProjectPermission Update group project permission. Available project permissions are: PROJECT_READ, PROJECT_WRITE, PROJECT_ADMIN https://developer.atlassian.com/server/bitbucket/rest/v819/api-group-project/#api-api-latest-projects-projectkey-permissions-groups-put

func (*DataCenterClient) UpdateGroupRepositoryPermission

func (d *DataCenterClient) UpdateGroupRepositoryPermission(ctx context.Context, projectKey, repositorySlug, groupName, permission string) error

UpdateGroupRepositoryPermission Update group repository permission https://developer.atlassian.com/server/bitbucket/rest/v819/api-group-permission-management/#api-api-latest-projects-projectkey-repos-repositoryslug-permissions-groups-put

func (*DataCenterClient) UpdateUserProjectPermission

func (d *DataCenterClient) UpdateUserProjectPermission(ctx context.Context, projectKey, userName, permission string) error

UpdateUserProjectPermission Update user project permission. Available project permissions are: PROJECT_READ, PROJECT_WRITE, PROJECT_ADMIN https://developer.atlassian.com/server/bitbucket/rest/v819/api-group-project/#api-api-latest-projects-projectkey-permissions-users-put

func (*DataCenterClient) UpdateUserRepositoryPermission

func (d *DataCenterClient) UpdateUserRepositoryPermission(ctx context.Context, projectKey, repositorySlug, userName, permission string) error

UpdateUserRepositoryPermission Update user repository permission https://developer.atlassian.com/server/bitbucket/rest/v819/api-group-permission-management/#api-api-latest-projects-projectkey-repos-repositoryslug-permissions-users-put

func (*DataCenterClient) WithBearerToken

func (d *DataCenterClient) WithBearerToken(bitbucketToken string) *DataCenterClient

func (*DataCenterClient) WithPassword

func (d *DataCenterClient) WithPassword(bitbucketPassword string) *DataCenterClient

func (*DataCenterClient) WithUser

func (d *DataCenterClient) WithUser(bitbucketUsername string) *DataCenterClient

type GlobalGroupPermissionsAPIData

type GlobalGroupPermissionsAPIData struct {
	Size              int                 `json:"size,omitempty"`
	Limit             int                 `json:"limit,omitempty"`
	IsLastPage        bool                `json:"isLastPage,omitempty"`
	GroupsPermissions []GroupsPermissions `json:"values,omitempty"`
	Start             int                 `json:"start,omitempty"`
	NextPageStart     int                 `json:"nextPageStart,omitempty"`
}

type GlobalPermissionsAPIData

type GlobalPermissionsAPIData struct {
	Size             int                `json:"size,omitempty"`
	Limit            int                `json:"limit,omitempty"`
	IsLastPage       bool               `json:"isLastPage,omitempty"`
	UsersPermissions []UsersPermissions `json:"values,omitempty"`
	Start            int                `json:"start,omitempty"`
	NextPageStart    int                `json:"nextPageStart,omitempty"`
}

type GroupPermissionsAPIData

type GroupPermissionsAPIData struct {
	Size              int                 `json:"size,omitempty"`
	Limit             int                 `json:"limit,omitempty"`
	IsLastPage        bool                `json:"isLastPage,omitempty"`
	GroupsPermissions []GroupsPermissions `json:"values,omitempty"`
	Start             int                 `json:"start,omitempty"`
	NextPageStart     int                 `json:"nextPageStart,omitempty"`
}

type Groups

type Groups struct {
	Name string `json:"name,omitempty"`
}

type GroupsAPIData

type GroupsAPIData struct {
	Size          int      `json:"size,omitempty"`
	Limit         int      `json:"limit,omitempty"`
	IsLastPage    bool     `json:"isLastPage,omitempty"`
	Groups        []string `json:"values,omitempty"`
	Start         int      `json:"start,omitempty"`
	NextPageStart int      `json:"nextPageStart,omitempty"`
}

type GroupsPermissions

type GroupsPermissions struct {
	Group      Groups `json:"group,omitempty"`
	Permission string `json:"permission,omitempty"`
}

type Members

type Members struct {
	Name           string   `json:"name,omitempty"`
	EmailAddress   string   `json:"emailAddress,omitempty"`
	Active         bool     `json:"active,omitempty"`
	DisplayName    string   `json:"displayName,omitempty"`
	ID             int      `json:"id,omitempty"`
	Slug           string   `json:"slug,omitempty"`
	Type           string   `json:"type,omitempty"`
	DirectoryName  string   `json:"directoryName,omitempty"`
	Deletable      bool     `json:"deletable,omitempty"`
	MutableDetails bool     `json:"mutableDetails,omitempty"`
	MutableGroups  bool     `json:"mutableGroups,omitempty"`
	Links          UserSelf `json:"links,omitempty"`
}

type MembersAPIData

type MembersAPIData struct {
	Size          int       `json:"size,omitempty"`
	Limit         int       `json:"limit,omitempty"`
	IsLastPage    bool      `json:"isLastPage,omitempty"`
	Members       []Members `json:"values,omitempty"`
	Start         int       `json:"start,omitempty"`
	NextPageStart int       `json:"nextPageStart,omitempty"`
}

type Page

type Page struct {
	PreviousPage *string `json:"previous_page"`
	NextPage     *string `json:"nextPageStart"`
	Count        int64   `json:"size"`
}

Page is base struct for resource pagination.

func (Page) HasNext

func (p Page) HasNext() bool

HasNext checks if the Page has next page.

func (Page) HasPrev

func (p Page) HasPrev() bool

HasPrev checks if the Page has previous page.

type PageOptions

type PageOptions struct {
	PerPage int `url:"limit,omitempty"`
	Page    int `url:"page,omitempty"`
}

PageOptions is options for list method of paginatable resources. It's used to create query string.

type ProjectSelf

type ProjectSelf struct {
	Self any `json:"self,omitempty"`
}

type Projects

type Projects struct {
	Key    string      `json:"key,omitempty"`
	ID     int         `json:"id,omitempty"`
	Name   string      `json:"name,omitempty"`
	Public bool        `json:"public,omitempty"`
	Type   string      `json:"type,omitempty"`
	Links  ProjectSelf `json:"links,omitempty"`
}

type ProjectsAPIData

type ProjectsAPIData struct {
	Size          int        `json:"size,omitempty"`
	Limit         int        `json:"limit,omitempty"`
	IsLastPage    bool       `json:"isLastPage,omitempty"`
	Projects      []Projects `json:"values,omitempty"`
	Start         int        `json:"start,omitempty"`
	NextPageStart int        `json:"nextPageStart,omitempty"`
}

type Repos

type Repos struct {
	Slug          string   `json:"slug,omitempty"`
	ID            int      `json:"id,omitempty"`
	Name          string   `json:"name,omitempty"`
	HierarchyId   string   `json:"hierarchyId,omitempty"`
	ScmId         string   `json:"scmId,omitempty"`
	State         string   `json:"state,omitempty"`
	StatusMessage string   `json:"statusMessage,omitempty"`
	Forkable      bool     `json:"forkable,omitempty"`
	Project       Projects `json:"project,omitempty"`
}

type ReposAPIData

type ReposAPIData struct {
	Size          int     `json:"size,omitempty"`
	Limit         int     `json:"limit,omitempty"`
	IsLastPage    bool    `json:"isLastPage,omitempty"`
	Repos         []Repos `json:"values,omitempty"`
	Start         int     `json:"start,omitempty"`
	NextPageStart int     `json:"nextPageStart,omitempty"`
}

type UserSelf

type UserSelf struct {
	Self any `json:"self,omitempty"`
}

type Users

type Users struct {
	Name         string   `json:"name,omitempty"`
	EmailAddress string   `json:"emailAddress,omitempty"`
	Active       bool     `json:"active,omitempty"`
	DisplayName  string   `json:"displayName,omitempty"`
	ID           int      `json:"id,omitempty"`
	Slug         string   `json:"slug,omitempty"`
	Type         string   `json:"type,omitempty"`
	Links        UserSelf `json:"links,omitempty"`
}

type UsersAPIData

type UsersAPIData struct {
	Size          int     `json:"size,omitempty"`
	Limit         int     `json:"limit,omitempty"`
	IsLastPage    bool    `json:"isLastPage,omitempty"`
	Users         []Users `json:"values,omitempty"`
	Start         int     `json:"start,omitempty"`
	NextPageStart int     `json:"nextPageStart,omitempty"`
}

type UsersPermissions

type UsersPermissions struct {
	User       Users  `json:"user,omitempty"`
	Permission string `json:"permission,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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