using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace Octokit
{
///
/// A client for GitHub's Codespaces API.
/// Gets and creates Codespaces.
///
///
/// See the Codespaces API documentation for more information.
///
public class CodespacesClient : ApiClient, ICodespacesClient
{
///
/// Instantiates a new GitHub Codespaces API client.
///
///
public CodespacesClient(IApiConnection apiConnection) : base(apiConnection)
{
}
///
/// Returns all the codespaces for the authenticated user.
///
/// A codespaces collection
[ManualRoute("GET", "/user/codespaces")]
public Task GetAll()
{
return ApiConnection.Get(ApiUrls.Codespaces());
}
///
/// Returns all the codespaces for the specified repository.
///
///
///
/// A codespaces collection
[ManualRoute("GET", "/repos/{owner}/{repo}/codespaces")]
public Task GetForRepository(string owner, string repo)
{
return ApiConnection.Get(ApiUrls.CodespacesForRepository(owner, repo));
}
///
/// Gets a codespace for the authenticated user.
///
///
/// A codespace
[ManualRoute("GET", "/user/codespaces/{codespace_name}")]
public Task Get(string codespaceName)
{
return ApiConnection.Get(ApiUrls.Codespace(codespaceName));
}
///
/// Starts a codespace for the authenticated user.
///
///
///
[ManualRoute("POST", "/user/codespaces/{codespace_name}/start")]
public Task Start(string codespaceName)
{
return ApiConnection.Post(ApiUrls.CodespaceStart(codespaceName));
}
///
/// Stops a codespace for the authenticated user.
///
///
///
[ManualRoute("POST", "/user/codespaces/{codespace_name}/stop")]
public Task Stop(string codespaceName)
{
return ApiConnection.Post(ApiUrls.CodespaceStop(codespaceName));
}
}
}