diff --git a/src/Merge.Client.sln b/src/Merge.Client.sln index 65cfa7a8..8998557e 100644 --- a/src/Merge.Client.sln +++ b/src/Merge.Client.sln @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Merge.Client", "Merge.Client\Merge.Client.csproj", "{F2B96F3A-F41D-4505-8135-B9C6ECEF44F0}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Merge.Client", "Merge.Client\Merge.Client.csproj", "{07D9AD3E-9BCE-488C-A44A-C0A3C8310C24}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Merge.Client.Test", "Merge.Client.Test\Merge.Client.Test.csproj", "{F6A9FBE2-C5A7-4E9E-BD14-E83357CC258B}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Merge.Client.Test", "Merge.Client.Test\Merge.Client.Test.csproj", "{D045D7B7-4D24-4F41-A9C7-DE88A421B6FC}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -16,13 +16,13 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F2B96F3A-F41D-4505-8135-B9C6ECEF44F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F2B96F3A-F41D-4505-8135-B9C6ECEF44F0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F2B96F3A-F41D-4505-8135-B9C6ECEF44F0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F2B96F3A-F41D-4505-8135-B9C6ECEF44F0}.Release|Any CPU.Build.0 = Release|Any CPU - {F6A9FBE2-C5A7-4E9E-BD14-E83357CC258B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F6A9FBE2-C5A7-4E9E-BD14-E83357CC258B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F6A9FBE2-C5A7-4E9E-BD14-E83357CC258B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F6A9FBE2-C5A7-4E9E-BD14-E83357CC258B}.Release|Any CPU.Build.0 = Release|Any CPU + {07D9AD3E-9BCE-488C-A44A-C0A3C8310C24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {07D9AD3E-9BCE-488C-A44A-C0A3C8310C24}.Debug|Any CPU.Build.0 = Debug|Any CPU + {07D9AD3E-9BCE-488C-A44A-C0A3C8310C24}.Release|Any CPU.ActiveCfg = Release|Any CPU + {07D9AD3E-9BCE-488C-A44A-C0A3C8310C24}.Release|Any CPU.Build.0 = Release|Any CPU + {D045D7B7-4D24-4F41-A9C7-DE88A421B6FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D045D7B7-4D24-4F41-A9C7-DE88A421B6FC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D045D7B7-4D24-4F41-A9C7-DE88A421B6FC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D045D7B7-4D24-4F41-A9C7-DE88A421B6FC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/src/Merge.Client/Accounting/FieldMapping/requests/CreateFieldMappingRequest.cs b/src/Merge.Client/Accounting/FieldMapping/requests/CreateFieldMappingRequest.cs index 77cc57eb..43478160 100644 --- a/src/Merge.Client/Accounting/FieldMapping/requests/CreateFieldMappingRequest.cs +++ b/src/Merge.Client/Accounting/FieldMapping/requests/CreateFieldMappingRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Accounting; public class CreateFieldMappingRequest @@ -5,30 +7,36 @@ public class CreateFieldMappingRequest /// /// The name of the target field you want this remote field to map to. /// + [JsonPropertyName("target_field_name")] public string TargetFieldName { get; init; } /// /// The description of the target field you want this remote field to map to. /// + [JsonPropertyName("target_field_description")] public string TargetFieldDescription { get; init; } /// /// The field traversal path of the remote field listed when you hit the GET /remote-fields endpoint. /// + [JsonPropertyName("remote_field_traversal_path")] public List RemoteFieldTraversalPath { get; init; } /// /// The method of the remote endpoint where the remote field is coming from. /// + [JsonPropertyName("remote_method")] public string RemoteMethod { get; init; } /// /// The path of the remote endpoint where the remote field is coming from. /// + [JsonPropertyName("remote_url_path")] public string RemoteUrlPath { get; init; } /// /// The name of the Common Model that the remote field corresponds to in a given category. /// + [JsonPropertyName("common_model_name")] public string CommonModelName { get; init; } } diff --git a/src/Merge.Client/Accounting/FieldMapping/requests/PatchedEditFieldMappingRequest.cs b/src/Merge.Client/Accounting/FieldMapping/requests/PatchedEditFieldMappingRequest.cs index 2862d5e3..3fea1991 100644 --- a/src/Merge.Client/Accounting/FieldMapping/requests/PatchedEditFieldMappingRequest.cs +++ b/src/Merge.Client/Accounting/FieldMapping/requests/PatchedEditFieldMappingRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Accounting; public class PatchedEditFieldMappingRequest @@ -5,15 +7,18 @@ public class PatchedEditFieldMappingRequest /// /// The field traversal path of the remote field listed when you hit the GET /remote-fields endpoint. /// + [JsonPropertyName("remote_field_traversal_path")] public List? RemoteFieldTraversalPath { get; init; } /// /// The method of the remote endpoint where the remote field is coming from. /// + [JsonPropertyName("remote_method")] public string? RemoteMethod { get; init; } /// /// The path of the remote endpoint where the remote field is coming from. /// + [JsonPropertyName("remote_url_path")] public string? RemoteUrlPath { get; init; } } diff --git a/src/Merge.Client/Accounting/GenerateKey/requests/GenerateRemoteKeyRequest.cs b/src/Merge.Client/Accounting/GenerateKey/requests/GenerateRemoteKeyRequest.cs index e46e4940..d23f78dd 100644 --- a/src/Merge.Client/Accounting/GenerateKey/requests/GenerateRemoteKeyRequest.cs +++ b/src/Merge.Client/Accounting/GenerateKey/requests/GenerateRemoteKeyRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Accounting; public class GenerateRemoteKeyRequest @@ -5,5 +7,6 @@ public class GenerateRemoteKeyRequest /// /// The name of the remote key /// + [JsonPropertyName("name")] public string Name { get; init; } } diff --git a/src/Merge.Client/Accounting/LinkToken/requests/EndUserDetailsRequest.cs b/src/Merge.Client/Accounting/LinkToken/requests/EndUserDetailsRequest.cs index a4654c49..c3a540ce 100644 --- a/src/Merge.Client/Accounting/LinkToken/requests/EndUserDetailsRequest.cs +++ b/src/Merge.Client/Accounting/LinkToken/requests/EndUserDetailsRequest.cs @@ -1,3 +1,4 @@ +using System.Text.Json.Serialization; using Merge.Client.Accounting; namespace Merge.Client.Accounting; @@ -7,46 +8,55 @@ public class EndUserDetailsRequest /// /// Your end user's email address. This is purely for identification purposes - setting this value will not cause any emails to be sent. /// + [JsonPropertyName("end_user_email_address")] public string EndUserEmailAddress { get; init; } /// /// Your end user's organization. /// + [JsonPropertyName("end_user_organization_name")] public string EndUserOrganizationName { get; init; } /// /// This unique identifier typically represents the ID for your end user in your product's database. This value must be distinct from other Linked Accounts' unique identifiers. /// + [JsonPropertyName("end_user_origin_id")] public string EndUserOriginId { get; init; } /// /// The integration categories to show in Merge Link. /// + [JsonPropertyName("categories")] public List Categories { get; init; } /// /// The slug of a specific pre-selected integration for this linking flow token. For examples of slugs, see https://docs.merge.dev/guides/merge-link/single-integration/. /// + [JsonPropertyName("integration")] public string? Integration { get; init; } /// /// An integer number of minutes between [30, 720 or 10080 if for a Magic Link URL] for how long this token is valid. Defaults to 30. /// + [JsonPropertyName("link_expiry_mins")] public int? LinkExpiryMins { get; init; } /// /// Whether to generate a Magic Link URL. Defaults to false. For more information on Magic Link, see https://merge.dev/blog/integrations-fast-say-hello-to-magic-link. /// + [JsonPropertyName("should_create_magic_link_url")] public bool? ShouldCreateMagicLinkUrl { get; init; } /// /// An array of objects to specify the models and fields that will be disabled for a given Linked Account. Each object uses model_id, enabled_actions, and disabled_fields to specify the model, method, and fields that are scoped for a given Linked Account. /// + [JsonPropertyName("common_models")] public List? CommonModels { get; init; } /// /// When creating a Link Token, you can set permissions for Common Models that will apply to the account that is going to be linked. Any model or field not specified in link token payload will default to existing settings. /// + [JsonPropertyName("category_common_model_scopes")] public Dictionary< string, List? @@ -55,10 +65,12 @@ public Dictionary< /// /// The language code for the language to localize Merge Link to. /// + [JsonPropertyName("language")] public string? Language { get; init; } /// /// A JSON object containing integration-specific configuration options. /// + [JsonPropertyName("integration_specific_config")] public Dictionary? IntegrationSpecificConfig { get; init; } } diff --git a/src/Merge.Client/Accounting/RegenerateKey/requests/RemoteKeyForRegenerationRequest.cs b/src/Merge.Client/Accounting/RegenerateKey/requests/RemoteKeyForRegenerationRequest.cs index df894b1b..2bfac746 100644 --- a/src/Merge.Client/Accounting/RegenerateKey/requests/RemoteKeyForRegenerationRequest.cs +++ b/src/Merge.Client/Accounting/RegenerateKey/requests/RemoteKeyForRegenerationRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Accounting; public class RemoteKeyForRegenerationRequest @@ -5,5 +7,6 @@ public class RemoteKeyForRegenerationRequest /// /// The name of the remote key /// + [JsonPropertyName("name")] public string Name { get; init; } } diff --git a/src/Merge.Client/Accounting/Scopes/requests/LinkedAccountCommonModelScopeDeserializerRequest.cs b/src/Merge.Client/Accounting/Scopes/requests/LinkedAccountCommonModelScopeDeserializerRequest.cs index 40eb84c4..c4188878 100644 --- a/src/Merge.Client/Accounting/Scopes/requests/LinkedAccountCommonModelScopeDeserializerRequest.cs +++ b/src/Merge.Client/Accounting/Scopes/requests/LinkedAccountCommonModelScopeDeserializerRequest.cs @@ -1,3 +1,4 @@ +using System.Text.Json.Serialization; using Merge.Client.Accounting; namespace Merge.Client.Accounting; @@ -7,5 +8,6 @@ public class LinkedAccountCommonModelScopeDeserializerRequest /// /// The common models you want to update the scopes for /// + [JsonPropertyName("common_models")] public List CommonModels { get; init; } } diff --git a/src/Merge.Client/Accounting/WebhookReceivers/requests/WebhookReceiverRequest.cs b/src/Merge.Client/Accounting/WebhookReceivers/requests/WebhookReceiverRequest.cs index 87d024d8..b1e0638e 100644 --- a/src/Merge.Client/Accounting/WebhookReceivers/requests/WebhookReceiverRequest.cs +++ b/src/Merge.Client/Accounting/WebhookReceivers/requests/WebhookReceiverRequest.cs @@ -1,10 +1,15 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Accounting; public class WebhookReceiverRequest { + [JsonPropertyName("event")] public string Event { get; init; } + [JsonPropertyName("is_active")] public bool IsActive { get; init; } + [JsonPropertyName("key")] public string? Key { get; init; } } diff --git a/src/Merge.Client/Ats/Candidates/requests/IgnoreCommonModelRequest.cs b/src/Merge.Client/Ats/Candidates/requests/IgnoreCommonModelRequest.cs index 94e0fc78..d20ed7df 100644 --- a/src/Merge.Client/Ats/Candidates/requests/IgnoreCommonModelRequest.cs +++ b/src/Merge.Client/Ats/Candidates/requests/IgnoreCommonModelRequest.cs @@ -1,10 +1,13 @@ +using System.Text.Json.Serialization; using Merge.Client.Ats; namespace Merge.Client.Ats; public class IgnoreCommonModelRequest { + [JsonPropertyName("reason")] public ReasonEnum Reason { get; init; } + [JsonPropertyName("message")] public string? Message { get; init; } } diff --git a/src/Merge.Client/Ats/FieldMapping/requests/CreateFieldMappingRequest.cs b/src/Merge.Client/Ats/FieldMapping/requests/CreateFieldMappingRequest.cs index 5ba952c9..75aaeb9d 100644 --- a/src/Merge.Client/Ats/FieldMapping/requests/CreateFieldMappingRequest.cs +++ b/src/Merge.Client/Ats/FieldMapping/requests/CreateFieldMappingRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Ats; public class CreateFieldMappingRequest @@ -5,30 +7,36 @@ public class CreateFieldMappingRequest /// /// The name of the target field you want this remote field to map to. /// + [JsonPropertyName("target_field_name")] public string TargetFieldName { get; init; } /// /// The description of the target field you want this remote field to map to. /// + [JsonPropertyName("target_field_description")] public string TargetFieldDescription { get; init; } /// /// The field traversal path of the remote field listed when you hit the GET /remote-fields endpoint. /// + [JsonPropertyName("remote_field_traversal_path")] public List RemoteFieldTraversalPath { get; init; } /// /// The method of the remote endpoint where the remote field is coming from. /// + [JsonPropertyName("remote_method")] public string RemoteMethod { get; init; } /// /// The path of the remote endpoint where the remote field is coming from. /// + [JsonPropertyName("remote_url_path")] public string RemoteUrlPath { get; init; } /// /// The name of the Common Model that the remote field corresponds to in a given category. /// + [JsonPropertyName("common_model_name")] public string CommonModelName { get; init; } } diff --git a/src/Merge.Client/Ats/FieldMapping/requests/PatchedEditFieldMappingRequest.cs b/src/Merge.Client/Ats/FieldMapping/requests/PatchedEditFieldMappingRequest.cs index 0f0477c9..17ea852f 100644 --- a/src/Merge.Client/Ats/FieldMapping/requests/PatchedEditFieldMappingRequest.cs +++ b/src/Merge.Client/Ats/FieldMapping/requests/PatchedEditFieldMappingRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Ats; public class PatchedEditFieldMappingRequest @@ -5,15 +7,18 @@ public class PatchedEditFieldMappingRequest /// /// The field traversal path of the remote field listed when you hit the GET /remote-fields endpoint. /// + [JsonPropertyName("remote_field_traversal_path")] public List? RemoteFieldTraversalPath { get; init; } /// /// The method of the remote endpoint where the remote field is coming from. /// + [JsonPropertyName("remote_method")] public string? RemoteMethod { get; init; } /// /// The path of the remote endpoint where the remote field is coming from. /// + [JsonPropertyName("remote_url_path")] public string? RemoteUrlPath { get; init; } } diff --git a/src/Merge.Client/Ats/GenerateKey/requests/GenerateRemoteKeyRequest.cs b/src/Merge.Client/Ats/GenerateKey/requests/GenerateRemoteKeyRequest.cs index 04ae8ca8..b762baa2 100644 --- a/src/Merge.Client/Ats/GenerateKey/requests/GenerateRemoteKeyRequest.cs +++ b/src/Merge.Client/Ats/GenerateKey/requests/GenerateRemoteKeyRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Ats; public class GenerateRemoteKeyRequest @@ -5,5 +7,6 @@ public class GenerateRemoteKeyRequest /// /// The name of the remote key /// + [JsonPropertyName("name")] public string Name { get; init; } } diff --git a/src/Merge.Client/Ats/LinkToken/requests/EndUserDetailsRequest.cs b/src/Merge.Client/Ats/LinkToken/requests/EndUserDetailsRequest.cs index 758fce5f..cae2b404 100644 --- a/src/Merge.Client/Ats/LinkToken/requests/EndUserDetailsRequest.cs +++ b/src/Merge.Client/Ats/LinkToken/requests/EndUserDetailsRequest.cs @@ -1,3 +1,4 @@ +using System.Text.Json.Serialization; using Merge.Client.Ats; namespace Merge.Client.Ats; @@ -7,46 +8,55 @@ public class EndUserDetailsRequest /// /// Your end user's email address. This is purely for identification purposes - setting this value will not cause any emails to be sent. /// + [JsonPropertyName("end_user_email_address")] public string EndUserEmailAddress { get; init; } /// /// Your end user's organization. /// + [JsonPropertyName("end_user_organization_name")] public string EndUserOrganizationName { get; init; } /// /// This unique identifier typically represents the ID for your end user in your product's database. This value must be distinct from other Linked Accounts' unique identifiers. /// + [JsonPropertyName("end_user_origin_id")] public string EndUserOriginId { get; init; } /// /// The integration categories to show in Merge Link. /// + [JsonPropertyName("categories")] public List Categories { get; init; } /// /// The slug of a specific pre-selected integration for this linking flow token. For examples of slugs, see https://docs.merge.dev/guides/merge-link/single-integration/. /// + [JsonPropertyName("integration")] public string? Integration { get; init; } /// /// An integer number of minutes between [30, 720 or 10080 if for a Magic Link URL] for how long this token is valid. Defaults to 30. /// + [JsonPropertyName("link_expiry_mins")] public int? LinkExpiryMins { get; init; } /// /// Whether to generate a Magic Link URL. Defaults to false. For more information on Magic Link, see https://merge.dev/blog/integrations-fast-say-hello-to-magic-link. /// + [JsonPropertyName("should_create_magic_link_url")] public bool? ShouldCreateMagicLinkUrl { get; init; } /// /// An array of objects to specify the models and fields that will be disabled for a given Linked Account. Each object uses model_id, enabled_actions, and disabled_fields to specify the model, method, and fields that are scoped for a given Linked Account. /// + [JsonPropertyName("common_models")] public List? CommonModels { get; init; } /// /// When creating a Link Token, you can set permissions for Common Models that will apply to the account that is going to be linked. Any model or field not specified in link token payload will default to existing settings. /// + [JsonPropertyName("category_common_model_scopes")] public Dictionary< string, List? @@ -55,10 +65,12 @@ public Dictionary< /// /// The language code for the language to localize Merge Link to. /// + [JsonPropertyName("language")] public string? Language { get; init; } /// /// A JSON object containing integration-specific configuration options. /// + [JsonPropertyName("integration_specific_config")] public Dictionary? IntegrationSpecificConfig { get; init; } } diff --git a/src/Merge.Client/Ats/RegenerateKey/requests/RemoteKeyForRegenerationRequest.cs b/src/Merge.Client/Ats/RegenerateKey/requests/RemoteKeyForRegenerationRequest.cs index 5d28dea5..ba36d8f3 100644 --- a/src/Merge.Client/Ats/RegenerateKey/requests/RemoteKeyForRegenerationRequest.cs +++ b/src/Merge.Client/Ats/RegenerateKey/requests/RemoteKeyForRegenerationRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Ats; public class RemoteKeyForRegenerationRequest @@ -5,5 +7,6 @@ public class RemoteKeyForRegenerationRequest /// /// The name of the remote key /// + [JsonPropertyName("name")] public string Name { get; init; } } diff --git a/src/Merge.Client/Ats/Scopes/requests/LinkedAccountCommonModelScopeDeserializerRequest.cs b/src/Merge.Client/Ats/Scopes/requests/LinkedAccountCommonModelScopeDeserializerRequest.cs index f9c3eb10..4b9953d4 100644 --- a/src/Merge.Client/Ats/Scopes/requests/LinkedAccountCommonModelScopeDeserializerRequest.cs +++ b/src/Merge.Client/Ats/Scopes/requests/LinkedAccountCommonModelScopeDeserializerRequest.cs @@ -1,3 +1,4 @@ +using System.Text.Json.Serialization; using Merge.Client.Ats; namespace Merge.Client.Ats; @@ -7,5 +8,6 @@ public class LinkedAccountCommonModelScopeDeserializerRequest /// /// The common models you want to update the scopes for /// + [JsonPropertyName("common_models")] public List CommonModels { get; init; } } diff --git a/src/Merge.Client/Ats/WebhookReceivers/requests/WebhookReceiverRequest.cs b/src/Merge.Client/Ats/WebhookReceivers/requests/WebhookReceiverRequest.cs index 8c0378ce..a7ef69e9 100644 --- a/src/Merge.Client/Ats/WebhookReceivers/requests/WebhookReceiverRequest.cs +++ b/src/Merge.Client/Ats/WebhookReceivers/requests/WebhookReceiverRequest.cs @@ -1,10 +1,15 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Ats; public class WebhookReceiverRequest { + [JsonPropertyName("event")] public string Event { get; init; } + [JsonPropertyName("is_active")] public bool IsActive { get; init; } + [JsonPropertyName("key")] public string? Key { get; init; } } diff --git a/src/Merge.Client/Core/JsonEnumMemberStringEnumConverter.cs b/src/Merge.Client/Core/JsonEnumMemberStringEnumConverter.cs new file mode 100644 index 00000000..dc8e64d6 --- /dev/null +++ b/src/Merge.Client/Core/JsonEnumMemberStringEnumConverter.cs @@ -0,0 +1,75 @@ +using System.Reflection; +using System.Runtime.Serialization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Merge.Client; + +#nullable enable + +/// +/// Handles serializing C# enums into the appropriate string values. +/// +public class JsonEnumMemberStringEnumConverter : JsonConverterFactory +{ + private readonly JsonNamingPolicy? _namingPolicy; + private readonly bool _allowIntegerValues; + private readonly JsonStringEnumConverter _baseConverter; + + public JsonEnumMemberStringEnumConverter( + JsonNamingPolicy? namingPolicy = null, + bool allowIntegerValues = true + ) + { + _namingPolicy = namingPolicy; + _allowIntegerValues = allowIntegerValues; + _baseConverter = new JsonStringEnumConverter(namingPolicy, allowIntegerValues); + } + + public override bool CanConvert(Type typeToConvert) => _baseConverter.CanConvert(typeToConvert); + + public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options) + { + var query = + from field in typeToConvert.GetFields(BindingFlags.Public | BindingFlags.Static) + let attr = field.GetCustomAttribute() + where attr != null && attr.Value != null + select (field.Name, attr.Value); + var dictionary = query.ToDictionary(p => p.Item1, p => p.Item2); + if (dictionary.Count > 0) + return new JsonStringEnumConverter( + new DictionaryLookupNamingPolicy(dictionary, _namingPolicy), + _allowIntegerValues + ).CreateConverter(typeToConvert, options); + else + return _baseConverter.CreateConverter(typeToConvert, options); + } +} + +public class JsonNamingPolicyDecorator : JsonNamingPolicy +{ + readonly JsonNamingPolicy? _underlyingNamingPolicy; + + protected JsonNamingPolicyDecorator(JsonNamingPolicy? underlyingNamingPolicy) + { + _underlyingNamingPolicy = underlyingNamingPolicy; + } + + public override string ConvertName(string name) => + _underlyingNamingPolicy?.ConvertName(name) ?? name; +} + +internal class DictionaryLookupNamingPolicy : JsonNamingPolicyDecorator +{ + readonly Dictionary dictionary; + + public DictionaryLookupNamingPolicy( + Dictionary dictionary, + JsonNamingPolicy? underlyingNamingPolicy + ) + : base(underlyingNamingPolicy) => + this.dictionary = dictionary ?? throw new ArgumentNullException(); + + public override string ConvertName(string name) => + dictionary.TryGetValue(name, out var value) ? value : base.ConvertName(name); +} diff --git a/src/Merge.Client/Core/RawClient.cs b/src/Merge.Client/Core/RawClient.cs index a00e9053..85f9b952 100644 --- a/src/Merge.Client/Core/RawClient.cs +++ b/src/Merge.Client/Core/RawClient.cs @@ -49,8 +49,14 @@ public async Task MakeRequestAsync(ApiRequest request) // Add the request body to the request if (request.Body != null) { + var serializerOptions = new JsonSerializerOptions + { + Converters = { new JsonEnumMemberStringEnumConverter() }, + // Set other options as required: + WriteIndented = true, + }; httpRequest.Content = new StringContent( - JsonSerializer.Serialize(request.Body), + JsonSerializer.Serialize(request.Body, serializerOptions), Encoding.UTF8, "application/json" ); diff --git a/src/Merge.Client/Crm/FieldMapping/requests/CreateFieldMappingRequest.cs b/src/Merge.Client/Crm/FieldMapping/requests/CreateFieldMappingRequest.cs index 4fea3a21..1f645a9a 100644 --- a/src/Merge.Client/Crm/FieldMapping/requests/CreateFieldMappingRequest.cs +++ b/src/Merge.Client/Crm/FieldMapping/requests/CreateFieldMappingRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Crm; public class CreateFieldMappingRequest @@ -5,30 +7,36 @@ public class CreateFieldMappingRequest /// /// The name of the target field you want this remote field to map to. /// + [JsonPropertyName("target_field_name")] public string TargetFieldName { get; init; } /// /// The description of the target field you want this remote field to map to. /// + [JsonPropertyName("target_field_description")] public string TargetFieldDescription { get; init; } /// /// The field traversal path of the remote field listed when you hit the GET /remote-fields endpoint. /// + [JsonPropertyName("remote_field_traversal_path")] public List RemoteFieldTraversalPath { get; init; } /// /// The method of the remote endpoint where the remote field is coming from. /// + [JsonPropertyName("remote_method")] public string RemoteMethod { get; init; } /// /// The path of the remote endpoint where the remote field is coming from. /// + [JsonPropertyName("remote_url_path")] public string RemoteUrlPath { get; init; } /// /// The name of the Common Model that the remote field corresponds to in a given category. /// + [JsonPropertyName("common_model_name")] public string CommonModelName { get; init; } } diff --git a/src/Merge.Client/Crm/FieldMapping/requests/PatchedEditFieldMappingRequest.cs b/src/Merge.Client/Crm/FieldMapping/requests/PatchedEditFieldMappingRequest.cs index aed6dc7b..109c0b4a 100644 --- a/src/Merge.Client/Crm/FieldMapping/requests/PatchedEditFieldMappingRequest.cs +++ b/src/Merge.Client/Crm/FieldMapping/requests/PatchedEditFieldMappingRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Crm; public class PatchedEditFieldMappingRequest @@ -5,15 +7,18 @@ public class PatchedEditFieldMappingRequest /// /// The field traversal path of the remote field listed when you hit the GET /remote-fields endpoint. /// + [JsonPropertyName("remote_field_traversal_path")] public List? RemoteFieldTraversalPath { get; init; } /// /// The method of the remote endpoint where the remote field is coming from. /// + [JsonPropertyName("remote_method")] public string? RemoteMethod { get; init; } /// /// The path of the remote endpoint where the remote field is coming from. /// + [JsonPropertyName("remote_url_path")] public string? RemoteUrlPath { get; init; } } diff --git a/src/Merge.Client/Crm/GenerateKey/requests/GenerateRemoteKeyRequest.cs b/src/Merge.Client/Crm/GenerateKey/requests/GenerateRemoteKeyRequest.cs index a312f275..8b4da250 100644 --- a/src/Merge.Client/Crm/GenerateKey/requests/GenerateRemoteKeyRequest.cs +++ b/src/Merge.Client/Crm/GenerateKey/requests/GenerateRemoteKeyRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Crm; public class GenerateRemoteKeyRequest @@ -5,5 +7,6 @@ public class GenerateRemoteKeyRequest /// /// The name of the remote key /// + [JsonPropertyName("name")] public string Name { get; init; } } diff --git a/src/Merge.Client/Crm/LinkToken/requests/EndUserDetailsRequest.cs b/src/Merge.Client/Crm/LinkToken/requests/EndUserDetailsRequest.cs index bff145e8..06ff37f0 100644 --- a/src/Merge.Client/Crm/LinkToken/requests/EndUserDetailsRequest.cs +++ b/src/Merge.Client/Crm/LinkToken/requests/EndUserDetailsRequest.cs @@ -1,3 +1,4 @@ +using System.Text.Json.Serialization; using Merge.Client.Crm; namespace Merge.Client.Crm; @@ -7,46 +8,55 @@ public class EndUserDetailsRequest /// /// Your end user's email address. This is purely for identification purposes - setting this value will not cause any emails to be sent. /// + [JsonPropertyName("end_user_email_address")] public string EndUserEmailAddress { get; init; } /// /// Your end user's organization. /// + [JsonPropertyName("end_user_organization_name")] public string EndUserOrganizationName { get; init; } /// /// This unique identifier typically represents the ID for your end user in your product's database. This value must be distinct from other Linked Accounts' unique identifiers. /// + [JsonPropertyName("end_user_origin_id")] public string EndUserOriginId { get; init; } /// /// The integration categories to show in Merge Link. /// + [JsonPropertyName("categories")] public List Categories { get; init; } /// /// The slug of a specific pre-selected integration for this linking flow token. For examples of slugs, see https://docs.merge.dev/guides/merge-link/single-integration/. /// + [JsonPropertyName("integration")] public string? Integration { get; init; } /// /// An integer number of minutes between [30, 720 or 10080 if for a Magic Link URL] for how long this token is valid. Defaults to 30. /// + [JsonPropertyName("link_expiry_mins")] public int? LinkExpiryMins { get; init; } /// /// Whether to generate a Magic Link URL. Defaults to false. For more information on Magic Link, see https://merge.dev/blog/integrations-fast-say-hello-to-magic-link. /// + [JsonPropertyName("should_create_magic_link_url")] public bool? ShouldCreateMagicLinkUrl { get; init; } /// /// An array of objects to specify the models and fields that will be disabled for a given Linked Account. Each object uses model_id, enabled_actions, and disabled_fields to specify the model, method, and fields that are scoped for a given Linked Account. /// + [JsonPropertyName("common_models")] public List? CommonModels { get; init; } /// /// When creating a Link Token, you can set permissions for Common Models that will apply to the account that is going to be linked. Any model or field not specified in link token payload will default to existing settings. /// + [JsonPropertyName("category_common_model_scopes")] public Dictionary< string, List? @@ -55,10 +65,12 @@ public Dictionary< /// /// The language code for the language to localize Merge Link to. /// + [JsonPropertyName("language")] public string? Language { get; init; } /// /// A JSON object containing integration-specific configuration options. /// + [JsonPropertyName("integration_specific_config")] public Dictionary? IntegrationSpecificConfig { get; init; } } diff --git a/src/Merge.Client/Crm/RegenerateKey/requests/RemoteKeyForRegenerationRequest.cs b/src/Merge.Client/Crm/RegenerateKey/requests/RemoteKeyForRegenerationRequest.cs index a879157c..61011095 100644 --- a/src/Merge.Client/Crm/RegenerateKey/requests/RemoteKeyForRegenerationRequest.cs +++ b/src/Merge.Client/Crm/RegenerateKey/requests/RemoteKeyForRegenerationRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Crm; public class RemoteKeyForRegenerationRequest @@ -5,5 +7,6 @@ public class RemoteKeyForRegenerationRequest /// /// The name of the remote key /// + [JsonPropertyName("name")] public string Name { get; init; } } diff --git a/src/Merge.Client/Crm/Scopes/requests/LinkedAccountCommonModelScopeDeserializerRequest.cs b/src/Merge.Client/Crm/Scopes/requests/LinkedAccountCommonModelScopeDeserializerRequest.cs index d2a7828b..b34243e6 100644 --- a/src/Merge.Client/Crm/Scopes/requests/LinkedAccountCommonModelScopeDeserializerRequest.cs +++ b/src/Merge.Client/Crm/Scopes/requests/LinkedAccountCommonModelScopeDeserializerRequest.cs @@ -1,3 +1,4 @@ +using System.Text.Json.Serialization; using Merge.Client.Crm; namespace Merge.Client.Crm; @@ -7,5 +8,6 @@ public class LinkedAccountCommonModelScopeDeserializerRequest /// /// The common models you want to update the scopes for /// + [JsonPropertyName("common_models")] public List CommonModels { get; init; } } diff --git a/src/Merge.Client/Crm/WebhookReceivers/requests/WebhookReceiverRequest.cs b/src/Merge.Client/Crm/WebhookReceivers/requests/WebhookReceiverRequest.cs index ccdb2988..b851b52e 100644 --- a/src/Merge.Client/Crm/WebhookReceivers/requests/WebhookReceiverRequest.cs +++ b/src/Merge.Client/Crm/WebhookReceivers/requests/WebhookReceiverRequest.cs @@ -1,10 +1,15 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Crm; public class WebhookReceiverRequest { + [JsonPropertyName("event")] public string Event { get; init; } + [JsonPropertyName("is_active")] public bool IsActive { get; init; } + [JsonPropertyName("key")] public string? Key { get; init; } } diff --git a/src/Merge.Client/Filestorage/FieldMapping/requests/CreateFieldMappingRequest.cs b/src/Merge.Client/Filestorage/FieldMapping/requests/CreateFieldMappingRequest.cs index f3c4be87..a16a3087 100644 --- a/src/Merge.Client/Filestorage/FieldMapping/requests/CreateFieldMappingRequest.cs +++ b/src/Merge.Client/Filestorage/FieldMapping/requests/CreateFieldMappingRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Filestorage; public class CreateFieldMappingRequest @@ -5,30 +7,36 @@ public class CreateFieldMappingRequest /// /// The name of the target field you want this remote field to map to. /// + [JsonPropertyName("target_field_name")] public string TargetFieldName { get; init; } /// /// The description of the target field you want this remote field to map to. /// + [JsonPropertyName("target_field_description")] public string TargetFieldDescription { get; init; } /// /// The field traversal path of the remote field listed when you hit the GET /remote-fields endpoint. /// + [JsonPropertyName("remote_field_traversal_path")] public List RemoteFieldTraversalPath { get; init; } /// /// The method of the remote endpoint where the remote field is coming from. /// + [JsonPropertyName("remote_method")] public string RemoteMethod { get; init; } /// /// The path of the remote endpoint where the remote field is coming from. /// + [JsonPropertyName("remote_url_path")] public string RemoteUrlPath { get; init; } /// /// The name of the Common Model that the remote field corresponds to in a given category. /// + [JsonPropertyName("common_model_name")] public string CommonModelName { get; init; } } diff --git a/src/Merge.Client/Filestorage/FieldMapping/requests/PatchedEditFieldMappingRequest.cs b/src/Merge.Client/Filestorage/FieldMapping/requests/PatchedEditFieldMappingRequest.cs index 044344cd..836e2fcb 100644 --- a/src/Merge.Client/Filestorage/FieldMapping/requests/PatchedEditFieldMappingRequest.cs +++ b/src/Merge.Client/Filestorage/FieldMapping/requests/PatchedEditFieldMappingRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Filestorage; public class PatchedEditFieldMappingRequest @@ -5,15 +7,18 @@ public class PatchedEditFieldMappingRequest /// /// The field traversal path of the remote field listed when you hit the GET /remote-fields endpoint. /// + [JsonPropertyName("remote_field_traversal_path")] public List? RemoteFieldTraversalPath { get; init; } /// /// The method of the remote endpoint where the remote field is coming from. /// + [JsonPropertyName("remote_method")] public string? RemoteMethod { get; init; } /// /// The path of the remote endpoint where the remote field is coming from. /// + [JsonPropertyName("remote_url_path")] public string? RemoteUrlPath { get; init; } } diff --git a/src/Merge.Client/Filestorage/GenerateKey/requests/GenerateRemoteKeyRequest.cs b/src/Merge.Client/Filestorage/GenerateKey/requests/GenerateRemoteKeyRequest.cs index e41b5b42..8ea94e68 100644 --- a/src/Merge.Client/Filestorage/GenerateKey/requests/GenerateRemoteKeyRequest.cs +++ b/src/Merge.Client/Filestorage/GenerateKey/requests/GenerateRemoteKeyRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Filestorage; public class GenerateRemoteKeyRequest @@ -5,5 +7,6 @@ public class GenerateRemoteKeyRequest /// /// The name of the remote key /// + [JsonPropertyName("name")] public string Name { get; init; } } diff --git a/src/Merge.Client/Filestorage/LinkToken/requests/EndUserDetailsRequest.cs b/src/Merge.Client/Filestorage/LinkToken/requests/EndUserDetailsRequest.cs index b889df1d..cdd5fcd7 100644 --- a/src/Merge.Client/Filestorage/LinkToken/requests/EndUserDetailsRequest.cs +++ b/src/Merge.Client/Filestorage/LinkToken/requests/EndUserDetailsRequest.cs @@ -1,3 +1,4 @@ +using System.Text.Json.Serialization; using Merge.Client.Filestorage; namespace Merge.Client.Filestorage; @@ -7,46 +8,55 @@ public class EndUserDetailsRequest /// /// Your end user's email address. This is purely for identification purposes - setting this value will not cause any emails to be sent. /// + [JsonPropertyName("end_user_email_address")] public string EndUserEmailAddress { get; init; } /// /// Your end user's organization. /// + [JsonPropertyName("end_user_organization_name")] public string EndUserOrganizationName { get; init; } /// /// This unique identifier typically represents the ID for your end user in your product's database. This value must be distinct from other Linked Accounts' unique identifiers. /// + [JsonPropertyName("end_user_origin_id")] public string EndUserOriginId { get; init; } /// /// The integration categories to show in Merge Link. /// + [JsonPropertyName("categories")] public List Categories { get; init; } /// /// The slug of a specific pre-selected integration for this linking flow token. For examples of slugs, see https://docs.merge.dev/guides/merge-link/single-integration/. /// + [JsonPropertyName("integration")] public string? Integration { get; init; } /// /// An integer number of minutes between [30, 720 or 10080 if for a Magic Link URL] for how long this token is valid. Defaults to 30. /// + [JsonPropertyName("link_expiry_mins")] public int? LinkExpiryMins { get; init; } /// /// Whether to generate a Magic Link URL. Defaults to false. For more information on Magic Link, see https://merge.dev/blog/integrations-fast-say-hello-to-magic-link. /// + [JsonPropertyName("should_create_magic_link_url")] public bool? ShouldCreateMagicLinkUrl { get; init; } /// /// An array of objects to specify the models and fields that will be disabled for a given Linked Account. Each object uses model_id, enabled_actions, and disabled_fields to specify the model, method, and fields that are scoped for a given Linked Account. /// + [JsonPropertyName("common_models")] public List? CommonModels { get; init; } /// /// When creating a Link Token, you can set permissions for Common Models that will apply to the account that is going to be linked. Any model or field not specified in link token payload will default to existing settings. /// + [JsonPropertyName("category_common_model_scopes")] public Dictionary< string, List? @@ -55,10 +65,12 @@ public Dictionary< /// /// The language code for the language to localize Merge Link to. /// + [JsonPropertyName("language")] public string? Language { get; init; } /// /// A JSON object containing integration-specific configuration options. /// + [JsonPropertyName("integration_specific_config")] public Dictionary? IntegrationSpecificConfig { get; init; } } diff --git a/src/Merge.Client/Filestorage/RegenerateKey/requests/RemoteKeyForRegenerationRequest.cs b/src/Merge.Client/Filestorage/RegenerateKey/requests/RemoteKeyForRegenerationRequest.cs index 09902faa..b88b84d1 100644 --- a/src/Merge.Client/Filestorage/RegenerateKey/requests/RemoteKeyForRegenerationRequest.cs +++ b/src/Merge.Client/Filestorage/RegenerateKey/requests/RemoteKeyForRegenerationRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Filestorage; public class RemoteKeyForRegenerationRequest @@ -5,5 +7,6 @@ public class RemoteKeyForRegenerationRequest /// /// The name of the remote key /// + [JsonPropertyName("name")] public string Name { get; init; } } diff --git a/src/Merge.Client/Filestorage/Scopes/requests/LinkedAccountCommonModelScopeDeserializerRequest.cs b/src/Merge.Client/Filestorage/Scopes/requests/LinkedAccountCommonModelScopeDeserializerRequest.cs index abe48e04..86a01401 100644 --- a/src/Merge.Client/Filestorage/Scopes/requests/LinkedAccountCommonModelScopeDeserializerRequest.cs +++ b/src/Merge.Client/Filestorage/Scopes/requests/LinkedAccountCommonModelScopeDeserializerRequest.cs @@ -1,3 +1,4 @@ +using System.Text.Json.Serialization; using Merge.Client.Filestorage; namespace Merge.Client.Filestorage; @@ -7,5 +8,6 @@ public class LinkedAccountCommonModelScopeDeserializerRequest /// /// The common models you want to update the scopes for /// + [JsonPropertyName("common_models")] public List CommonModels { get; init; } } diff --git a/src/Merge.Client/Filestorage/WebhookReceivers/requests/WebhookReceiverRequest.cs b/src/Merge.Client/Filestorage/WebhookReceivers/requests/WebhookReceiverRequest.cs index 93e5dcbf..49f211c3 100644 --- a/src/Merge.Client/Filestorage/WebhookReceivers/requests/WebhookReceiverRequest.cs +++ b/src/Merge.Client/Filestorage/WebhookReceivers/requests/WebhookReceiverRequest.cs @@ -1,10 +1,15 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Filestorage; public class WebhookReceiverRequest { + [JsonPropertyName("event")] public string Event { get; init; } + [JsonPropertyName("is_active")] public bool IsActive { get; init; } + [JsonPropertyName("key")] public string? Key { get; init; } } diff --git a/src/Merge.Client/Hris/Employees/requests/IgnoreCommonModelRequest.cs b/src/Merge.Client/Hris/Employees/requests/IgnoreCommonModelRequest.cs index 5a2619fc..5522e5eb 100644 --- a/src/Merge.Client/Hris/Employees/requests/IgnoreCommonModelRequest.cs +++ b/src/Merge.Client/Hris/Employees/requests/IgnoreCommonModelRequest.cs @@ -1,10 +1,13 @@ +using System.Text.Json.Serialization; using Merge.Client.Hris; namespace Merge.Client.Hris; public class IgnoreCommonModelRequest { + [JsonPropertyName("reason")] public ReasonEnum Reason { get; init; } + [JsonPropertyName("message")] public string? Message { get; init; } } diff --git a/src/Merge.Client/Hris/FieldMapping/requests/CreateFieldMappingRequest.cs b/src/Merge.Client/Hris/FieldMapping/requests/CreateFieldMappingRequest.cs index c3d45af1..80d11e4d 100644 --- a/src/Merge.Client/Hris/FieldMapping/requests/CreateFieldMappingRequest.cs +++ b/src/Merge.Client/Hris/FieldMapping/requests/CreateFieldMappingRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Hris; public class CreateFieldMappingRequest @@ -5,30 +7,36 @@ public class CreateFieldMappingRequest /// /// The name of the target field you want this remote field to map to. /// + [JsonPropertyName("target_field_name")] public string TargetFieldName { get; init; } /// /// The description of the target field you want this remote field to map to. /// + [JsonPropertyName("target_field_description")] public string TargetFieldDescription { get; init; } /// /// The field traversal path of the remote field listed when you hit the GET /remote-fields endpoint. /// + [JsonPropertyName("remote_field_traversal_path")] public List RemoteFieldTraversalPath { get; init; } /// /// The method of the remote endpoint where the remote field is coming from. /// + [JsonPropertyName("remote_method")] public string RemoteMethod { get; init; } /// /// The path of the remote endpoint where the remote field is coming from. /// + [JsonPropertyName("remote_url_path")] public string RemoteUrlPath { get; init; } /// /// The name of the Common Model that the remote field corresponds to in a given category. /// + [JsonPropertyName("common_model_name")] public string CommonModelName { get; init; } } diff --git a/src/Merge.Client/Hris/FieldMapping/requests/PatchedEditFieldMappingRequest.cs b/src/Merge.Client/Hris/FieldMapping/requests/PatchedEditFieldMappingRequest.cs index 4ea1aad9..73c468e2 100644 --- a/src/Merge.Client/Hris/FieldMapping/requests/PatchedEditFieldMappingRequest.cs +++ b/src/Merge.Client/Hris/FieldMapping/requests/PatchedEditFieldMappingRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Hris; public class PatchedEditFieldMappingRequest @@ -5,15 +7,18 @@ public class PatchedEditFieldMappingRequest /// /// The field traversal path of the remote field listed when you hit the GET /remote-fields endpoint. /// + [JsonPropertyName("remote_field_traversal_path")] public List? RemoteFieldTraversalPath { get; init; } /// /// The method of the remote endpoint where the remote field is coming from. /// + [JsonPropertyName("remote_method")] public string? RemoteMethod { get; init; } /// /// The path of the remote endpoint where the remote field is coming from. /// + [JsonPropertyName("remote_url_path")] public string? RemoteUrlPath { get; init; } } diff --git a/src/Merge.Client/Hris/GenerateKey/requests/GenerateRemoteKeyRequest.cs b/src/Merge.Client/Hris/GenerateKey/requests/GenerateRemoteKeyRequest.cs index cfc9f947..f6aa8323 100644 --- a/src/Merge.Client/Hris/GenerateKey/requests/GenerateRemoteKeyRequest.cs +++ b/src/Merge.Client/Hris/GenerateKey/requests/GenerateRemoteKeyRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Hris; public class GenerateRemoteKeyRequest @@ -5,5 +7,6 @@ public class GenerateRemoteKeyRequest /// /// The name of the remote key /// + [JsonPropertyName("name")] public string Name { get; init; } } diff --git a/src/Merge.Client/Hris/LinkToken/requests/EndUserDetailsRequest.cs b/src/Merge.Client/Hris/LinkToken/requests/EndUserDetailsRequest.cs index 6a12ed49..f868a71c 100644 --- a/src/Merge.Client/Hris/LinkToken/requests/EndUserDetailsRequest.cs +++ b/src/Merge.Client/Hris/LinkToken/requests/EndUserDetailsRequest.cs @@ -1,3 +1,4 @@ +using System.Text.Json.Serialization; using Merge.Client.Hris; namespace Merge.Client.Hris; @@ -7,46 +8,55 @@ public class EndUserDetailsRequest /// /// Your end user's email address. This is purely for identification purposes - setting this value will not cause any emails to be sent. /// + [JsonPropertyName("end_user_email_address")] public string EndUserEmailAddress { get; init; } /// /// Your end user's organization. /// + [JsonPropertyName("end_user_organization_name")] public string EndUserOrganizationName { get; init; } /// /// This unique identifier typically represents the ID for your end user in your product's database. This value must be distinct from other Linked Accounts' unique identifiers. /// + [JsonPropertyName("end_user_origin_id")] public string EndUserOriginId { get; init; } /// /// The integration categories to show in Merge Link. /// + [JsonPropertyName("categories")] public List Categories { get; init; } /// /// The slug of a specific pre-selected integration for this linking flow token. For examples of slugs, see https://docs.merge.dev/guides/merge-link/single-integration/. /// + [JsonPropertyName("integration")] public string? Integration { get; init; } /// /// An integer number of minutes between [30, 720 or 10080 if for a Magic Link URL] for how long this token is valid. Defaults to 30. /// + [JsonPropertyName("link_expiry_mins")] public int? LinkExpiryMins { get; init; } /// /// Whether to generate a Magic Link URL. Defaults to false. For more information on Magic Link, see https://merge.dev/blog/integrations-fast-say-hello-to-magic-link. /// + [JsonPropertyName("should_create_magic_link_url")] public bool? ShouldCreateMagicLinkUrl { get; init; } /// /// An array of objects to specify the models and fields that will be disabled for a given Linked Account. Each object uses model_id, enabled_actions, and disabled_fields to specify the model, method, and fields that are scoped for a given Linked Account. /// + [JsonPropertyName("common_models")] public List? CommonModels { get; init; } /// /// When creating a Link Token, you can set permissions for Common Models that will apply to the account that is going to be linked. Any model or field not specified in link token payload will default to existing settings. /// + [JsonPropertyName("category_common_model_scopes")] public Dictionary< string, List? @@ -55,10 +65,12 @@ public Dictionary< /// /// The language code for the language to localize Merge Link to. /// + [JsonPropertyName("language")] public string? Language { get; init; } /// /// A JSON object containing integration-specific configuration options. /// + [JsonPropertyName("integration_specific_config")] public Dictionary? IntegrationSpecificConfig { get; init; } } diff --git a/src/Merge.Client/Hris/RegenerateKey/requests/RemoteKeyForRegenerationRequest.cs b/src/Merge.Client/Hris/RegenerateKey/requests/RemoteKeyForRegenerationRequest.cs index eb20087e..2f7b146b 100644 --- a/src/Merge.Client/Hris/RegenerateKey/requests/RemoteKeyForRegenerationRequest.cs +++ b/src/Merge.Client/Hris/RegenerateKey/requests/RemoteKeyForRegenerationRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Hris; public class RemoteKeyForRegenerationRequest @@ -5,5 +7,6 @@ public class RemoteKeyForRegenerationRequest /// /// The name of the remote key /// + [JsonPropertyName("name")] public string Name { get; init; } } diff --git a/src/Merge.Client/Hris/Scopes/requests/LinkedAccountCommonModelScopeDeserializerRequest.cs b/src/Merge.Client/Hris/Scopes/requests/LinkedAccountCommonModelScopeDeserializerRequest.cs index 59f583ad..c39656fe 100644 --- a/src/Merge.Client/Hris/Scopes/requests/LinkedAccountCommonModelScopeDeserializerRequest.cs +++ b/src/Merge.Client/Hris/Scopes/requests/LinkedAccountCommonModelScopeDeserializerRequest.cs @@ -1,3 +1,4 @@ +using System.Text.Json.Serialization; using Merge.Client.Hris; namespace Merge.Client.Hris; @@ -7,5 +8,6 @@ public class LinkedAccountCommonModelScopeDeserializerRequest /// /// The common models you want to update the scopes for /// + [JsonPropertyName("common_models")] public List CommonModels { get; init; } } diff --git a/src/Merge.Client/Hris/WebhookReceivers/requests/WebhookReceiverRequest.cs b/src/Merge.Client/Hris/WebhookReceivers/requests/WebhookReceiverRequest.cs index 710d9dfa..d3c1da5d 100644 --- a/src/Merge.Client/Hris/WebhookReceivers/requests/WebhookReceiverRequest.cs +++ b/src/Merge.Client/Hris/WebhookReceivers/requests/WebhookReceiverRequest.cs @@ -1,10 +1,15 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Hris; public class WebhookReceiverRequest { + [JsonPropertyName("event")] public string Event { get; init; } + [JsonPropertyName("is_active")] public bool IsActive { get; init; } + [JsonPropertyName("key")] public string? Key { get; init; } } diff --git a/src/Merge.Client/Merge.Client.csproj b/src/Merge.Client/Merge.Client.csproj index 1c832068..c976c853 100644 --- a/src/Merge.Client/Merge.Client.csproj +++ b/src/Merge.Client/Merge.Client.csproj @@ -5,7 +5,7 @@ net7.0 enable false - 0.0.6 + 0.0.7 README.md LICENSE https://github.com/merge-api/merge-csharp-client @@ -20,8 +20,9 @@ - - - + + + + diff --git a/src/Merge.Client/Merge.cs b/src/Merge.Client/Merge.cs index 04933f59..54fb06d5 100644 --- a/src/Merge.Client/Merge.cs +++ b/src/Merge.Client/Merge.cs @@ -25,28 +25,28 @@ public Merge( { "X-Account-Token", accountToken }, { "X-Fern-Language", "C#" }, { "X-Fern-SDK-Name", "Merge.Client" }, - { "X-Fern-SDK-Version", "0.0.6" }, + { "X-Fern-SDK-Version", "0.0.7" }, }, clientOptions ?? new ClientOptions() ); Ats = new AtsClient(_client); - Crm = new CrmClient(_client); Filestorage = new FilestorageClient(_client); Hris = new HrisClient(_client); Ticketing = new TicketingClient(_client); + Crm = new CrmClient(_client); Accounting = new AccountingClient(_client); } public AtsClient Ats { get; } - public CrmClient Crm { get; } - public FilestorageClient Filestorage { get; } public HrisClient Hris { get; } public TicketingClient Ticketing { get; } + public CrmClient Crm { get; } + public AccountingClient Accounting { get; } private string GetFromEnvironmentOrThrow(string env, string message) diff --git a/src/Merge.Client/Ticketing/FieldMapping/requests/CreateFieldMappingRequest.cs b/src/Merge.Client/Ticketing/FieldMapping/requests/CreateFieldMappingRequest.cs index a5b02057..bf410dea 100644 --- a/src/Merge.Client/Ticketing/FieldMapping/requests/CreateFieldMappingRequest.cs +++ b/src/Merge.Client/Ticketing/FieldMapping/requests/CreateFieldMappingRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Ticketing; public class CreateFieldMappingRequest @@ -5,30 +7,36 @@ public class CreateFieldMappingRequest /// /// The name of the target field you want this remote field to map to. /// + [JsonPropertyName("target_field_name")] public string TargetFieldName { get; init; } /// /// The description of the target field you want this remote field to map to. /// + [JsonPropertyName("target_field_description")] public string TargetFieldDescription { get; init; } /// /// The field traversal path of the remote field listed when you hit the GET /remote-fields endpoint. /// + [JsonPropertyName("remote_field_traversal_path")] public List RemoteFieldTraversalPath { get; init; } /// /// The method of the remote endpoint where the remote field is coming from. /// + [JsonPropertyName("remote_method")] public string RemoteMethod { get; init; } /// /// The path of the remote endpoint where the remote field is coming from. /// + [JsonPropertyName("remote_url_path")] public string RemoteUrlPath { get; init; } /// /// The name of the Common Model that the remote field corresponds to in a given category. /// + [JsonPropertyName("common_model_name")] public string CommonModelName { get; init; } } diff --git a/src/Merge.Client/Ticketing/FieldMapping/requests/PatchedEditFieldMappingRequest.cs b/src/Merge.Client/Ticketing/FieldMapping/requests/PatchedEditFieldMappingRequest.cs index 9d2522b8..cff1c5d5 100644 --- a/src/Merge.Client/Ticketing/FieldMapping/requests/PatchedEditFieldMappingRequest.cs +++ b/src/Merge.Client/Ticketing/FieldMapping/requests/PatchedEditFieldMappingRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Ticketing; public class PatchedEditFieldMappingRequest @@ -5,15 +7,18 @@ public class PatchedEditFieldMappingRequest /// /// The field traversal path of the remote field listed when you hit the GET /remote-fields endpoint. /// + [JsonPropertyName("remote_field_traversal_path")] public List? RemoteFieldTraversalPath { get; init; } /// /// The method of the remote endpoint where the remote field is coming from. /// + [JsonPropertyName("remote_method")] public string? RemoteMethod { get; init; } /// /// The path of the remote endpoint where the remote field is coming from. /// + [JsonPropertyName("remote_url_path")] public string? RemoteUrlPath { get; init; } } diff --git a/src/Merge.Client/Ticketing/GenerateKey/requests/GenerateRemoteKeyRequest.cs b/src/Merge.Client/Ticketing/GenerateKey/requests/GenerateRemoteKeyRequest.cs index 7ca2303c..8ac9df6b 100644 --- a/src/Merge.Client/Ticketing/GenerateKey/requests/GenerateRemoteKeyRequest.cs +++ b/src/Merge.Client/Ticketing/GenerateKey/requests/GenerateRemoteKeyRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Ticketing; public class GenerateRemoteKeyRequest @@ -5,5 +7,6 @@ public class GenerateRemoteKeyRequest /// /// The name of the remote key /// + [JsonPropertyName("name")] public string Name { get; init; } } diff --git a/src/Merge.Client/Ticketing/LinkToken/requests/EndUserDetailsRequest.cs b/src/Merge.Client/Ticketing/LinkToken/requests/EndUserDetailsRequest.cs index bc657736..6e6794ed 100644 --- a/src/Merge.Client/Ticketing/LinkToken/requests/EndUserDetailsRequest.cs +++ b/src/Merge.Client/Ticketing/LinkToken/requests/EndUserDetailsRequest.cs @@ -1,3 +1,4 @@ +using System.Text.Json.Serialization; using Merge.Client.Ticketing; namespace Merge.Client.Ticketing; @@ -7,46 +8,55 @@ public class EndUserDetailsRequest /// /// Your end user's email address. This is purely for identification purposes - setting this value will not cause any emails to be sent. /// + [JsonPropertyName("end_user_email_address")] public string EndUserEmailAddress { get; init; } /// /// Your end user's organization. /// + [JsonPropertyName("end_user_organization_name")] public string EndUserOrganizationName { get; init; } /// /// This unique identifier typically represents the ID for your end user in your product's database. This value must be distinct from other Linked Accounts' unique identifiers. /// + [JsonPropertyName("end_user_origin_id")] public string EndUserOriginId { get; init; } /// /// The integration categories to show in Merge Link. /// + [JsonPropertyName("categories")] public List Categories { get; init; } /// /// The slug of a specific pre-selected integration for this linking flow token. For examples of slugs, see https://docs.merge.dev/guides/merge-link/single-integration/. /// + [JsonPropertyName("integration")] public string? Integration { get; init; } /// /// An integer number of minutes between [30, 720 or 10080 if for a Magic Link URL] for how long this token is valid. Defaults to 30. /// + [JsonPropertyName("link_expiry_mins")] public int? LinkExpiryMins { get; init; } /// /// Whether to generate a Magic Link URL. Defaults to false. For more information on Magic Link, see https://merge.dev/blog/integrations-fast-say-hello-to-magic-link. /// + [JsonPropertyName("should_create_magic_link_url")] public bool? ShouldCreateMagicLinkUrl { get; init; } /// /// An array of objects to specify the models and fields that will be disabled for a given Linked Account. Each object uses model_id, enabled_actions, and disabled_fields to specify the model, method, and fields that are scoped for a given Linked Account. /// + [JsonPropertyName("common_models")] public List? CommonModels { get; init; } /// /// When creating a Link Token, you can set permissions for Common Models that will apply to the account that is going to be linked. Any model or field not specified in link token payload will default to existing settings. /// + [JsonPropertyName("category_common_model_scopes")] public Dictionary< string, List? @@ -55,10 +65,12 @@ public Dictionary< /// /// The language code for the language to localize Merge Link to. /// + [JsonPropertyName("language")] public string? Language { get; init; } /// /// A JSON object containing integration-specific configuration options. /// + [JsonPropertyName("integration_specific_config")] public Dictionary? IntegrationSpecificConfig { get; init; } } diff --git a/src/Merge.Client/Ticketing/RegenerateKey/requests/RemoteKeyForRegenerationRequest.cs b/src/Merge.Client/Ticketing/RegenerateKey/requests/RemoteKeyForRegenerationRequest.cs index 800e067b..a37b96f6 100644 --- a/src/Merge.Client/Ticketing/RegenerateKey/requests/RemoteKeyForRegenerationRequest.cs +++ b/src/Merge.Client/Ticketing/RegenerateKey/requests/RemoteKeyForRegenerationRequest.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Ticketing; public class RemoteKeyForRegenerationRequest @@ -5,5 +7,6 @@ public class RemoteKeyForRegenerationRequest /// /// The name of the remote key /// + [JsonPropertyName("name")] public string Name { get; init; } } diff --git a/src/Merge.Client/Ticketing/Scopes/requests/LinkedAccountCommonModelScopeDeserializerRequest.cs b/src/Merge.Client/Ticketing/Scopes/requests/LinkedAccountCommonModelScopeDeserializerRequest.cs index 90814691..6ac86107 100644 --- a/src/Merge.Client/Ticketing/Scopes/requests/LinkedAccountCommonModelScopeDeserializerRequest.cs +++ b/src/Merge.Client/Ticketing/Scopes/requests/LinkedAccountCommonModelScopeDeserializerRequest.cs @@ -1,3 +1,4 @@ +using System.Text.Json.Serialization; using Merge.Client.Ticketing; namespace Merge.Client.Ticketing; @@ -7,5 +8,6 @@ public class LinkedAccountCommonModelScopeDeserializerRequest /// /// The common models you want to update the scopes for /// + [JsonPropertyName("common_models")] public List CommonModels { get; init; } } diff --git a/src/Merge.Client/Ticketing/WebhookReceivers/requests/WebhookReceiverRequest.cs b/src/Merge.Client/Ticketing/WebhookReceivers/requests/WebhookReceiverRequest.cs index 0da0a8b3..f7de8dfb 100644 --- a/src/Merge.Client/Ticketing/WebhookReceivers/requests/WebhookReceiverRequest.cs +++ b/src/Merge.Client/Ticketing/WebhookReceivers/requests/WebhookReceiverRequest.cs @@ -1,10 +1,15 @@ +using System.Text.Json.Serialization; + namespace Merge.Client.Ticketing; public class WebhookReceiverRequest { + [JsonPropertyName("event")] public string Event { get; init; } + [JsonPropertyName("is_active")] public bool IsActive { get; init; } + [JsonPropertyName("key")] public string? Key { get; init; } }