[feat]: SDKs for ActionsArtifacts APIs

This commit is contained in:
Tom Longhurst
2023-09-25 20:16:41 +01:00
committed by GitHub
parent 03e7644f5e
commit 958bc5f1f8
20 changed files with 621 additions and 30 deletions
@@ -0,0 +1,32 @@
using System.Diagnostics;
using System.Globalization;
using Octokit.Internal;
namespace Octokit
{
/// <summary>
/// Used to filter requests for lists of artifacts.
/// </summary>
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class ListArtifactsRequest : RequestParameters
{
/// <summary>
/// Filter artifacts by name.
/// </summary>
public string Name { get; set; }
/// <summary>
/// How many results to return per page (maximum 100).
/// </summary>
[Parameter(Key = "per_page")]
public int PerPage { get; set; } = 30;
/// <summary>
/// What page to retrieve.
/// </summary>
[Parameter(Key = "page")]
public int Page { get; set; } = 1;
internal string DebuggerDisplay => string.Format(CultureInfo.InvariantCulture, "Page: {0}, PerPage: {1} ", Page, PerPage);
}
}
+83
View File
@@ -0,0 +1,83 @@
using System;
using System.Diagnostics;
using System.Globalization;
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class Artifact
{
public Artifact()
{
}
public Artifact(long id, string nodeId, string name, int sizeInBytes, string url, string archiveDownloadUrl, bool expired, DateTime createdAt, DateTime expiresAt, DateTime updatedAt, ArtifactWorkflowRun workflowRun)
{
Id = id;
NodeId = nodeId;
Name = name;
SizeInBytes = sizeInBytes;
Url = url;
ArchiveDownloadUrl = archiveDownloadUrl;
Expired = expired;
CreatedAt = createdAt;
ExpiresAt = expiresAt;
UpdatedAt = updatedAt;
WorkflowRun = workflowRun;
}
/// <summary>
/// The artifact Id
/// </summary>
public long Id { get; private set; }
/// <summary>
/// The artifact node Id
/// </summary>
public string NodeId { get; private set; }
/// <summary>
/// The name of the artifact
/// </summary>
public string Name { get; private set; }
/// <summary>
/// The size of the artifact in bytes
/// </summary>
public int SizeInBytes { get; private set; }
/// <summary>
/// The url for retrieving the artifact information
/// </summary>
public string Url { get; private set; }
/// <summary>
/// The url for downloading the artifact contents
/// </summary>
public string ArchiveDownloadUrl { get; private set; }
/// <summary>
/// True if the artifact has expired
/// </summary>
public bool Expired { get; private set; }
/// <summary>
/// The date and time when the artifact was created
/// </summary>
public DateTime CreatedAt { get; private set; }
/// <summary>
/// The date and time when the artifact expires
/// </summary>
public DateTime ExpiresAt { get; private set; }
/// <summary>
/// The date and time when the artifact was last updated
/// </summary>
public DateTime UpdatedAt { get; private set; }
/// <summary>
/// The workflow from where the artifact was created
/// </summary>
public ArtifactWorkflowRun WorkflowRun { get; private set; }
internal string DebuggerDisplay => string.Format(CultureInfo.InvariantCulture, "Id: {0}", Id);
}
@@ -0,0 +1,46 @@
using System.Diagnostics;
using System.Globalization;
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class ArtifactWorkflowRun
{
public ArtifactWorkflowRun()
{
}
public ArtifactWorkflowRun(long id, long repositoryId, long headRepositoryId, string headBranch, string headSha)
{
Id = id;
RepositoryId = repositoryId;
HeadRepositoryId = headRepositoryId;
HeadBranch = headBranch;
HeadSha = headSha;
}
/// <summary>
/// The workflow run Id
/// </summary>
public long Id { get; private set; }
/// <summary>
/// The repository Id
/// </summary>
public long RepositoryId { get; private set; }
/// <summary>
/// The head repository Id
/// </summary>
public long HeadRepositoryId { get; private set; }
/// <summary>
/// The head branch
/// </summary>
public string HeadBranch { get; private set; }
/// <summary>
/// The head Sha
/// </summary>
public string HeadSha { get; private set; }
internal string DebuggerDisplay => string.Format(CultureInfo.InvariantCulture, "Id: {0}", Id);
}
@@ -0,0 +1,29 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class ListArtifactsResponse
{
public ListArtifactsResponse()
{
}
public ListArtifactsResponse(int totalCount, IReadOnlyList<Artifact> artifacts)
{
TotalCount = totalCount;
Artifacts = artifacts;
}
/// <summary>
/// The number of artifacts found
/// </summary>
public int TotalCount { get; private set; }
/// <summary>
/// The list of found artifacts
/// </summary>
public IReadOnlyList<Artifact> Artifacts { get; private set; } = new List<Artifact>();
internal string DebuggerDisplay => string.Format(CultureInfo.InvariantCulture, "Artifacts: {0}", TotalCount);
}