-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes to prevent breaking change to IRepositoryClient.GetArchive
Adds a new overload to IRepository.GetArchive which accepts a query object in order to allow additional parameters to be passed to the the archive endpoint without breaking the existing implementation.
- Loading branch information
Showing
8 changed files
with
190 additions
and
32 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
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,20 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Runtime.Serialization; | ||
|
||
namespace NGitLab.Extensions; | ||
|
||
internal static class TypeExtensions | ||
{ | ||
public static string GetEnumMemberAttributeValue<TEnum>(this TEnum value) | ||
where TEnum : Enum | ||
{ | ||
return typeof(TEnum) | ||
.GetTypeInfo() | ||
.DeclaredMembers | ||
.SingleOrDefault(x => string.Equals(x.Name, value.ToString(), StringComparison.Ordinal)) | ||
?.GetCustomAttribute<EnumMemberAttribute>(inherit: false) | ||
?.Value; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System.Runtime.Serialization; | ||
|
||
namespace NGitLab.Models; | ||
|
||
public enum FileArchiveFormat | ||
{ | ||
[EnumMember(Value = ".bz2")] | ||
Bz2, | ||
|
||
[EnumMember(Value = ".gz")] | ||
Gz, | ||
|
||
[EnumMember(Value = ".tar")] | ||
Tar, | ||
|
||
[EnumMember(Value = ".tar.bz2")] | ||
TarBz2, | ||
|
||
[EnumMember(Value = ".tar.gz")] | ||
TarGz, | ||
|
||
[EnumMember(Value = ".tb2")] | ||
Tb2, | ||
|
||
[EnumMember(Value = ".tbz")] | ||
Tbz, | ||
|
||
[EnumMember(Value = ".tbz2")] | ||
Tbz2, | ||
|
||
[EnumMember(Value = ".zip")] | ||
Zip, | ||
} |
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,12 @@ | ||
namespace NGitLab.Models; | ||
|
||
public sealed class FileArchiveQuery | ||
{ | ||
public FileArchiveFormat? Format { get; set; } | ||
|
||
// This property is named Ref because even though the query string parameter key is 'sha' it accepts any ref | ||
// i.e. branch name, sha, tag | ||
public string Ref { get; set; } | ||
|
||
public string Path { 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