| @@ -0,0 +1,29 @@ | |||||
| using System.Collections.Generic; | |||||
| namespace Discord; | |||||
| public class RoleConnectionMetadata | |||||
| { | |||||
| public RoleConnectionMetadataType Type { get; } | |||||
| public string Key { get; } | |||||
| public string Name{ get; } | |||||
| public Optional<Dictionary<string, string>> NameLocalizations { get; } | |||||
| public string Description { get; } | |||||
| public Optional<Dictionary<string, string>> DescriptionLocalizations { get; } | |||||
| internal RoleConnectionMetadata(RoleConnectionMetadataType type, string key, string name, string description, | |||||
| Dictionary<string, string> nameLocalizations = null, Dictionary<string, string> descriptionLocalizations = null) | |||||
| { | |||||
| Type = type; | |||||
| Key = key; | |||||
| Name = name; | |||||
| Description = description; | |||||
| NameLocalizations = nameLocalizations; | |||||
| DescriptionLocalizations = descriptionLocalizations; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,49 @@ | |||||
| using System; | |||||
| namespace Discord; | |||||
| /// <summary> | |||||
| /// Represents the type of Application Role Connection Metadata | |||||
| /// </summary> | |||||
| public enum RoleConnectionMetadataType | |||||
| { | |||||
| /// <summary> | |||||
| /// The metadata's integer value is less than or equal to the guild's configured value | |||||
| /// </summary> | |||||
| IntegerLessOrEqual = 1, | |||||
| /// <summary> | |||||
| /// The metadata's integer value is greater than or equal to the guild's configured value | |||||
| /// </summary> | |||||
| IntegerGreaterOrEqual = 2, | |||||
| /// <summary> | |||||
| /// The metadata's integer value is equal to the guild's configured value | |||||
| /// </summary> | |||||
| IntegerEqual = 3, | |||||
| /// <summary> | |||||
| /// The metadata's integer value is not equal to the guild's configured value | |||||
| /// </summary> | |||||
| IntegerNotEqual = 4, | |||||
| /// <summary> | |||||
| /// The metadata's ISO8601 string value is less or equal to the guild's configured value | |||||
| /// </summary> | |||||
| DateTimeLessOrEqual = 5, | |||||
| /// <summary> | |||||
| /// The metadata's ISO8601 string value is greater to the guild's configured value | |||||
| /// </summary> | |||||
| DateTimeGreaterOrEqual = 6, | |||||
| /// <summary> | |||||
| /// The metadata's integer value is equal to the guild's configured value | |||||
| /// </summary> | |||||
| BoolEqual = 7, | |||||
| /// <summary> | |||||
| /// The metadata's integer value is equal to the guild's configured value | |||||
| /// </summary> | |||||
| BoolNotEqual = 8, | |||||
| } | |||||
| @@ -0,0 +1,25 @@ | |||||
| using Newtonsoft.Json; | |||||
| using System.Collections.Generic; | |||||
| namespace Discord.API; | |||||
| public class RoleConnectionMetadata | |||||
| { | |||||
| [JsonProperty("type")] | |||||
| public RoleConnectionMetadataType Type { get; set; } | |||||
| [JsonProperty("key")] | |||||
| public string Key { get; set; } | |||||
| [JsonProperty("name")] | |||||
| public string Name { get; set; } | |||||
| [JsonProperty("description")] | |||||
| public string Description { get; set; } | |||||
| [JsonProperty("name_localizations")] | |||||
| public Optional<IEnumerable<KeyValuePair<string, string>>> NameLocalizations { get; set; } | |||||
| [JsonProperty("description_localizations")] | |||||
| public Optional<IEnumerable<KeyValuePair<string, string>>> DescriptionLocalizations { get; set; } | |||||
| } | |||||
| @@ -10,6 +10,7 @@ using System.Collections.Concurrent; | |||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.ComponentModel.Design; | using System.ComponentModel.Design; | ||||
| using System.Diagnostics; | using System.Diagnostics; | ||||
| using System.Diagnostics.Contracts; | |||||
| using System.Globalization; | using System.Globalization; | ||||
| using System.IO; | using System.IO; | ||||
| using System.Linq; | using System.Linq; | ||||
| @@ -2476,5 +2477,19 @@ namespace Discord.API | |||||
| } | } | ||||
| #endregion | #endregion | ||||
| #region Application Role Connections Metadata | |||||
| public async Task<IEnumerable<RoleConnectionMetadata>> GetApplicationRoleConnectionMetadataRecordsAsync(RequestOptions options = null) | |||||
| { | |||||
| return await SendAsync<IEnumerable<RoleConnectionMetadata>>("GET", $"/applications/{CurrentApplicationId}/role-connections/metadata", options: options).ConfigureAwait(false); | |||||
| } | |||||
| public async Task<IEnumerable<RoleConnectionMetadata>> UpdateApplicationRoleConnectionMetadataRecordsAsync(IEnumerable<RoleConnectionMetadata> roleConnections, RequestOptions options = null) | |||||
| { | |||||
| return await SendJsonAsync<IEnumerable<RoleConnectionMetadata>>("PUT", $"/applications/{CurrentApplicationId}/role-connections/metadata", roleConnections, options: options).ConfigureAwait(false); | |||||
| } | |||||
| #endregion | |||||
| } | } | ||||
| } | } | ||||