Skip to content

GetAllProductsResponse

Properties

  • data (['array', 'null'])

    • Items (object)Cannot contain additional properties.

      • billingEntityId (['string', 'null'])Billing entity ID associated with the product.
      • productId (string, required)Unique ID for component product within Integration Broker.
      • customerPartNumber (['string', 'null'])Customer's part number for the product.
      • defaultLocation (['string', 'null'])Default warehouse location for the product.
      • documentFilePaths (array)Static document file paths associated with the product; empty array when none.

        • Items (string)
      • itemAvgLeadTime (['integer', 'null'])Average lead time for the item.

      • language (['string', 'null'])Language associated with the product.
      • lastCost (['number', 'null'], format: decimal)Last cost of the product.
      • lastUpdateDateTimeUtc (['string', 'null'])Date and time product metadata was last updated in the product management system. Always null today; reserved for NEX-1411 to populate with an honest metadata-update timestamp.
      • organizationOwned (['boolean', 'null'])Raw ownership flag from the fulfillment system; true when OTP-owned, null when unconfirmed.
      • productDescription (['string', 'null'])Description for component product within product management system (system where ordered line item products will be managed).
      • productNumber (string, required)Name for component product within product management system (system where ordered line item products will be managed).
      • productOwner (['string', 'null'])Derived owner of component product: 'OTP', 'Customer', or null when unconfirmed.
      • productType (string, required)Type of the product.
      • status (['string', 'null'])Current status of the product. Null on the GetAllProducts feed, which does not carry item status.
      • unitOfMeasure (['string', 'null'])Unit of measure for the product.
      • weight (['number', 'null'], format: decimal)Maximum weight of the product in pounds.
  • failureMessages (array)

    • Items (string)
  • informationalMessages (array)

    • Items (string)
  • operationWasSuccessful (boolean)

Quicktype Command

quicktype \
    --framework SystemTextJson  \
    --lang cs  \
    --number-type double  \
    --src-lang schema  \
    --no-check-required  \
    --density dense  \
    --features complete  \
    --namespace OtpSchema.Api.ProductBroker.GetAllProductsResponse  \
    --src .working/build/internal/json-schema-for-cs/GetAllProductsResponse.json -o .working/build/internal/csharp/OtpSchema/Api/ProductBroker/GetAllProductsResponse.cs
GetAllProductsResponse
// <auto-generated />
//
// To parse this JSON data, add NuGet 'System.Text.Json' then do:
//
//    using OtpSchema.Api.ProductBroker.GetAllProductsResponse;
//
//    var getAllProductsResponse = GetAllProductsResponse.FromJson(jsonString);
#nullable enable
#pragma warning disable CS8618
#pragma warning disable CS8601
#pragma warning disable CS8603

