Account Settings Get Response (AccountSettingsResponse) Class
The AccountSettingsResponse class is used by the Account Settings API to return a client's account visibility settings. This is typically the response to a GET request querying for a client's current preferences.
Purpose
This model provides a structured way for the API to send back the visibility status of various accounts associated with a client, potentially grouped by profiles. Applications would parse this response to understand which accounts to display or hide for the user.
Properties of AccountSettingsResponse
| Property Name | Type | Required | JSON Property Name | Description |
|---|---|---|---|---|
Gcn | string | No | gcn | The Global Client Number for whom the settings are being returned. |
BusinessUnitName | string | No | businessUnitName | The name of the business unit these settings pertain to. |
ProfileAccounts | List<AccountSettingsProfileAccountResponse> | No | ProfileAccounts | A list of profiles, each containing a list of accounts and their visibility settings as defined in AccountModel. |
Nested Class: Account Settings Profile Account Response (AccountSettingsProfileAccountResponse)
This class represents a grouping of accounts under a specific profile within the response.
Properties of AccountSettingsProfileAccountResponse:
| Property Name | Type | Required | JSON Property Name | Description |
|---|---|---|---|---|
ProfileId | string | No | (Defaults to ProfileId) | An identifier for the client's profile. |
AccountList | List<AccountModel> | No | (Defaults to AccountList) | A list of AccountModel objects, each detailing an account and its currentvisibility state ( AccountHidden property within AccountModel). |
Note: The properties ProfileId and AccountList in AccountSettingsProfileAccountResponse do not have explicit [JsonPropertyName] attributes in the provided C# code. Their JSON names will depend on the serializer's default behavior (e.g., profileId, accountList if camelCase is default, or ProfileId, AccountList if PascalCase is default).
Validation
The provided C# code for AccountSettingsResponse and its nested class AccountSettingsProfileAccountResponse does not show any [Required] attributes. This suggests that validation might be handled by the consumer, or all fields are considered optional in the response context (e.g., an empty list for ProfileAccounts if no settings are found).
Example Usage (Conceptual C# for consuming the response)
using Investec.AccountSettings.Models;
using System.Collections.Generic;
using System.Text.Json; // Assuming System.Text.Json is used for deserialization
// Assume 'jsonResponse' is a string containing the JSON data from the API
string jsonResponse = @"{
""gcn"": ""123456789"",
""businessUnitName"": ""Private Bank SA"",
""ProfileAccounts"": [
{
""ProfileId"": ""DefaultProfile01"",
""AccountList"": [
{
""AccountNumber"": ""ACC001"",
""AccountName"": ""My Cheque Account"",
""AccountType"": ""Cheque"",
""ProductSegment"": ""Transactional"",
""BusinessUnit"": ""Private Bank SA"",
""AccountHidden"": false,
""DateUpdated"": ""2023-10-26T10:00:00Z""
},
{
""AccountNumber"": ""ACC002"",
""AccountName"": ""My Savings Account"",
""AccountType"": ""Savings"",
""ProductSegment"": ""Savings"",
""BusinessUnit"": ""Private Bank SA"",
""AccountHidden"": true,
""DateUpdated"": ""2023-10-26T10:05:00Z""
}
]
}
]
}";
var options = new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true // Good practice for resilience
};
AccountSettingsResponse settingsResponse = JsonSerializer.Deserialize<AccountSettingsResponse>(jsonResponse, options);
// Now you can access the data:
// Console.WriteLine($"GCN: {settingsResponse.Gcn}");
// if (settingsResponse.ProfileAccounts != null)
// {
// foreach (var profile in settingsResponse.ProfileAccounts)
// {
// Console.WriteLine($" Profile ID: {profile.ProfileId}");
// if (profile.AccountList != null)
// {
// foreach (var account in profile.AccountList)
// {
// Console.WriteLine($" Account: {account.AccountName}, Hidden: {account.AccountHidden}");
// }
// }
// }
// }This response structure allows applications to easily parse and use the account visibility settings to render the correct view for the client.