Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/kd_clients/mod.ts>ReleaseClient

Various HTTP clients for miscellaneous use.
Latest
class ReleaseClient
extends GitHubClient
import { ReleaseClient } from "https://deno.land/x/kd_clients@v1.0.0-preview.14/mod.ts";

Provides a client for interacting with GitHub releases.

Constructors

new
ReleaseClient(
ownerName: string,
repoName: string,
token: string,
)

Initializes a new instance of the ReleaseClient class.

Methods

private
getReleasesInternal(page: number, qtyPerPage: number): Promise<[ReleaseModel[], Response]>

Gets the given page where each page quantity is the given qtyPerPage, for a repository with a name that matches the given ReleaseClient.this.repoName,

private
normalizePath(path: string): string

Normalizes the given path by removing any trailing slashes and converting backslashes to forward slashes.

private
uploadAssetInternal(filePath: string, releaseId: number): Promise<void>

Uploads a file as a release asset at the given filePath to a release that matches the given releaseId.

assetExists(releaseIdOrTag: number | string, assetIdOrName: number | string): Promise<boolean>

Returns a value indicating whether a release with an id or tag matches the given releaseIdOrTag, and a release asset with an id or name matches the given assetIdOrName.

deleteAsset(
releaseIdOrTag: number | string,
assetIdOrName: number | string,
errorWhenNotFound?: boolean,
): Promise<void>

Deletes an asset with an id or name that matches the given assetIdOrName, from a release with an id or tag that matches the given releaseIdOrTag.

downloadAllAssetsByReleaseName(
name: string,
dirPath: string,
overwrite?: boolean,
onProgress?: (assetId: number, filePath: string) => void,
): Promise<void>

Downloads all assets for a release with the given tagName to the given dirPath.

downloadAllAssetsByReleaseTag(
tagName: string,
dirPath: string,
overwrite?: boolean,
onProgress?: (assetId: number, filePath: string) => void,
): Promise<void>

Downloads all assets for a release with the given tagName to the given dirPath.

downloadAllLatestReleaseAssets(
dirPath: string,
overwrite?: boolean,
onProgress?: (assetId: number, filePath: string) => void,
): Promise<void>

Downloads all assets for the latest non-prerelease and non-draft release, to the given dirPath.

downloadAssetById(
assetId: number,
dirPath: string,
fileName: string,
overwrite?: boolean,
onProgress?: (assetId: number, filePath: string) => void,
): Promise<void>

Downloads an asset with an id that matches the given assetId to the given dirPath.

getAllAssetsByTag(releaseTagName: string): Promise<AssetModel[]>

Gets all assets for a release with the given releaseTagName.

getAllReleases(): Promise<ReleaseModel[]>

Gets all releases for a repository.

getAsset(releaseIdOrTag: number | string, assetIdOrName: number | string): Promise<AssetModel>

Gets a single asset with an id or name that matches the given assetIdOrName, for a release with an id or tag that matches the given releaseIdOrTag.

getLatestRelease(): Promise<ReleaseModel>

Gets the latest release.

getReleaseById(releaseId: number): Promise<ReleaseModel>

Gets a release with and id that matches the given releaseId.

getReleaseByName(name: string): Promise<ReleaseModel>

Gets a release with a name that matches the given release name.

getReleaseByTag(tagName: string): Promise<ReleaseModel>

Gets a release with and id that matches the given releaseId.

getReleases(page: number, qtyPerPage: number): Promise<ReleaseModel[]>

Gets the given page where each page quantity is the given qtyPerPage, for a repository with a name that matches the given ReleaseClient.this.repoName,

releaseExists(tagName: string): Promise<boolean>

Returns a value indicating whether or not a release is tied to a tag that matches the given tagName, for a repository with a name that matches the given ReleaseClient.this.repoName.

updateReleaseById(id: number, text: string): Promise<void>

Updates a release with the given text where the release has the given id.

updateReleaseByTag(tag: string, text: string): Promise<void>

Updates a release with the given text where the release is for the given tag.

uploadAsset(
releaseIdOrTag: number | string,
filePath: string,
overwrite?: boolean,
): Promise<void>

Uploads an asset to a release that matches a tag or id by the given releaseIdOrTag.

uploadAssetsByReleaseName(name: string, filePaths: string[]): Promise<void>

Uploads one or more assets to a release with a name that matches the given name.

uploadAssetsByReleaseTag(tag: string, filePaths: string[]): Promise<void>

Uploads one or more assets to a release with a name that matches the given tag.