pub struct DockerHubClient {
pub client: Client,
pub url: Url,
}Expand description
Struct that holds the client and the URL to send request to the Docker Hub
Fields§
§client: ClientContains the instace for the reqwest Client with the required headers and configuration if any.
url: UrlHolds the URL for the Docker Hub (https://hub.docker.com)
Implementations§
Source§impl DockerHubClient
impl DockerHubClient
Sourcepub fn new(token: &str) -> Result<Self>
pub fn new(token: &str) -> Result<Self>
Creates a new instance of DockerHubClient with the provided authentication
This method creates a new instance of the DockerHubClient with the provided token, which should have read access to the Docker Hub, to be able to call the rest of the methods within this struct. This method will configure and setup the HTTP client that will be used within the rest of the methods to send requests to the Docker Hub.
Sourcepub async fn list_repositories(&self, org: &str) -> Result<Vec<Repository>>
pub async fn list_repositories(&self, org: &str) -> Result<Vec<Repository>>
List all the repositories under a given org or username on the Docker Hub
This method lists all the repositories for a given organization or user via
the org argument that are uploaded and publicly available on the Docker Hub.
Note that if the repository is private but the provided token has access to it,
then the repositories will be listed, otherwise only the public ones (if any)
will be listed.
List all the tags for a given repository on the Docker Hub
This method expects both the organization or username via the org
argument plus the repository name for the repository that the tags
will be listed for.