-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement discord/discord-api-docs#5668
- Loading branch information
Showing
12 changed files
with
198 additions
and
5 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,21 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace NetCord.JsonModels; | ||
|
||
public partial class JsonApplicationRoleConnection | ||
{ | ||
[JsonPropertyName("platform_name")] | ||
public string? PlatformName { get; set; } | ||
|
||
[JsonPropertyName("platform_username")] | ||
public string? PlatformUsername { get; set; } | ||
|
||
[JsonPropertyName("metadata")] | ||
public IReadOnlyDictionary<string, string> Metadata { get; set; } | ||
|
||
[JsonSerializable(typeof(JsonApplicationRoleConnection))] | ||
public partial class JsonApplicationRoleConnectionSerializerContext : JsonSerializerContext | ||
{ | ||
public static JsonApplicationRoleConnectionSerializerContext WithOptions { get; } = new(new(ToObjectExtensions._options)); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
NetCord/JsonModels/JsonApplicationRoleConnectionMetadata.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,39 @@ | ||
using System.Globalization; | ||
using System.Text.Json.Serialization; | ||
|
||
using NetCord.Rest; | ||
|
||
namespace NetCord.JsonModels; | ||
|
||
public partial class JsonApplicationRoleConnectionMetadata | ||
{ | ||
[JsonPropertyName("type")] | ||
public ApplicationRoleConnectionMetadataType Type { get; set; } | ||
|
||
[JsonPropertyName("key")] | ||
public string Key { get; set; } | ||
|
||
[JsonPropertyName("name")] | ||
public string Name { get; set; } | ||
|
||
[JsonPropertyName("name_localizations")] | ||
public IReadOnlyDictionary<CultureInfo, string>? NameLocalizations { get; set; } | ||
|
||
[JsonPropertyName("description")] | ||
public string Description { get; set; } | ||
|
||
[JsonPropertyName("description_localizations")] | ||
public IReadOnlyDictionary<CultureInfo, string>? DescriptionLocalizations { get; set; } | ||
|
||
[JsonSerializable(typeof(JsonApplicationRoleConnectionMetadata))] | ||
public partial class JsonApplicationRoleConnectionMetadataSerializerContext : JsonSerializerContext | ||
{ | ||
public static JsonApplicationRoleConnectionMetadataSerializerContext WithOptions { get; } = new(new(ToObjectExtensions._options)); | ||
} | ||
|
||
[JsonSerializable(typeof(IEnumerable<JsonApplicationRoleConnectionMetadata>))] | ||
public partial class IEnumerableOfJsonApplicationRoleConnectionMetadataSerializerContext : JsonSerializerContext | ||
{ | ||
public static IEnumerableOfJsonApplicationRoleConnectionMetadataSerializerContext WithOptions { get; } = new(new(ToObjectExtensions._options)); | ||
} | ||
} |
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,16 @@ | ||
namespace NetCord.Rest; | ||
|
||
public class ApplicationRoleConnection : IJsonModel<JsonModels.JsonApplicationRoleConnection> | ||
{ | ||
JsonModels.JsonApplicationRoleConnection IJsonModel<JsonModels.JsonApplicationRoleConnection>.JsonModel => _jsonModel; | ||
private readonly JsonModels.JsonApplicationRoleConnection _jsonModel; | ||
|
||
public ApplicationRoleConnection(JsonModels.JsonApplicationRoleConnection jsonModel) | ||
{ | ||
_jsonModel = jsonModel; | ||
} | ||
|
||
public string? PlatformName => _jsonModel.PlatformName; | ||
public string? PlatformUsername => _jsonModel.PlatformUsername; | ||
public IReadOnlyDictionary<string, string> Metadata => _jsonModel.Metadata; | ||
} |
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,21 @@ | ||
using System.Globalization; | ||
|
||
namespace NetCord.Rest; | ||
|
||
public class ApplicationRoleConnectionMetadata : IJsonModel<JsonModels.JsonApplicationRoleConnectionMetadata> | ||
{ | ||
JsonModels.JsonApplicationRoleConnectionMetadata IJsonModel<JsonModels.JsonApplicationRoleConnectionMetadata>.JsonModel => _jsonModel; | ||
private readonly JsonModels.JsonApplicationRoleConnectionMetadata _jsonModel; | ||
|
||
public ApplicationRoleConnectionMetadata(JsonModels.JsonApplicationRoleConnectionMetadata jsonModel) | ||
{ | ||
_jsonModel = jsonModel; | ||
} | ||
|
||
public ApplicationRoleConnectionMetadataType Type => _jsonModel.Type; | ||
public string Key => _jsonModel.Key; | ||
public string Name => _jsonModel.Name; | ||
public IReadOnlyDictionary<CultureInfo, string>? NameLocalizations => _jsonModel.NameLocalizations; | ||
public string Description => _jsonModel.Description; | ||
public IReadOnlyDictionary<CultureInfo, string>? DescriptionLocalizations => _jsonModel.DescriptionLocalizations; | ||
} |
45 changes: 45 additions & 0 deletions
45
NetCord/Rest/ApplicationRoleConnectionMetadataProperties.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,45 @@ | ||
using System.Globalization; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace NetCord.Rest; | ||
|
||
public partial class ApplicationRoleConnectionMetadataProperties | ||
{ | ||
public ApplicationRoleConnectionMetadataProperties(ApplicationRoleConnectionMetadataType type, string key, string name, string description) | ||
{ | ||
Type = type; | ||
Key = key; | ||
Name = name; | ||
Description = description; | ||
} | ||
|
||
[JsonPropertyName("type")] | ||
public ApplicationRoleConnectionMetadataType Type { get; } | ||
|
||
[JsonPropertyName("key")] | ||
public string Key { get; } | ||
|
||
[JsonPropertyName("name")] | ||
public string Name { get; } | ||
|
||
[JsonPropertyName("name_localizations")] | ||
public IReadOnlyDictionary<CultureInfo, string>? NameLocalizations { get; set; } | ||
|
||
[JsonPropertyName("description")] | ||
public string Description { get; } | ||
|
||
[JsonPropertyName("description_localizations")] | ||
public IReadOnlyDictionary<CultureInfo, string>? DescriptionLocalizations { get; set; } | ||
|
||
[JsonSerializable(typeof(ApplicationRoleConnectionMetadataProperties))] | ||
public partial class ApplicationRoleConnectionMetadataPropertiesSerializerContext : JsonSerializerContext | ||
{ | ||
public static ApplicationRoleConnectionMetadataPropertiesSerializerContext WithOptions { get; } = new(new(ToObjectExtensions._options)); | ||
} | ||
|
||
[JsonSerializable(typeof(IEnumerable<ApplicationRoleConnectionMetadataProperties>))] | ||
public partial class IEnumerableOfApplicationRoleConnectionMetadataPropertiesSerializerContext : JsonSerializerContext | ||
{ | ||
public static IEnumerableOfApplicationRoleConnectionMetadataPropertiesSerializerContext WithOptions { get; } = new(new(ToObjectExtensions._options)); | ||
} | ||
} |
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,13 @@ | ||
namespace NetCord.Rest; | ||
|
||
public enum ApplicationRoleConnectionMetadataType | ||
{ | ||
IntegerLessThanOrEqual = 1, | ||
IntegerGreaterThanOrEqual = 2, | ||
IntegerEqual = 3, | ||
IntegerNotEqual = 4, | ||
DateTimeLessThanOrEqual = 5, | ||
DateTimeGreaterThanOrEqual = 6, | ||
BooleanEqual = 7, | ||
BooleanNotEqual = 8, | ||
} |
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,21 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace NetCord.Rest; | ||
|
||
public partial class ApplicationRoleConnectionProperties | ||
{ | ||
[JsonPropertyName("platform_name")] | ||
public string? PlatformName { get; set; } | ||
|
||
[JsonPropertyName("platform_username")] | ||
public string? PlatformUsername { get; set; } | ||
|
||
[JsonPropertyName("metadata")] | ||
public IReadOnlyDictionary<string, string>? Metadata { get; set; } | ||
|
||
[JsonSerializable(typeof(ApplicationRoleConnectionProperties))] | ||
public partial class ApplicationRoleConnectionPropertiesSerializerContext : JsonSerializerContext | ||
{ | ||
public static ApplicationRoleConnectionPropertiesSerializerContext WithOptions { get; } = new(new(ToObjectExtensions._options)); | ||
} | ||
} |
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
10 changes: 10 additions & 0 deletions
10
NetCord/Rest/RestClient.ApplicationRoleConnectionMetadata.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,10 @@ | ||
namespace NetCord.Rest; | ||
|
||
public partial class RestClient | ||
{ | ||
public async Task<IEnumerable<ApplicationRoleConnectionMetadata>> GetApplicationRoleConnectionMetadataRecordsAsync(ulong applicationId, RequestProperties? properties = null) | ||
=> (await SendRequestAsync(HttpMethod.Get, $"/applications/{applicationId}/role-connections/metadata", new RateLimits.Route(RateLimits.RouteParameter.GetApplicationRoleConnectionMetadataRecords), properties).ConfigureAwait(false)).ToObject(JsonModels.JsonApplicationRoleConnectionMetadata.IEnumerableOfJsonApplicationRoleConnectionMetadataSerializerContext.WithOptions.IEnumerableJsonApplicationRoleConnectionMetadata).Select(m => new ApplicationRoleConnectionMetadata(m)); | ||
|
||
public async Task<IEnumerable<ApplicationRoleConnectionMetadata>> UpdateApplicationRoleConnectionMetadataRecordsAsync(ulong applicationId, IEnumerable<ApplicationRoleConnectionMetadataProperties> applicationRoleConnectionMetadataProperties, RequestProperties? properties = null) | ||
=> (await SendRequestAsync(HttpMethod.Put, $"/applications/{applicationId}/role-connections/metadata", new(RateLimits.RouteParameter.UpdateApplicationRoleConnectionMetadataRecords), new JsonContent<IEnumerable<ApplicationRoleConnectionMetadataProperties>>(applicationRoleConnectionMetadataProperties, ApplicationRoleConnectionMetadataProperties.IEnumerableOfApplicationRoleConnectionMetadataPropertiesSerializerContext.WithOptions.IEnumerableApplicationRoleConnectionMetadataProperties), properties).ConfigureAwait(false)).ToObject(JsonModels.JsonApplicationRoleConnectionMetadata.IEnumerableOfJsonApplicationRoleConnectionMetadataSerializerContext.WithOptions.IEnumerableJsonApplicationRoleConnectionMetadata).Select(m => new ApplicationRoleConnectionMetadata(m)); | ||
} |
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