Skip to content

Commit 92bf9da

Browse files
authored
Merge pull request #142 from sjroesink/post-branch
Implement PostBranch
2 parents 5342c95 + c1b63e3 commit 92bf9da

4 files changed

Lines changed: 19 additions & 1 deletion

File tree

Coverage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ The organization of all that routes may slightly differ in the SharpBucket class
477477
- Implemented by: `BranchResource.ListBranches()`
478478
- Tested: **yes**
479479
- /repositories/{username}/{repo_slug}/refs/branches `POST`
480-
- Implemented by: none
480+
- Implemented by: `BranchResource.PostBranch(Branch)`
481481
- Tested: no
482482
- /repositories/{username}/{repo_slug}/refs/branches/{name} `GET`
483483
- Implemented by: none

SharpBucket/V2/EndPoints/BranchResource.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ public List<Branch> ListBranches(ListParameters parameters)
4242
return GetPaginatedValues<Branch>(_baseUrl, parameters.Max, parameters.ToDictionary());
4343
}
4444

45+
/// <summary>
46+
/// Creates a new branch in the specified repository.
47+
/// </summary>
48+
/// <param name="branch">The branch to create.</param>
49+
/// <returns>The created branch.</returns>
50+
public Branch PostBranch(Branch branch)
51+
{
52+
return _sharpBucketV2.Post(branch, _baseUrl);
53+
}
54+
4555
/// <summary>
4656
/// Enumerate branches associated with a specific repository.
4757
/// </summary>

SharpBucket/V2/Pocos/Branch.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
public class Branch
44
{
55
public string name { get; set; }
6+
public BranchTarget target { get; set; }
67
}
78
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace SharpBucket.V2.Pocos
2+
{
3+
public class BranchTarget
4+
{
5+
public string hash { get; set; }
6+
}
7+
}

0 commit comments

Comments
 (0)