Documentation
¶
Index ¶
- func String(s string) *string
- func StringValue(s *string) string
- type AuthService
- type Client
- type CreateOrganizationRequest
- type CreateRepositoryRequest
- type ListOptions
- type LoginRequest
- type LoginResponse
- type Organization
- type OrganizationList
- type OrganizationService
- type RepositoriesService
- func (s *RepositoriesService) CreateRepository(ctx context.Context, namespace, name, description string, isPrivate bool) (*Repository, error)
- func (s *RepositoriesService) EditRepository(ctx context.Context, namespace, repo string, patch *RepositoryPatch) (*Repository, error)
- func (s *RepositoriesService) GetRepositories(ctx context.Context, namespace string, opt *ListOptions) (*RepositoryList, error)
- func (s *RepositoriesService) GetRepository(ctx context.Context, namespace, repo string) (*Repository, error)
- func (s *RepositoriesService) SetRepositoryPrivacy(ctx context.Context, namespace, repo string, isPrivate bool) error
- type Repository
- type RepositoryList
- type RepositoryPatch
- type RepositoryPermissions
- type RepositoryPrivacyPatch
- type TagService
- type Tags
- type User
- type UserService
- type Webhook
- type WebhookRequest
- type WebhookService
- type Webhooks
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StringValue ¶
StringValue returns the value of a String pointer
Types ¶
type AuthService ¶
type AuthService service
AuthService handles communication with the auth related methods of the Dockerhub API.
type Client ¶
type Client struct {
BaseURL *url.URL
UserAgent string
Auth *AuthService
Repositories *RepositoriesService
User *UserService
Webhook *WebhookService
Organization *OrganizationService
Tag *TagService
// contains filtered or unexported fields
}
A Client manages communication with the Dockerhub API.
func NewClient ¶
NewClient returns a new Dockerhub client. If an httpClient is not provided, a new http.Client will be used.
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v.
func (*Client) NewRequest ¶
NewRequest creates an API request. The given URL is relative to the Client's BaseURL.
func (*Client) SetAuthToken ¶
SetAuthToken sets the Authorization token on the client to be sent with API requests.
type CreateOrganizationRequest ¶ added in v1.0.2
type CreateOrganizationRequest struct {
Orgname string `json:"orgname"`
Company string `json:"company"`
}
CreateOrganizationRequest struct
type CreateRepositoryRequest ¶
type CreateRepositoryRequest struct {
Namespace string `json:"namespace"`
Registry string `json:"registry"`
Image string `json:"image"`
Name string `json:"name"`
Description string `json:"description"`
Privacy string `json:"privacy"`
BuildSettings []interface{} `json:"build_settings"`
IsPrivate bool `json:"is_private"`
}
type ListOptions ¶
type ListOptions struct {
// For paginated result sets, page of results to retrieve.
Page int `url:"page,omitempty"`
// For paginated result sets, the number of results to include per page.
PageSize int `url:"page_size,omitempty"`
}
ListOptions specifies the optional parameters to various List methods that support pagination.
type LoginRequest ¶
LoginRequest represents the payload to be sent to login to the Dockerhub API.
type LoginResponse ¶
type LoginResponse struct {
Token string `json:"token"`
}
LoginResponse represents the payload to be responded to a successful Dockerhub API login request.
type Organization ¶ added in v1.0.2
type Organization struct {
ID string `json:"id"`
Orgname string `json:"orgname"`
FullName string `json:"full_name"`
Location string `json:"location"`
Company string `json:"company"`
ProfileURL string `json:"profile_url"`
DateJoined time.Time `json:"date_joined"`
GravatarURL string `json:"gravatar_url"`
GravatarEmail string `json:"gravatar_email"`
Type string `json:"type"`
}
Organization struct
type OrganizationList ¶ added in v1.0.2
type OrganizationList struct {
Count int `json:"count"`
Next interface{} `json:"next"`
Previous interface{} `json:"previous"`
Results []struct {
ID string `json:"id"`
Orgname string `json:"orgname"`
FullName string `json:"full_name"`
Location string `json:"location"`
Company string `json:"company"`
ProfileURL string `json:"profile_url"`
DateJoined time.Time `json:"date_joined"`
GravatarURL string `json:"gravatar_url"`
GravatarEmail string `json:"gravatar_email"`
Type string `json:"type"`
} `json:"results"`
}
OrganizationList Struct
type OrganizationService ¶ added in v1.0.2
type OrganizationService service
OrganizationService Type Service
func (*OrganizationService) CreateOrganization ¶ added in v1.0.2
func (s *OrganizationService) CreateOrganization(ctx context.Context, organization, company string) (*Organization, error)
CreateOrganization Create new Organization
func (*OrganizationService) GetOrganizations ¶ added in v1.0.2
func (s *OrganizationService) GetOrganizations(ctx context.Context, pageSize int) (*OrganizationList, error)
GetOrganizations all organizations of user
type RepositoriesService ¶
type RepositoriesService service
RepositoriesService handles communication with the repository related methods of the Dockerhub API.
func (*RepositoriesService) CreateRepository ¶
func (s *RepositoriesService) CreateRepository(ctx context.Context, namespace, name, description string, isPrivate bool) (*Repository, error)
CreateRepository create a repository.
func (*RepositoriesService) EditRepository ¶
func (s *RepositoriesService) EditRepository(ctx context.Context, namespace, repo string, patch *RepositoryPatch) (*Repository, error)
EditRepository updates a repository.
func (*RepositoriesService) GetRepositories ¶
func (s *RepositoriesService) GetRepositories(ctx context.Context, namespace string, opt *ListOptions) (*RepositoryList, error)
GetRepositories gets all repositories from a given Dockerhub namespace.
func (*RepositoriesService) GetRepository ¶
func (s *RepositoriesService) GetRepository(ctx context.Context, namespace, repo string) (*Repository, error)
GetRepository gets details for a given repository.
func (*RepositoriesService) SetRepositoryPrivacy ¶
func (s *RepositoriesService) SetRepositoryPrivacy(ctx context.Context, namespace, repo string, isPrivate bool) error
SetRepositoryPrivacy sets the privacy status of a repository.
type Repository ¶
type Repository struct {
User string `json:"user"`
Name string `json:"name"`
Namespace string `json:"namespace"`
RepositoryType string `json:"repository_type"`
Status int `json:"status"`
Description string `json:"description"`
IsPrivate bool `json:"is_private"`
IsAutomated bool `json:"is_automated"`
CanEdit bool `json:"can_edit"`
StarCount int `json:"star_count"`
PullCount int `json:"pull_count"`
LastUpdated string `json:"last_updated"`
IsMigrated bool `json:"is_migrated"`
HasStarred bool `json:"has_starred"`
FullDescription string `json:"full_description"`
Affiliation *string `json:"affiliation"`
Permissions RepositoryPermissions `json:"repository_permissions"`
}
Repository represents a Dockerhub repository.
type RepositoryList ¶
type RepositoryList struct {
Count int `json:"count"`
Next *string `json:"next"`
Previous *string `json:"previous"`
Results []Repository `json:"results"`
}
RepositoryList represents a list of repositories with pagination details.
type RepositoryPatch ¶
type RepositoryPatch struct {
FullDescription string `json:"full_description,omitempty"`
Description string `json:"description,omitempty"`
}
RepositoryPatch represents payload to patch a Repository.
type RepositoryPermissions ¶
type RepositoryPermissions struct {
Read bool `json:"read"`
Write bool `json:"write"`
Admin bool `json:"admin"`
}
RepositoryPermissions specifies the permissions of the requesting user to the given Repository.
type RepositoryPrivacyPatch ¶
type RepositoryPrivacyPatch struct {
IsPrivate bool `json:"is_private"`
}
RepositoryPrivacyPatch represents payload to patch a Repository's privacy mode.
type Tags ¶ added in v1.0.2
type Tags struct {
Count int `json:"count"`
Next interface{} `json:"next"`
Previous interface{} `json:"previous"`
Results []struct {
Creator int `json:"creator"`
ID int `json:"id"`
ImageID interface{} `json:"image_id"`
Images []struct {
Architecture string `json:"architecture"`
Features string `json:"features"`
Variant interface{} `json:"variant"`
Digest string `json:"digest"`
Os string `json:"os"`
OsFeatures string `json:"os_features"`
OsVersion interface{} `json:"os_version"`
Size int `json:"size"`
Status string `json:"status"`
LastPulled time.Time `json:"last_pulled"`
LastPushed time.Time `json:"last_pushed"`
} `json:"images"`
LastUpdated time.Time `json:"last_updated"`
LastUpdater int `json:"last_updater"`
LastUpdaterUsername string `json:"last_updater_username"`
Name string `json:"name"`
Repository int `json:"repository"`
FullSize int `json:"full_size"`
V2 bool `json:"v2"`
TagStatus string `json:"tag_status"`
TagLastPulled time.Time `json:"tag_last_pulled"`
TagLastPushed time.Time `json:"tag_last_pushed"`
} `json:"results"`
}
Tags response
type User ¶
type User struct {
ID string `json:"id"`
Username string `json:"username"`
FullName string `json:"full_name"`
Location string `json:"location"`
Company string `json:"company"`
GravatarEmail string `json:"gravatar_email"`
IsStaff bool `json:"is_staff"`
IsAdmin bool `json:"is_admin"`
ProfileURL string `json:"profile_url"`
DateJoined time.Time `json:"date_joined"`
GravatarURL string `json:"gravatar_url"`
Type string `json:"type"`
}
type UserService ¶
type UserService service
func (*UserService) GetLoggedInUser ¶
func (s *UserService) GetLoggedInUser(ctx context.Context) (*User, error)
type WebhookRequest ¶
type WebhookService ¶
type WebhookService service