2
2
using System . Collections . Generic ;
3
3
using System . Threading . Tasks ;
4
4
using GitLabApiClient . Internal . Http ;
5
+ using GitLabApiClient . Internal . Paths ;
5
6
using GitLabApiClient . Internal . Queries ;
6
7
using GitLabApiClient . Models . Branches . Requests ;
7
8
using GitLabApiClient . Models . Branches . Responses ;
9
+ using GitLabApiClient . Models . Projects . Responses ;
8
10
9
11
namespace GitLabApiClient
10
12
{
@@ -21,10 +23,22 @@ internal BranchClient(
21
23
_branchQueryBuilder = branchQueryBuilder ;
22
24
}
23
25
24
- public async Task < Branch > GetAsync ( string projectId , string branchName ) =>
26
+ /// <summary>
27
+ /// Retrieves a single branch
28
+ /// </summary>
29
+ /// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
30
+ /// <param name="branchName">The branch name.</param>
31
+ /// <returns></returns>
32
+ public async Task < Branch > GetAsync ( ProjectId projectId , string branchName ) =>
25
33
await _httpFacade . Get < Branch > ( $ "projects/{ projectId } /repository/branches/{ branchName } ") ;
26
34
27
- public async Task < IList < Branch > > GetAsync ( string projectId , Action < BranchQueryOptions > options )
35
+ /// <summary>
36
+ ///
37
+ /// </summary>
38
+ /// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
39
+ /// <param name="options">Query options <see cref="BranchQueryOptions"/></param>
40
+ /// <returns></returns>
41
+ public async Task < IList < Branch > > GetAsync ( ProjectId projectId , Action < BranchQueryOptions > options )
28
42
{
29
43
var queryOptions = new BranchQueryOptions ( ) ;
30
44
options ? . Invoke ( queryOptions ) ;
@@ -33,25 +47,62 @@ public async Task<IList<Branch>> GetAsync(string projectId, Action<BranchQueryOp
33
47
return await _httpFacade . GetPagedList < Branch > ( url ) ;
34
48
}
35
49
36
- public async Task < Branch > CreateAsync ( CreateBranchRequest request ) =>
37
- await _httpFacade . Post < Branch > ( $ "projects/{ request . ProjectId } /repository/branches", request ) ;
50
+ /// <summary>
51
+ /// Creates a branch
52
+ /// </summary>
53
+ /// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
54
+ /// <param name="request">Create branch request</param>
55
+ /// <returns></returns>
56
+ public async Task < Branch > CreateAsync ( ProjectId projectId , CreateBranchRequest request ) =>
57
+ await _httpFacade . Post < Branch > ( $ "projects/{ projectId } /repository/branches", request ) ;
38
58
39
- public async Task DeleteBranch ( DeleteBranchRequest request ) =>
40
- await _httpFacade . Delete ( $ "projects/{ request . ProjectId } /repository/branches/{ request . BranchName } ") ;
59
+ /// <summary>
60
+ /// Deletes a branch
61
+ /// </summary>
62
+ /// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
63
+ /// <param name="branchName">The branch, you want deleted.</param>
64
+ public async Task DeleteBranch ( ProjectId projectId , string branchName ) =>
65
+ await _httpFacade . Delete ( $ "projects/{ projectId } /repository/branches/{ branchName } ") ;
41
66
42
- public async Task DeleteMergedBranches ( DeleteMergedBranchesRequest request ) =>
43
- await _httpFacade . Delete ( $ "projects/{ request . ProjectId } /repository/merged_branches") ;
67
+ /// <summary>
68
+ /// Deletes the merged branches
69
+ /// </summary>
70
+ /// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
71
+ public async Task DeleteMergedBranches ( ProjectId projectId ) =>
72
+ await _httpFacade . Delete ( $ "projects/{ projectId } /repository/merged_branches") ;
44
73
45
- public async Task < ProtectedBranch > GetProtectedBranchesAsync ( string projectId , string branchName ) =>
74
+ /// <summary>
75
+ /// Retrieve a single protected branch information.
76
+ /// </summary>
77
+ /// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
78
+ /// <param name="branchName">The protected branch</param>
79
+ /// <returns>A protected branch</returns>
80
+ public async Task < ProtectedBranch > GetProtectedBranchesAsync ( ProjectId projectId , string branchName ) =>
46
81
await _httpFacade . Get < ProtectedBranch > ( $ "projects/{ projectId } /protected_branches/{ branchName } ") ;
47
82
48
- public async Task < IList < ProtectedBranch > > GetProtectedBranchesAsync ( string projectId ) =>
83
+ /// <summary>
84
+ /// Retrieves a list of Protected Branches from a project.
85
+ /// </summary>
86
+ /// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
87
+ /// <returns>List of protected branches.</returns>
88
+ public async Task < IList < ProtectedBranch > > GetProtectedBranchesAsync ( ProjectId projectId ) =>
49
89
await _httpFacade . GetPagedList < ProtectedBranch > ( $ "projects/{ projectId } /protected_branches") ;
50
90
51
- public async Task < ProtectedBranch > ProtectBranchAsync ( ProtectBranchRequest request ) =>
52
- await _httpFacade . Post < ProtectedBranch > ( $ "projects/{ request . ProjectId } /protected_branches", request ) ;
91
+ /// <summary>
92
+ /// Protect a branch
93
+ /// </summary>
94
+ /// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
95
+ /// <param name="request">Protect branch request <see cref="ProtectBranchRequest"/>.</param>
96
+ /// <returns>The newly protected branch.</returns>
97
+ public async Task < ProtectedBranch > ProtectBranchAsync ( ProjectId projectId , ProtectBranchRequest request ) =>
98
+ await _httpFacade . Post < ProtectedBranch > ( $ "projects/{ projectId } /protected_branches", request ) ;
53
99
54
- public async Task UnprotectBranchAsync ( string projectId , string branchName ) =>
100
+ /// <summary>
101
+ /// Unprotect a branch
102
+ /// </summary>
103
+ /// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
104
+ /// <param name="branchName">The Branch, you want to unprotect.</param>
105
+ public async Task UnprotectBranchAsync ( ProjectId projectId , string branchName ) =>
55
106
await _httpFacade . Delete ( $ "projects/{ projectId } /protected_branches/{ branchName } ") ;
56
107
}
57
108
}
0 commit comments