-
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.
Merge pull request #916 from octokit/consolidate-committer-info
Consolidate committer info
- Loading branch information
Showing
20 changed files
with
203 additions
and
104 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
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,61 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Globalization; | ||
|
||
namespace Octokit | ||
{ | ||
/// <summary> | ||
/// Represents the author or committer to a Git commit. This is the information stored in Git and should not be | ||
/// confused with GitHub account information. | ||
/// </summary> | ||
[DebuggerDisplay("{DebuggerDisplay,nq}")] | ||
public class Committer | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="Committer"/> class. | ||
/// </summary> | ||
public Committer() { } | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="Committer"/> class. | ||
/// </summary> | ||
/// <param name="name">The full name of the author or committer.</param> | ||
/// <param name="email">The email.</param> | ||
/// <param name="date">The date.</param> | ||
public Committer(string name, string email, DateTimeOffset date) | ||
{ | ||
Name = name; | ||
Email = email; | ||
Date = date; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the name of the author or committer. | ||
/// </summary> | ||
/// <value> | ||
/// The name. | ||
/// </value> | ||
public string Name { get; protected set; } | ||
|
||
/// <summary> | ||
/// Gets the email of the author or committer. | ||
/// </summary> | ||
/// <value> | ||
/// The email. | ||
/// </value> | ||
public string Email { get; protected set; } | ||
|
||
/// <summary> | ||
/// Gets the date of the author or contributor's contributions. | ||
/// </summary> | ||
/// <value> | ||
/// The date. | ||
/// </value> | ||
public DateTimeOffset Date { get; protected set; } | ||
|
||
internal string DebuggerDisplay | ||
{ | ||
get { return String.Format(CultureInfo.InvariantCulture, "Name: {0} Email: {1} Date: {2}", Name, Email, Date); } | ||
} | ||
} | ||
} |
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,39 @@ | ||
## Octokit Models | ||
|
||
These either represent the body of a GitHub API request or response. | ||
|
||
Request objects should be placed in the, you guessed it, _Request_ folder. Likewise Response objects should be placed | ||
in the _Response_ folder. | ||
|
||
Some models can be used for both requests and responses. | ||
|
||
### Request models | ||
|
||
The general design principle for request models are: | ||
|
||
1. They represent the body of a request. | ||
2. Properties that are _required_ by the API should be required by the model and passed in via the constructor. | ||
3. Required porperties should not have a setter since they will be set by the constructor. | ||
4. All other properties should have both a getter and setter. | ||
|
||
Note that Octokit.net automatically converts property name to the Ruby casing required by the GitHub API. Thus a | ||
property named `BreakingBad` would be passed as `breaking_bad`. | ||
|
||
### Response models | ||
|
||
The general design principle for response models are: | ||
|
||
1. They should be immutable. As such, properties have a `public` getter and `protected` setter. | ||
2. We want the properties to be read only, but also make it possible to mock the response from API methods. | ||
3. They must be easily serialized and deserialized. | ||
4. They need a default constructor as well as one that takes in every parameter. | ||
|
||
We're in the process of reconsidering this design as it's created a few problems for us. Namely that creating these | ||
objects in a unit test is a royal pain. | ||
|
||
### Notes | ||
|
||
There's a lot of confusion caused by the fact that the GitHub API returns GitHub resources as well as Git resources. | ||
For example, you can use the [Git Data API](https://developer.github.com/v3/git/) to directly manipulate Git objects | ||
such as a `commit`. At the same time, GitHub also has its own `commit` (represented by `GitHubCommit` in Octokit.net) | ||
that contains the GitHub information around the commit such as comments. |
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
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
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
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
This file was deleted.
Oops, something went wrong.
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,61 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Globalization; | ||
|
||
namespace Octokit | ||
{ | ||
/// <summary> | ||
/// Represents the author or committer to a Git commit. This is the information stored in Git and should not be | ||
/// confused with GitHub account information. | ||
/// </summary> | ||
[DebuggerDisplay("{DebuggerDisplay,nq}")] | ||
public class Committer | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="Committer"/> class. | ||
/// </summary> | ||
public Committer() { } | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="Committer"/> class. | ||
/// </summary> | ||
/// <param name="name">The full name of the author or committer.</param> | ||
/// <param name="email">The email.</param> | ||
/// <param name="date">The date.</param> | ||
public Committer(string name, string email, DateTimeOffset date) | ||
{ | ||
Name = name; | ||
Email = email; | ||
Date = date; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the name of the author or committer. | ||
/// </summary> | ||
/// <value> | ||
/// The name. | ||
/// </value> | ||
public string Name { get; protected set; } | ||
|
||
/// <summary> | ||
/// Gets the email of the author or committer. | ||
/// </summary> | ||
/// <value> | ||
/// The email. | ||
/// </value> | ||
public string Email { get; protected set; } | ||
|
||
/// <summary> | ||
/// Gets the date of the author or contributor's contributions. | ||
/// </summary> | ||
/// <value> | ||
/// The date. | ||
/// </value> | ||
public DateTimeOffset Date { get; protected set; } | ||
|
||
internal string DebuggerDisplay | ||
{ | ||
get { return String.Format(CultureInfo.InvariantCulture, "Name: {0} Email: {1} Date: {2}", Name, Email, Date); } | ||
} | ||
} | ||
} |
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
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
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.