Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add overloads to specify branch for ContentRequest #1093

Merged
merged 5 commits into from
Feb 11, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 60 additions & 2 deletions Octokit/Models/Request/CreateFileRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ protected ContentRequest(string message)
Message = message;
}

/// <summary>
/// Initializes a new instance of the <see cref="ContentRequest"/> class.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="branch">The branch the request is for.</param>
protected ContentRequest(string message, string branch): this(message)
{
Ensure.ArgumentNotNullOrEmptyString(branch, "branch");

Branch = branch;
}

/// <summary>
/// The commit message. This is required.
/// </summary>
Expand Down Expand Up @@ -54,6 +66,19 @@ public class DeleteFileRequest : ContentRequest
/// <param name="message">The message.</param>
/// <param name="sha">The sha.</param>
public DeleteFileRequest(string message, string sha) : base(message)
{
Ensure.ArgumentNotNullOrEmptyString(sha, "content");

Sha = sha;
}

/// <summary>
/// Initializes a new instance of the <see cref="DeleteFileRequest"/> class.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="sha">The sha.</param>
/// <param name="branch">The branch the request is for.</param>
public DeleteFileRequest(string message, string sha, string branch) : base(message, branch)
{
Ensure.ArgumentNotNullOrEmptyString(sha, "sha");

Expand Down Expand Up @@ -81,15 +106,27 @@ public class CreateFileRequest : ContentRequest
/// <summary>
/// Creates an instance of a <see cref="CreateFileRequest" />.
/// </summary>
/// <param name="message"></param>
/// <param name="content"></param>
/// <param name="message">The message.</param>
/// <param name="content">The content.</param>
public CreateFileRequest(string message, string content) : base(message)
{
Ensure.ArgumentNotNull(content, "content");

Content = content;
}

/// <summary>
/// Initializes a new instance of the <see cref="DeleteFileRequest"/> class.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in the xml doc with the cref to the class name

/// </summary>
/// <param name="message">The message.</param>
/// <param name="content">The content.</param>
/// <param name="branch">The branch the request is for.</param>
public CreateFileRequest(string message, string content, string branch) : base(message, branch)
{
Ensure.ArgumentNotNullOrEmptyString(content, "content");

Content = content;
}
/// <summary>
/// The contents of the file to create. This is required.
/// </summary>
Expand All @@ -111,6 +148,12 @@ internal virtual string DebuggerDisplay
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class UpdateFileRequest : CreateFileRequest
{
/// <summary>
/// Creates an instance of a <see cref="UpdateFileRequest" />.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="content">The content.</param>
/// <param name="sha">The sha.</param>
public UpdateFileRequest(string message, string content, string sha)
: base(message, content)
{
Expand All @@ -119,6 +162,21 @@ public UpdateFileRequest(string message, string content, string sha)
Sha = sha;
}

/// <summary>
/// Creates an instance of a <see cref="UpdateFileRequest" />.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="content">The content.</param>
/// <param name="sha">The sha.</param>
/// <param name="branch">The branch the request is for.</param>
public UpdateFileRequest(string message, string content, string sha, string branch)
: base(message, content, branch)
{
Ensure.ArgumentNotNullOrEmptyString(sha, "sha");

Sha = sha;
}

/// <summary>
/// The blob SHA of the file being replaced.
/// </summary>
Expand Down