From 9dbff67b978eb8039b4913d48ea6eba86024ae27 Mon Sep 17 00:00:00 2001 From: Kir_Antipov Date: Sun, 16 Apr 2023 15:22:34 +0000 Subject: [PATCH] Made an interface that represents GitHub Release asset --- src/platforms/github/github-release-asset.ts | 111 +++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 src/platforms/github/github-release-asset.ts diff --git a/src/platforms/github/github-release-asset.ts b/src/platforms/github/github-release-asset.ts new file mode 100644 index 0000000..57377d6 --- /dev/null +++ b/src/platforms/github/github-release-asset.ts @@ -0,0 +1,111 @@ +import { FileInfo } from "@/utils/io"; +import { GitHubUser } from "./github-user"; + +/** + * GitHub asset definition. + */ +export interface GitHubReleaseAsset { + /** + * The URL of the asset in the GitHub API. + */ + url: string; + + /** + * The ID of the asset. + */ + id: number; + + /** + * The node ID of the asset in the GitHub API. + */ + node_id: string; + + /** + * The name of the asset. + */ + name: string; + + /** + * The label of the asset. + */ + label: string; + + /** + * The uploader of the asset. + */ + uploader: GitHubUser; + + /** + * The content type of the asset. + */ + content_type: string; + + /** + * The state of the asset (e.g., 'uploaded'). + */ + state: string; + + /** + * The size of the asset in bytes. + */ + size: number; + + /** + * The number of times the asset has been downloaded. + */ + download_count: number; + + /** + * The date the asset was created (ISO 8601 format). + */ + created_at: string; + + /** + * The date the asset was last updated (ISO 8601 format). + */ + updated_at: string; + + /** + * The URL of the asset for downloading through a web browser. + */ + browser_download_url: string; +} + +/** + * Used to identify a GitHub asset. + */ +export interface GitHubReleaseAssetIdentifier { + /** + * The account owner of the repository. + * + * The name is not case sensitive. + */ + owner: string; + + /** + * The name of the repository. + * + * The name is not case sensitive. + */ + repo: string; + + /** + * The unique identifier of the asset. + */ + id: number; +} + +/** + * Represents the initialization properties for a GitHub release asset. + */ +export interface GitHubReleaseAssetInit { + /** + * The URL of the release's upload endpoint in the GitHub API. + */ + upload_url: string; + + /** + * The file information for the asset to be added to the release. + */ + asset: string | FileInfo; +}