-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
172 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using Octokit.Models.Response; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Octokit.Clients | ||
{ | ||
/// <summary> | ||
/// A client for GitHub's Repository Pages API. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://developer.github.com/v3/repos/pages//">Repository Pages API documentation</a> for more information. | ||
/// </remarks> | ||
interface IRepositoryPagesClient | ||
{ | ||
/// <summary> | ||
/// Gets the page metadata for a given repository | ||
/// </summary> | ||
/// <param name="owner">The owner of the repository</param> | ||
/// <param name="name">The name of the repository</param> | ||
/// <returns></returns> | ||
Task<IReadOnlyList<Page>> Get(string owner, string repositoryName); | ||
/// <summary> | ||
/// Gets all build metadata for a given repository | ||
/// </summary> | ||
/// <param name="owner">The owner of the repository</param> | ||
/// <param name="name">The name of the repository</param> | ||
/// <returns></returns> | ||
Task<IReadOnlyList<PagesBuild>> GetBuilds(string owner, string repositoryName); | ||
/// <summary> | ||
/// Gets the build metadata for the last build for a given repository | ||
/// </summary> | ||
/// <param name="owner">The owner of the repository</param> | ||
/// <param name="name">The name of the repository</param> | ||
/// <returns></returns> | ||
Task<PagesBuild> GetLatestBuild(string owner, string repositoryName); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Octokit.Models.Response | ||
{ | ||
public enum PagesBuildStatus | ||
{ | ||
/// <summary> | ||
/// The site has yet to be built | ||
/// </summary> | ||
Null, | ||
/// <summary> | ||
/// The build is in progress | ||
/// </summary> | ||
Building, | ||
/// <summary> | ||
/// The site has been built | ||
/// </summary> | ||
Built, | ||
/// <summary> | ||
/// An error occurred during the build | ||
/// </summary> | ||
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Errored")] | ||
Errored, | ||
} | ||
|
||
///<summary> | ||
/// Information about your GitHub Pages configuration | ||
///</summary> | ||
[DebuggerDisplay("{DebuggerDisplay,nq}")] | ||
public class Page | ||
{ | ||
public Page() { } | ||
|
||
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "cname")] | ||
public Page(string url, PagesBuildStatus status, string cname, bool custom404) | ||
{ | ||
Url = url; | ||
Status = status; | ||
CName = cname; | ||
Custom404 = custom404; | ||
} | ||
|
||
/// <summary> | ||
/// The pages's API URL. | ||
/// </summary> | ||
public string Url { get; protected set; } | ||
/// <summary> | ||
/// Build status of the pages site. | ||
/// </summary> | ||
public PagesBuildStatus Status { get; protected set; } | ||
/// <summary> | ||
/// CName of the pages site. Will be null if no CName was provided by the user. | ||
/// </summary> | ||
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "CName")] | ||
public string CName { get; protected set; } | ||
/// <summary> | ||
/// Is a custom 404 page provided. | ||
/// </summary> | ||
public bool Custom404 { get; protected set; } | ||
|
||
internal string DebuggerDisplay | ||
{ | ||
get | ||
{ | ||
return string.Format(CultureInfo.InvariantCulture, "CName: {0}, Status: {1}", CName, Status.ToString()); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Octokit.Models.Response | ||
{ | ||
/// <summary> | ||
/// Metadata of a Github Pages build. | ||
/// </summary> | ||
[DebuggerDisplay("{DebuggerDisplay,nq}")] | ||
public class PagesBuild | ||
{ | ||
public PagesBuild() { } | ||
|
||
public PagesBuild(string url, PagesBuildStatus status, User pusher, Commit commit, TimeSpan duration, DateTime createdAt, DateTime updatedAt) | ||
{ | ||
Url = url; | ||
Status = status; | ||
Pusher = pusher; | ||
Commit = commit; | ||
Duration = duration; | ||
CreatedAt = createdAt; | ||
UpdatedAt = updatedAt; | ||
} | ||
|
||
/// <summary> | ||
/// The pages's API URL. | ||
/// </summary> | ||
public string Url { get; protected set; } | ||
/// <summary> | ||
/// The status of the build. | ||
/// </summary> | ||
public PagesBuildStatus Status { get; protected set; } | ||
/// <summary> | ||
/// The user whose commit intiated the build. | ||
/// </summary> | ||
public User Pusher { get; protected set; } | ||
/// <summary> | ||
/// Commit SHA. | ||
/// </summary> | ||
public Commit Commit { get; protected set; } | ||
/// <summary> | ||
/// Duration of the build | ||
/// </summary> | ||
public TimeSpan Duration { get; protected set; } | ||
public DateTime CreatedAt { get; protected set; } | ||
public DateTime UpdatedAt { get; protected set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters