-
Notifications
You must be signed in to change notification settings - Fork 164
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
Implement some api from https://docs.gitlab.com/ee/api/api_resources.… #217
Open
elloku
wants to merge
1
commit into
nmklotas:master
Choose a base branch
from
elloku:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -1,11 +1,15 @@ | ||
using System.Threading.Tasks; | ||
using GitLabApiClient.Internal.Paths; | ||
using GitLabApiClient.Models.Files.Request; | ||
using GitLabApiClient.Models.Files.Responses; | ||
|
||
namespace GitLabApiClient | ||
{ | ||
public interface IFilesClient | ||
{ | ||
Task<File> GetAsync(ProjectId projectId, string filePath, string reference = "master"); | ||
|
||
Task<UpdateFileResponse> UpdateAsync(ProjectId projectId, string filePath, UpdateFileRequest request); | ||
|
||
} | ||
} |
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
40 changes: 40 additions & 0 deletions
40
src/GitLabApiClient/Models/Files/Request/UpdateFileRequest.cs
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 Newtonsoft.Json; | ||
|
||
namespace GitLabApiClient.Models.Files.Request | ||
{ | ||
public class UpdateFileRequest | ||
{ | ||
public UpdateFileRequest(string branch) => Branch = branch; | ||
|
||
/// <summary> | ||
/// Name of the branch | ||
/// </summary> | ||
[JsonProperty("branch")] | ||
public string Branch { get; private set; } | ||
|
||
/// <summary> | ||
/// Specify the commit author’s email address | ||
/// </summary> | ||
[JsonProperty("author_email")] | ||
public string AuthorEmail { get; set; } | ||
|
||
/// <summary> | ||
/// Specify the commit author’s name | ||
/// </summary> | ||
[JsonProperty("author_name")] | ||
public string AuthorName { get; set; } | ||
|
||
/// <summary> | ||
/// New file content | ||
/// </summary> | ||
[JsonProperty("content")] | ||
public string Content { get; set; } | ||
|
||
/// <summary> | ||
/// Commit message | ||
/// </summary> | ||
[JsonProperty("commit_message")] | ||
public string CommitMessage { get; set; } | ||
|
||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/GitLabApiClient/Models/Files/Responses/UpdateFileResponse.cs
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,19 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace GitLabApiClient.Models.Files.Responses | ||
{ | ||
public class UpdateFileResponse | ||
{ | ||
/// <summary> | ||
/// URL encoded full path to new file. Ex. lib%2Fclass%2Erb | ||
/// </summary> | ||
[JsonProperty("file_path")] | ||
public string FilePath { get; set; } | ||
|
||
/// <summary> | ||
/// Name of the branch | ||
/// </summary> | ||
[JsonProperty("branch")] | ||
public string Branch { get; set; } | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
src/GitLabApiClient/Models/Projects/Requests/ForkProjectRequest.cs
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,58 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace GitLabApiClient.Models.Projects.Requests | ||
{ | ||
public class ForkProjectRequest | ||
{ | ||
public ForkProjectRequest(int id) => Id = id; | ||
|
||
/// <summary> | ||
/// The ID or URL-encoded path of the project. | ||
/// </summary> | ||
[JsonProperty("id")] | ||
public int Id { get; private set; } | ||
|
||
/// <summary> | ||
/// The name assigned to the resultant project after forking. | ||
/// </summary> | ||
[JsonProperty("name")] | ||
public string Name { get; private set; } | ||
|
||
/// <summary> | ||
/// The ID of the namespace that the project is forked to. | ||
/// </summary> | ||
[JsonProperty("namespace_id")] | ||
public int? NamespaceId { get; set; } | ||
|
||
/// <summary> | ||
/// The path of the namespace that the project is forked to. | ||
/// </summary> | ||
[JsonProperty("namespace_path")] | ||
public string NamespacePath { get; set; } | ||
|
||
/// <summary> | ||
/// (Deprecated) The ID or path of the namespace that the project is forked to. | ||
/// </summary> | ||
[JsonProperty("namespace")] | ||
public string Namespace { get; set; } | ||
|
||
/// <summary> | ||
/// The path assigned to the resultant project after forking. | ||
/// </summary> | ||
[JsonProperty("path")] | ||
public string Path { get; set; } | ||
|
||
/// <summary> | ||
/// The description assigned to the resultant project after forking. | ||
/// </summary> | ||
[JsonProperty("description")] | ||
public string Description { get; set; } | ||
|
||
/// <summary> | ||
/// The visibility level assigned to the resultant project after forking. | ||
/// </summary> | ||
[JsonProperty("visibility")] | ||
public bool? Visibility { get; 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to encode file path, like in Get method