Adding support for creating Codespaces and getting available machine types (#2929)

Adding support for creating Codespaces
This commit is contained in:
Aaron Junker-Wildi
2024-07-29 22:43:50 +02:00
committed by GitHub
parent 148162a34b
commit 35f1784781
11 changed files with 181 additions and 3 deletions
+21
View File
@@ -5604,6 +5604,22 @@ namespace Octokit
return "orgs/{0}/actions/runner-groups/{1}/repositories".FormatUri(org, runnerGroupId);
}
/// <summary>
/// Returns the <see cref="Uri"/> that handles the machine availability for a repository.
/// </summary>
/// <param name="owner">The owner of the repository.</param>
/// <param name="repo">The name of the repository.</param>
/// <param name="reference">The reference to check the machine availability for.</param>
public static Uri GetAvailableMachinesForRepo(string owner, string repo, string reference)
{
if (reference is null)
{
return "repos/{0}/{1}/codespaces/machines".FormatUri(owner, repo);
}
return "repos/{0}/{1}/actions/runners/availability?ref={3}".FormatUri(owner, repo, reference);
}
/// <summary>
/// Returns the <see cref="Uri"/> that handles adding or removing of copilot licenses for an organisation
/// </summary>
@@ -5659,6 +5675,11 @@ namespace Octokit
return "user/codespaces/{0}/stop".FormatUri(codespaceName);
}
public static Uri CreateCodespace(string owner, string repo)
{
return "repos/{0}/{1}/codespaces".FormatUri(owner, repo);
}
/// <summary>
/// Returns the <see cref="Uri"/> that lists the artifacts for a repository.
/// </summary>