client

package
v0.1.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ITEMSPERPAGE = 1000

To fetch 1000 results https://confluence.atlassian.com/bitbucketserverkb/how-to-apply-the-limit-filter-in-bitbucket-server-and-datacenter-rest-api-and-query-more-than-the-max-limit-of-1000-results-1142440445.html

Variables

This section is empty.

Functions

This section is empty.

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 GetCustomErr added in v0.0.9

func GetCustomErr(req *http.Request, resp *http.Response, err error) *BitbucketError

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) Do added in v0.1.0

func (d *DataCenterClient) Do(ctx context.Context, method string, uri *url.URL, body interface{}, response interface{}, reqOptions ...uhttp.RequestOption) (*http.Response, error)

func (*DataCenterClient) GetGlobalGroupPermissions

func (d *DataCenterClient) GetGlobalGroupPermissions(ctx context.Context, pToken *pagination.Token) ([]GroupsPermissions, string, error)

func (*DataCenterClient) GetGroupMembers

func (d *DataCenterClient) GetGroupMembers(ctx context.Context, groupName string, pToken *pagination.Token) ([]Members, string, 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, projectKey string, pToken *pagination.Token) ([]GroupsPermissions, string, error)

func (*DataCenterClient) GetGroupRepositoryPermissions

func (d *DataCenterClient) GetGroupRepositoryPermissions(ctx context.Context, projectKey, repositorySlug string, pToken *pagination.Token) ([]GroupsPermissions, string, error)

func (*DataCenterClient) GetGroups

func (d *DataCenterClient) GetGroups(ctx context.Context, pToken *pagination.Token) ([]string, string, 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, pToken *pagination.Token) ([]Projects, string, error)

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, pToken *pagination.Token) ([]Repos, string, error)

func (*DataCenterClient) GetUserProjectsPermissions

func (d *DataCenterClient) GetUserProjectsPermissions(ctx context.Context, projectKey string, pToken *pagination.Token) ([]UsersPermissions, string, error)

func (*DataCenterClient) GetUserRepositoryPermissions

func (d *DataCenterClient) GetUserRepositoryPermissions(ctx context.Context, projectKey, repositorySlug string, pToken *pagination.Token) ([]UsersPermissions, string, 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, pToken *pagination.Token) ([]User, string, error)

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) MakeURL added in v0.1.0

func (d *DataCenterClient) MakeURL(ctx context.Context, path string, queryParams map[string]string) (*url.URL, 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) RevokeGroupGlobalPermission added in v0.1.0

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

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) RevokeUserGlobalPermission added in v0.1.0

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

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) UpdateGroupGlobalPermission added in v0.1.0

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

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 The authenticated user must have REPO_ADMIN permission for the specified repository or a higher project or global permission to call this resource. https://developer.atlassian.com/server/bitbucket/rest/v819/api-group-permission-management/#api-api-latest-projects-projectkey-repos-repositoryslug-permissions-groups-put

func (*DataCenterClient) UpdateUserGlobalPermission added in v0.1.0

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

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) WithAuthorization added in v0.1.0

func (d *DataCenterClient) WithAuthorization() uhttp.RequestOption

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 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 User added in v0.0.5

type User 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 UserSelf

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

type UsersAPIData

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

type UsersPermissions

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

Jump to

Keyboard shortcuts

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