namespace OtpSchema.Api.ProductBroker.GetAllProductsResponse
{
    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 GetAllProductsResponse
    {
        [J("data")]                   public Datum[]? 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 Datum
    {
        [J("billingEntityId")]                                                                public string BillingEntityId { get; set; }       // Billing entity ID associated with the product
        [J("customerPartNumber")]                                                             public string CustomerPartNumber { get; set; }    // Customer's part number for the product
        [J("defaultLocation")]                                                                public string DefaultLocation { get; set; }       // Default warehouse location for the product
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)][J("documentFilePaths")] public string[]? DocumentFilePaths { get; set; }   // Static document file paths associated with the product; empty array when none
        [J("itemAvgLeadTime")]                                                                public long? ItemAvgLeadTime { get; set; }        // Average lead time for the item
        [J("language")]                                                                       public string Language { get; set; }              // Language associated with the product
        [J("lastCost")]                                                                       public double? LastCost { get; set; }             // Last cost of the product
        [J("lastUpdateDateTimeUtc")]                                                          public string LastUpdateDateTimeUtc { get; set; } // Date and time product metadata was last updated in the product management system. Always; null today; reserved for NEX-1411 to populate with an honest metadata-update timestamp
        [J("organizationOwned")]                                                              public bool? OrganizationOwned { get; set; }      // Raw ownership flag from the fulfillment system; true when OTP-owned, null when unconfirmed
        [J("productDescription")]                                                             public string ProductDescription { get; set; }    // Description for component product within product management system (system where ordered; line item products will be managed)
        [J("productId")]                                                                      public string ProductId { get; set; }             // Unique ID for component product within Integration Broker
        [J("productNumber")]                                                                  public string ProductNumber { get; set; }         // Name for component product within product management system (system where ordered line; item products will be managed)
        [J("productOwner")]                                                                   public string ProductOwner { get; set; }          // Derived owner of component product: 'OTP', 'Customer', or null when unconfirmed
        [J("productType")]                                                                    public string ProductType { get; set; }           // Type of the product
        [J("status")]                                                                         public string Status { get; set; }                // Current status of the product. Null on the GetAllProducts feed, which does not carry item; status
        [J("unitOfMeasure")]                                                                  public string UnitOfMeasure { get; set; }         // Unit of measure for the product
        [J("weight")]                                                                         public double? Weight { get; set; }               // Maximum weight of the product in pounds
    }

    public partial class GetAllProductsResponse
    {
        public static GetAllProductsResponse FromJson(string json) => JsonSerializer.Deserialize<GetAllProductsResponse>(json, OtpSchema.Api.ProductBroker.GetAllProductsResponse.Converter.Settings);
    }

    public static class Serialize
    {
        public static string ToJson(this GetAllProductsResponse self) => JsonSerializer.Serialize(self, OtpSchema.Api.ProductBroker.GetAllProductsResponse.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

GetAllProductsResponse
{
  "$schema": "http://json-schema.org/draft-07/schema#", 
  "$id": "GetAllProductsResponse.json", 
  "type": "object", 
  "additionalProperties": false, 
  "properties": {
    "data": {
      "type": ["array", "null"], 
      "items": {
        "type": "object", 
        "additionalProperties": false, 
        "properties": {
          "billingEntityId": {
            "description": "Billing entity ID associated with the product", 
            "type": ["string", "null"]
          }, 
          "productId": {
            "description": "Unique ID for component product within Integration Broker", 
            "type": "string"
          }, 
          "customerPartNumber": {
            "description": "Customer's part number for the product", 
            "type": ["string", "null"]
          }, 
          "defaultLocation": {
            "description": "Default warehouse location for the product", 
            "type": ["string", "null"]
          }, 
          "documentFilePaths": {
            "description": "Static document file paths associated with the product; empty array when none", 
            "type": "array", 
            "items": {"type": "string"}
          }, 
          "itemAvgLeadTime": { "description": "Average lead time for the item", "type": ["integer", "null"] }, 
          "language": {
            "description": "Language associated with the product", 
            "type": ["string", "null"]
          }, 
          "lastCost": {
            "description": "Last cost of the product", 
            "type": ["number", "null"], 
            "format": "decimal"
          }, 
          "lastUpdateDateTimeUtc": {
            "description": "Date and time product metadata was last updated in the product management system. Always null today; reserved for NEX-1411 to populate with an honest metadata-update timestamp", 
            "type": ["string", "null"]
          }, 
          "organizationOwned": {
            "description": "Raw ownership flag from the fulfillment system; true when OTP-owned, null when unconfirmed", 
            "type": ["boolean", "null"]
          }, 
          "productDescription": {
            "description": "Description for component product within product management system (system where ordered line item products will be managed)", 
            "type": ["string", "null"]
          }, 
          "productNumber": {
            "description": "Name for component product within product management system (system where ordered line item products will be managed)", 
            "type": "string"
          }, 
          "productOwner": {
            "description": "Derived owner of component product: 'OTP', 'Customer', or null when unconfirmed", 
            "type": ["string", "null"]
          }, 
          "productType": {"description": "Type of the product", "type": "string"}, 
          "status": {
            "description": "Current status of the product. Null on the GetAllProducts feed, which does not carry item status", 
            "type": ["string", "null"]
          }, 
          "unitOfMeasure": { "description": "Unit of measure for the product", "type": ["string", "null"] }, 
          "weight": {
            "description": "Maximum weight of the product in pounds", 
            "type": ["number", "null"], 
            "format": "decimal"
          }
        }, 
        "required": ["productId", "productNumber", "productType"]
      }
    }, 
    "failureMessages": { "type": "array", "items": {"type": "string"} }, 
    "informationalMessages": { "type": "array", "items": {"type": "string"} }, 
    "operationWasSuccessful": {"type": "boolean"}
  }, 
  "required": ["failureMessages", "informationalMessages", "operationWasSuccessful", "data"]
}