pub struct GitHubClient { /* private fields */ }Implementations§
Source§impl GitHubClient
impl GitHubClient
pub fn new(token: &str, base_url: Url) -> Result<Self>
Sourcepub async fn start_upload(
&self,
name: &str,
expires_at: Option<DateTime<Utc>>,
) -> Result<BlobClient>
pub async fn start_upload( &self, name: &str, expires_at: Option<DateTime<Utc>>, ) -> Result<BlobClient>
Start an upload of an artifact. It returns a BlobClient which should be used to upload
your data. Once all the data has been written, Self::finish_upload must be called to
finalize the upload.
The given name needs to be something unique, an error should be returned on collision.
Sourcepub async fn finish_upload(
&self,
name: &str,
content_length: usize,
) -> Result<()>
pub async fn finish_upload( &self, name: &str, content_length: usize, ) -> Result<()>
Meant to be called on an upload which was started via Self::start_upload which has had
all its data uploaded with the returned BlobClient. Once it returns success, the
artifact should be immediately available to be downloaded. If called on an artifact not in
this state, an error should be returned.
Sourcepub async fn upload(
&self,
name: &str,
expires_at: Option<DateTime<Utc>>,
content: impl Into<Body>,
) -> Result<()>
pub async fn upload( &self, name: &str, expires_at: Option<DateTime<Utc>>, content: impl Into<Body>, ) -> Result<()>
Upload the given content as an artifact. Once it returns success, the artifact should be
immediately available for download. The given content can be an in-memory buffer or a
FileStream created using FileStreamBuilder.
Sourcepub async fn list(&self) -> Result<Vec<Artifact>>
pub async fn list(&self) -> Result<Vec<Artifact>>
List all the given artifacts accessible to the current workflow run.
Sourcepub async fn get(&self, name: &str) -> Result<Option<Artifact>>
pub async fn get(&self, name: &str) -> Result<Option<Artifact>>
Get the artifact represented by the given name if it exists.
Sourcepub async fn get_by_id(&self, id: DatabaseId) -> Result<Option<Artifact>>
pub async fn get_by_id(&self, id: DatabaseId) -> Result<Option<Artifact>>
Get the artifact represented by the given id if it exists.
Sourcepub async fn start_download(
&self,
backend_ids: BackendIds,
name: &str,
) -> Result<BlobClient>
pub async fn start_download( &self, backend_ids: BackendIds, name: &str, ) -> Result<BlobClient>
Start a download of an artifact identified by the given name. The returned BlobClient
should be used to download all or part of the data.
The backend_ids must be the ones for the artifact obtained from Self::list. An
individual uploader should end up with the same backend_ids for all artifacts it uploads.
Sourcepub async fn download(
&self,
backend_ids: BackendIds,
name: &str,
) -> Result<impl AsyncRead + Unpin + Send + Sync + 'static>
pub async fn download( &self, backend_ids: BackendIds, name: &str, ) -> Result<impl AsyncRead + Unpin + Send + Sync + 'static>
Return a stream that downloads all the contents of the artifacts represented by the given name.
The backend_ids must be the ones for the artifact obtained from Self::list. An
individual uploader should end up with the same backend_ids for all artifacts it uploads.