GetCustomerTokenResponse
Properties
-
data(['object', 'null'])Cannot contain additional properties.authToken(string, required)expiresOn(string, required)
-
failureMessages(array)- Items (string)
-
informationalMessages(array)- Items (string)
-
operationWasSuccessful(boolean)
Examples
{
"data": {
"authToken": "k9AJphtSgE1wrJDND9lTuYwwrL03T9jhAw6E4bBn6YU4pWC3Ek4HkMXWTYYes3YFCd53aRv0gTD16Z7XrCs2J6jg1Stj1q8PSsYnEALr43X0iUBCy53kOmgNUi6owcJf81jlTSfMsEY1WRzpf6GqMYcS1L5J0WTf6hEBz43ychVSVwWximMKVJj9jEToBgz1rIBPf36GYMlSQHiYmL3LzSLrAPpCXuXTJghPPmPBwYlchmlPSSsoalHif9Yy9bbpsBSc1xRfDnu50ukSmFABYJIpsJzn4SxTbBGb11qCP0z2nOUpbXM9aJWHRsDFfRxNbJordulASEZSU6UAqF7Rgo1dGFJg8Miyw8xnjS7yIajUSaZrOXj2qbXDiSOi5fEVD3j4Y5mTQZMRH0BjG76xNjZ6L6FCE4LxqCXw55tgBrGeN4WGXrn1KdfHN8WWk8dVjgVV0i1CjXFzxBj0ZIpYGQco3QyDW3pSjM6f3VbaYNZ53WVVXK6OhkCQl8P4lvBxmBWV1rM3ECbkgegyzw64vNOilWqbdzFDh75v4Ko7NMekmHpb1s0iy7VYLysJC6uyPTlaPsoLZcB8KmadPZAnylhoxPXG2O0qpcbmW4bbeQi1yytz9rCI0iXyLM7cn014Np99eABYogdGT0MaJBADnauq4n7xrT6RTjTL2cp4xqjmpTkokGfwPR0kNtPD61Mmbc5wV3f3Vw63akdZT92xkSLdIQC7zy6UXDS3mWkj3q5ezEAYWCuRYQRtY7MY6ufuyH2r0TXhgwyQLSZp5V0n0uedyXTgAlpkz9aLKKrq7YIOC2oNuAPuOmbeVE6SkNK5deDD2NyRsmNNk0f4GEgRRs51PTRAO9ThzzupCm4Rr3fJz9tTYdP63mCPUvmmgVbMPlkE8YUiHNAaJE7SL20oV6DpvYyP8gde5lEBcnTj0rJnzC7HxS0X3n3FssmdZzBIa248DzYD2tdLes7n0FVt2qEbkLBlwNFIJCMKfCxO9VVGUjcptrE9RUOUDekflEu4av8m2aRSeugKkfYbMO7",
"expiresOn": "2024-11-21T19:48:53.7527531Z"
},
"failureMessages": [],
"informationalMessages": [],
"operationWasSuccessful": true
}
Quicktype Command
quicktype \
--framework SystemTextJson \
--lang cs \
--number-type double \
--src-lang schema \
--no-check-required \
--density dense \
--features complete \
--namespace OtpSchema.Api.IdentityBroker.GetCustomerTokenResponse \
--src .working/build/internal/json-schema-for-cs/GetCustomerTokenResponse.json -o .working/build/internal/csharp/OtpSchema/Api/IdentityBroker/GetCustomerTokenResponse.cs
GetCustomerTokenResponse
// <auto-generated />
//
// To parse this JSON data, add NuGet 'System.Text.Json' then do:
//
// using OtpSchema.Api.IdentityBroker.GetCustomerTokenResponse;
//
// var getCustomerTokenResponse = GetCustomerTokenResponse.FromJson(jsonString);
#nullable enable
#pragma warning disable CS8618
#pragma warning disable CS8601
#pragma warning disable CS8603
namespace OtpSchema.Api.IdentityBroker.GetCustomerTokenResponse
{
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Globalization;
using J = System.Text.Json.Serialization.JsonPropertyNameAttribute;
using N = System.Text.Json.Serialization.JsonIgnoreCondition;
public partial class GetCustomerTokenResponse
{
[J("data")] public Data Data { get; set; }
[J("failureMessages")] public string[] FailureMessages { get; set; }
[J("informationalMessages")] public string[] InformationalMessages { get; set; }
[J("operationWasSuccessful")] public bool OperationWasSuccessful { get; set; }
}
public partial class Data
{
[J("authToken")] public string AuthToken { get; set; }
[J("expiresOn")] public string ExpiresOn { get; set; }
}
public partial class GetCustomerTokenResponse
{
public static GetCustomerTokenResponse FromJson(string json) => JsonSerializer.Deserialize<GetCustomerTokenResponse>(json, OtpSchema.Api.IdentityBroker.GetCustomerTokenResponse.Converter.Settings);
}
public static class Serialize
{
public static string ToJson(this GetCustomerTokenResponse self) => JsonSerializer.Serialize(self, OtpSchema.Api.IdentityBroker.GetCustomerTokenResponse.Converter.Settings);
}
internal static class Converter
{
public static readonly JsonSerializerOptions Settings = new(JsonSerializerDefaults.General)
{
Converters =
{
new DateOnlyConverter(),
new TimeOnlyConverter(),
IsoDateTimeOffsetConverter.Singleton
},
};
}
public class DateOnlyConverter : JsonConverter<DateOnly>
{
private readonly string serializationFormat;
public DateOnlyConverter() : this(null) { }
public DateOnlyConverter(string? serializationFormat)
{
this.serializationFormat = serializationFormat ?? "yyyy-MM-dd";
}
public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
return DateOnly.Parse(value!);
}
public override void Write(Utf8JsonWriter writer, DateOnly value, JsonSerializerOptions options)
=> writer.WriteStringValue(value.ToString(serializationFormat));
}
public class TimeOnlyConverter : JsonConverter<TimeOnly>
{
private readonly string serializationFormat;
public TimeOnlyConverter() : this(null) { }
public TimeOnlyConverter(string? serializationFormat)
{
this.serializationFormat = serializationFormat ?? "HH:mm:ss.fff";
}
public override TimeOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
return TimeOnly.Parse(value!);
}
public override void Write(Utf8JsonWriter writer, TimeOnly value, JsonSerializerOptions options)
=> writer.WriteStringValue(value.ToString(serializationFormat));
}
internal class IsoDateTimeOffsetConverter : JsonConverter<DateTimeOffset>
{
public override bool CanConvert(Type t) => t == typeof(DateTimeOffset);
private const string DefaultDateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK";
private DateTimeStyles _dateTimeStyles = DateTimeStyles.RoundtripKind;
private string? _dateTimeFormat;
private CultureInfo? _culture;
public DateTimeStyles DateTimeStyles
{
get => _dateTimeStyles;
set => _dateTimeStyles = value;
}
public string? DateTimeFormat
{
get => _dateTimeFormat ?? string.Empty;
set => _dateTimeFormat = (string.IsNullOrEmpty(value)) ? null : value;
}
public CultureInfo Culture
{
get => _culture ?? CultureInfo.CurrentCulture;
set => _culture = value;
}
public override void Write(Utf8JsonWriter writer, DateTimeOffset value, JsonSerializerOptions options)
{
string text;
if ((_dateTimeStyles & DateTimeStyles.AdjustToUniversal) == DateTimeStyles.AdjustToUniversal
|| (_dateTimeStyles & DateTimeStyles.AssumeUniversal) == DateTimeStyles.AssumeUniversal)
{
value = value.ToUniversalTime();
}
text = value.ToString(_dateTimeFormat ?? DefaultDateTimeFormat, Culture);
writer.WriteStringValue(text);
}
public override DateTimeOffset Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
string? dateText = reader.GetString();
if (string.IsNullOrEmpty(dateText) == false)
{
if (!string.IsNullOrEmpty(_dateTimeFormat))
{
return DateTimeOffset.ParseExact(dateText, _dateTimeFormat, Culture, _dateTimeStyles);
}
else
{
return DateTimeOffset.Parse(dateText, Culture, _dateTimeStyles);
}
}
else
{
return default(DateTimeOffset);
}
}
public static readonly IsoDateTimeOffsetConverter Singleton = new IsoDateTimeOffsetConverter();
}
}
#pragma warning restore CS8618
#pragma warning restore CS8601
#pragma warning restore CS8603
GetCustomerTokenResponse
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "GetCustomerTokenResponse.json",
"type": "object",
"additionalProperties": false,
"properties": {
"data": {
"type": ["object", "null"],
"additionalProperties": false,
"properties": { "authToken": {"type": "string"}, "expiresOn": {"type": "string"} },
"required": ["authToken", "expiresOn"]
},
"failureMessages": { "type": "array", "items": {"type": "string"} },
"informationalMessages": { "type": "array", "items": {"type": "string"} },
"operationWasSuccessful": {"type": "boolean"}
},
"required": ["failureMessages", "informationalMessages", "operationWasSuccessful", "data"],
"examples": [
{
"data": {
"authToken": "k9AJphtSgE1wrJDND9lTuYwwrL03T9jhAw6E4bBn6YU4pWC3Ek4HkMXWTYYes3YFCd53aRv0gTD16Z7XrCs2J6jg1Stj1q8PSsYnEALr43X0iUBCy53kOmgNUi6owcJf81jlTSfMsEY1WRzpf6GqMYcS1L5J0WTf6hEBz43ychVSVwWximMKVJj9jEToBgz1rIBPf36GYMlSQHiYmL3LzSLrAPpCXuXTJghPPmPBwYlchmlPSSsoalHif9Yy9bbpsBSc1xRfDnu50ukSmFABYJIpsJzn4SxTbBGb11qCP0z2nOUpbXM9aJWHRsDFfRxNbJordulASEZSU6UAqF7Rgo1dGFJg8Miyw8xnjS7yIajUSaZrOXj2qbXDiSOi5fEVD3j4Y5mTQZMRH0BjG76xNjZ6L6FCE4LxqCXw55tgBrGeN4WGXrn1KdfHN8WWk8dVjgVV0i1CjXFzxBj0ZIpYGQco3QyDW3pSjM6f3VbaYNZ53WVVXK6OhkCQl8P4lvBxmBWV1rM3ECbkgegyzw64vNOilWqbdzFDh75v4Ko7NMekmHpb1s0iy7VYLysJC6uyPTlaPsoLZcB8KmadPZAnylhoxPXG2O0qpcbmW4bbeQi1yytz9rCI0iXyLM7cn014Np99eABYogdGT0MaJBADnauq4n7xrT6RTjTL2cp4xqjmpTkokGfwPR0kNtPD61Mmbc5wV3f3Vw63akdZT92xkSLdIQC7zy6UXDS3mWkj3q5ezEAYWCuRYQRtY7MY6ufuyH2r0TXhgwyQLSZp5V0n0uedyXTgAlpkz9aLKKrq7YIOC2oNuAPuOmbeVE6SkNK5deDD2NyRsmNNk0f4GEgRRs51PTRAO9ThzzupCm4Rr3fJz9tTYdP63mCPUvmmgVbMPlkE8YUiHNAaJE7SL20oV6DpvYyP8gde5lEBcnTj0rJnzC7HxS0X3n3FssmdZzBIa248DzYD2tdLes7n0FVt2qEbkLBlwNFIJCMKfCxO9VVGUjcptrE9RUOUDekflEu4av8m2aRSeugKkfYbMO7",
"expiresOn": "2024-11-21T19:48:53.7527531Z"
},
"failureMessages": [],
"informationalMessages": [],
"operationWasSuccessful": true
}
]
}