Documentation
¶
Index ¶
- func String(s string) *string
- func StringValue(s *string) string
- type AuthService
- type Client
- type CreateRepositoryRequest
- type LoginRequest
- type LoginResponse
- 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) (*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 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 // 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 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 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 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)
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) (*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 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