From e4146a5f2ec7a11327760858ccc839c02e48f2ce Mon Sep 17 00:00:00 2001 From: Joshua Flanagan Date: Wed, 9 Oct 2024 17:44:17 -0500 Subject: [PATCH] Updated for latest spec Allow arbitrary values in advanced_options. Fix properties that were incorrectly marked as required. --- .openapi-generator/FILES | 3 + ShipEngineSDK.Test/SerializationTests.cs | 43 +- ShipEngineSDK/Model/Address.cs | 76 +- .../Model/AdvancedShipmentOptions.cs | 7 + .../Model/CalculateRatesRequestBody.cs | 26 +- ShipEngineSDK/Model/CreateLabelRequestBody.cs | 361 +--- ShipEngineSDK/Model/LabelRequest.cs | 153 ++ ShipEngineSDK/Model/RateShipmentRequest.cs | 61 + ShipEngineSDK/Model/ShipmentRequest.cs | 188 ++- ShipEngineSDK/Model/ShippingAddress.cs | 78 +- ShipEngineSDK/Model/ShippingAddressFrom.cs | 190 +++ ShipEngineSDK/Model/ShippingAddressTo.cs | 80 +- generation/swagger.json | 1450 ++++++++++------- 13 files changed, 1628 insertions(+), 1088 deletions(-) create mode 100644 ShipEngineSDK/Model/LabelRequest.cs create mode 100644 ShipEngineSDK/Model/RateShipmentRequest.cs create mode 100644 ShipEngineSDK/Model/ShippingAddressFrom.cs diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 4a283927..baf157d5 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -185,6 +185,7 @@ ShipEngineSDK/Model/LabelLayout.cs ShipEngineSDK/Model/LabelMessages.cs ShipEngineSDK/Model/LabelPackage.cs ShipEngineSDK/Model/LabelPackagesInner.cs +ShipEngineSDK/Model/LabelRequest.cs ShipEngineSDK/Model/LabelStatus.cs ShipEngineSDK/Model/Link.cs ShipEngineSDK/Model/ListAccountImagesResponseBody.cs @@ -259,6 +260,7 @@ ShipEngineSDK/Model/RateRequestOptions.cs ShipEngineSDK/Model/RateRequestRateOptions.cs ShipEngineSDK/Model/RateResponse.cs ShipEngineSDK/Model/RateResponseStatus.cs +ShipEngineSDK/Model/RateShipmentRequest.cs ShipEngineSDK/Model/RateType.cs ShipEngineSDK/Model/RatesInformation.cs ShipEngineSDK/Model/ReasonCode.cs @@ -277,6 +279,7 @@ ShipEngineSDK/Model/ShipmentRequest.cs ShipEngineSDK/Model/ShipmentStatus.cs ShipEngineSDK/Model/ShipmentsSortBy.cs ShipEngineSDK/Model/ShippingAddress.cs +ShipEngineSDK/Model/ShippingAddressFrom.cs ShipEngineSDK/Model/ShippingAddressTo.cs ShipEngineSDK/Model/SmartPostHub.cs ShipEngineSDK/Model/SortDir.cs diff --git a/ShipEngineSDK.Test/SerializationTests.cs b/ShipEngineSDK.Test/SerializationTests.cs index b4200f3c..519b652c 100644 --- a/ShipEngineSDK.Test/SerializationTests.cs +++ b/ShipEngineSDK.Test/SerializationTests.cs @@ -144,7 +144,7 @@ public void WhenSerializing_ItShouldSerializeShipmentId() [Fact] public void WhenSerializing_ItShouldSerializeShipment() { - var body = new CalculateRatesRequestBody(new ShipmentRequest + var body = new CalculateRatesRequestBody(new RateShipmentRequest { Shipment = new AddressValidatingShipment { @@ -183,37 +183,14 @@ public void WhenSerializing_ItShouldSerializeShipment() var result = JsonSerializer.Serialize(body, ShipEngineClient.JsonSerializerOptions); - Assert.Equal(@"{ - ""rate_options"": { - ""carrier_ids"": [ - ""se-99999"" - ] - }, - ""shipment"": { - ""carrier_id"": ""se-88888"", - ""service_code"": ""overnight"", - ""ship_from"": { - ""address_line1"": ""123 Main St."", - ""address_residential_indicator"": ""no"", - ""city_locality"": ""St. Louis"", - ""country_code"": ""US"", - ""name"": ""John Doe"", - ""phone"": ""314-555-1234"", - ""postal_code"": ""63102"", - ""state_province"": ""MO"" - }, - ""ship_to"": { - ""address_line1"": ""456 Central"", - ""address_residential_indicator"": ""yes"", - ""city_locality"": ""St. Louis"", - ""country_code"": ""US"", - ""name"": ""Jane Doe"", - ""phone"": ""314-555-5678"", - ""postal_code"": ""63033"", - ""state_province"": ""MO"" - } - } -}", result); + // spot check some properties on the serialized value. + // comparing the serialized value to a string is too brittle, as order and indentation can change + var parsed = JsonDocument.Parse(result).RootElement; + var shipment = parsed.GetProperty("shipment"); + Assert.Equal("se-88888", shipment.GetProperty("carrier_id").GetString()); + Assert.Equal("overnight", shipment.GetProperty("service_code").GetString()); + Assert.Equal("123 Main St.", shipment.GetProperty("ship_from").GetProperty("address_line1").GetString()); + Assert.Equal("456 Central", shipment.GetProperty("ship_to").GetProperty("address_line1").GetString()); } [Fact] @@ -250,7 +227,7 @@ public void WhenDeserializing_ItShouldDeserializeShipment() var result = JsonSerializer.Deserialize(json, ShipEngineClient.JsonSerializerOptions); - Assert.NotNull(result.GetShipmentRequest()); + Assert.NotNull(result.GetRateShipmentRequest()); Assert.Contains("se-99999", result.RateOptions.CarrierIds); } } diff --git a/ShipEngineSDK/Model/Address.cs b/ShipEngineSDK/Model/Address.cs index 94615494..aae5a6a3 100644 --- a/ShipEngineSDK/Model/Address.cs +++ b/ShipEngineSDK/Model/Address.cs @@ -36,13 +36,6 @@ public partial class Address [JsonPropertyName("address_line1"), JsonPropertyOrder(1)] public required string AddressLine1 { get; set; } - /// - /// Indicates whether this is a residential address. - /// - /// Indicates whether this is a residential address. - [JsonPropertyName("address_residential_indicator"), JsonPropertyOrder(2)] - public required AddressResidentialIndicator AddressResidentialIndicator { get; set; } - /// /// The name of the city or locality /// @@ -50,19 +43,9 @@ public partial class Address /// /// Winnipeg /// - [JsonPropertyName("city_locality"), JsonPropertyOrder(3)] + [JsonPropertyName("city_locality"), JsonPropertyOrder(2)] public required string CityLocality { get; set; } - /// - /// The two-letter [ISO 3166-1 country code](https://en.wikipedia.org/wiki/ISO_3166-1) - /// - /// The two-letter [ISO 3166-1 country code](https://en.wikipedia.org/wiki/ISO_3166-1) - /// - /// CA - /// - [JsonPropertyName("country_code"), JsonPropertyOrder(4)] - public required string CountryCode { get; set; } - /// /// The name of a contact person at this address. This field may be set instead of - or in addition to - the `company_name` field. /// @@ -70,19 +53,9 @@ public partial class Address /// /// John Doe /// - [JsonPropertyName("name"), JsonPropertyOrder(5)] + [JsonPropertyName("name"), JsonPropertyOrder(3)] public required string Name { get; set; } - /// - /// The phone number of a contact person at this address. The format of this phone number varies depending on the country. - /// - /// The phone number of a contact person at this address. The format of this phone number varies depending on the country. - /// - /// +1 204-253-9411 ext. 123 - /// - [JsonPropertyName("phone"), JsonPropertyOrder(6)] - public required string Phone { get; set; } - /// /// postal code /// @@ -90,7 +63,7 @@ public partial class Address /// /// 78756-3717 /// - [JsonPropertyName("postal_code"), JsonPropertyOrder(7)] + [JsonPropertyName("postal_code"), JsonPropertyOrder(4)] public required string PostalCode { get; set; } /// @@ -100,7 +73,7 @@ public partial class Address /// /// Manitoba /// - [JsonPropertyName("state_province"), JsonPropertyOrder(8)] + [JsonPropertyName("state_province"), JsonPropertyOrder(5)] public required string StateProvince { get; set; } /// @@ -110,7 +83,7 @@ public partial class Address /// /// Unit 408 /// - [JsonPropertyName("address_line2"), JsonPropertyOrder(9)] + [JsonPropertyName("address_line2"), JsonPropertyOrder(6)] public string? AddressLine2 { get; set; } /// @@ -120,9 +93,16 @@ public partial class Address /// /// Building #7 /// - [JsonPropertyName("address_line3"), JsonPropertyOrder(10)] + [JsonPropertyName("address_line3"), JsonPropertyOrder(7)] public string? AddressLine3 { get; set; } + /// + /// Indicates whether this is a residential address. + /// + /// Indicates whether this is a residential address. + [JsonPropertyName("address_residential_indicator"), JsonPropertyOrder(8)] + public AddressResidentialIndicator? AddressResidentialIndicator { get; set; } + /// /// If this is a business address, then the company name should be specified here. /// @@ -130,9 +110,19 @@ public partial class Address /// /// The Home Depot /// - [JsonPropertyName("company_name"), JsonPropertyOrder(11)] + [JsonPropertyName("company_name"), JsonPropertyOrder(9)] public string? CompanyName { get; set; } + /// + /// The two-letter [ISO 3166-1 country code](https://en.wikipedia.org/wiki/ISO_3166-1) + /// + /// The two-letter [ISO 3166-1 country code](https://en.wikipedia.org/wiki/ISO_3166-1) + /// + /// CA + /// + [JsonPropertyName("country_code"), JsonPropertyOrder(10)] + public string? CountryCode { get; set; } + /// /// Email for the address owner. /// @@ -140,9 +130,19 @@ public partial class Address /// /// example@example.com /// - [JsonPropertyName("email"), JsonPropertyOrder(12)] + [JsonPropertyName("email"), JsonPropertyOrder(11)] public string? Email { get; set; } + /// + /// The phone number of a contact person at this address. The format of this phone number varies depending on the country. + /// + /// The phone number of a contact person at this address. The format of this phone number varies depending on the country. + /// + /// +1 204-253-9411 ext. 123 + /// + [JsonPropertyName("phone"), JsonPropertyOrder(12)] + public string? Phone { get; set; } + /// /// Returns the string presentation of the object @@ -154,17 +154,17 @@ public override string ToString() sb.Append("class Address {\n"); #pragma warning disable CS0612 // Type or member is obsolete sb.Append(" AddressLine1: ").Append(AddressLine1).Append("\n"); - sb.Append(" AddressResidentialIndicator: ").Append(AddressResidentialIndicator).Append("\n"); sb.Append(" CityLocality: ").Append(CityLocality).Append("\n"); - sb.Append(" CountryCode: ").Append(CountryCode).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append(" Phone: ").Append(Phone).Append("\n"); sb.Append(" PostalCode: ").Append(PostalCode).Append("\n"); sb.Append(" StateProvince: ").Append(StateProvince).Append("\n"); sb.Append(" AddressLine2: ").Append(AddressLine2).Append("\n"); sb.Append(" AddressLine3: ").Append(AddressLine3).Append("\n"); + sb.Append(" AddressResidentialIndicator: ").Append(AddressResidentialIndicator).Append("\n"); sb.Append(" CompanyName: ").Append(CompanyName).Append("\n"); + sb.Append(" CountryCode: ").Append(CountryCode).Append("\n"); sb.Append(" Email: ").Append(Email).Append("\n"); + sb.Append(" Phone: ").Append(Phone).Append("\n"); #pragma warning restore CS0612 // Type or member is obsolete sb.Append("}\n"); return sb.ToString(); diff --git a/ShipEngineSDK/Model/AdvancedShipmentOptions.cs b/ShipEngineSDK/Model/AdvancedShipmentOptions.cs index 2ceff18b..387528a5 100644 --- a/ShipEngineSDK/Model/AdvancedShipmentOptions.cs +++ b/ShipEngineSDK/Model/AdvancedShipmentOptions.cs @@ -224,6 +224,12 @@ public partial class AdvancedShipmentOptions [JsonPropertyName("windsor_framework_details"), JsonPropertyOrder(27)] public AdvancedShipmentOptionsWindsorFrameworkDetails? WindsorFrameworkDetails { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } = new Dictionary(); + /// /// Returns the string presentation of the object @@ -261,6 +267,7 @@ public override string ToString() sb.Append(" ThirdPartyConsignee: ").Append(ThirdPartyConsignee).Append("\n"); sb.Append(" UseUpsGroundFreightPricing: ").Append(UseUpsGroundFreightPricing).Append("\n"); sb.Append(" WindsorFrameworkDetails: ").Append(WindsorFrameworkDetails).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); #pragma warning restore CS0612 // Type or member is obsolete sb.Append("}\n"); return sb.ToString(); diff --git a/ShipEngineSDK/Model/CalculateRatesRequestBody.cs b/ShipEngineSDK/Model/CalculateRatesRequestBody.cs index 0d070b76..87c19cdb 100644 --- a/ShipEngineSDK/Model/CalculateRatesRequestBody.cs +++ b/ShipEngineSDK/Model/CalculateRatesRequestBody.cs @@ -50,10 +50,10 @@ public CalculateRatesRequestBody(ShipmentIdRequest actualInstance) : base("oneOf /// /// Initializes a new instance of the class - /// with the class + /// with the class /// - /// An instance of ShipmentRequest. - public CalculateRatesRequestBody(ShipmentRequest actualInstance) : base("oneOf") + /// An instance of RateShipmentRequest. + public CalculateRatesRequestBody(RateShipmentRequest actualInstance) : base("oneOf") { this.IsNullable = false; _actualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); @@ -77,13 +77,13 @@ public override Object ActualInstance { this._actualInstance = value; } - else if (value.GetType() == typeof(ShipmentRequest)) + else if (value.GetType() == typeof(RateShipmentRequest)) { this._actualInstance = value; } else { - throw new ArgumentException("Invalid instance found. Must be the following types: ShipmentIdRequest, ShipmentRequest"); + throw new ArgumentException("Invalid instance found. Must be the following types: ShipmentIdRequest, RateShipmentRequest"); } } } @@ -99,13 +99,13 @@ public ShipmentIdRequest GetShipmentIdRequest() } /// - /// Get the actual instance of `ShipmentRequest`. If the actual instance is not `ShipmentRequest`, + /// Get the actual instance of `RateShipmentRequest`. If the actual instance is not `RateShipmentRequest`, /// the InvalidClassException will be thrown /// - /// An instance of ShipmentRequest - public ShipmentRequest GetShipmentRequest() + /// An instance of RateShipmentRequest + public RateShipmentRequest GetRateShipmentRequest() { - return (ShipmentRequest)this.ActualInstance; + return (RateShipmentRequest)this.ActualInstance; } /// @@ -138,7 +138,7 @@ public override string ToJson() /// public class CalculateRatesRequestBodyJsonConverter : JsonConverter { - private static readonly HashSet OneOfTypes = [typeof(ShipmentIdRequest), typeof(ShipmentRequest)]; + private static readonly HashSet OneOfTypes = [typeof(ShipmentIdRequest), typeof(RateShipmentRequest)]; private static readonly HashSet MandatoryFields = ["Shipment", "ShipmentId"]; private static readonly JsonSerializerOptions DeserializingOptions = new(AbstractOpenAPISchema.SerializerSettings) { @@ -236,18 +236,18 @@ public override void Write(Utf8JsonWriter writer, CalculateRatesRequestBody valu try { - newCalculateRatesRequestBody = new CalculateRatesRequestBody(jsonDoc.Deserialize(DeserializingOptions)!) + newCalculateRatesRequestBody = new CalculateRatesRequestBody(jsonDoc.Deserialize(DeserializingOptions)!) { RateOptions = rateOptions, }; - matchedTypes.Add("ShipmentRequest"); + matchedTypes.Add("RateShipmentRequest"); match++; } catch (Exception exception) { // deserialization failed, try the next one - System.Diagnostics.Debug.WriteLine("Failed to deserialize `{0}` into ShipmentRequest: {1}", jsonDoc, exception); + System.Diagnostics.Debug.WriteLine("Failed to deserialize `{0}` into RateShipmentRequest: {1}", jsonDoc, exception); } if (match == 0) diff --git a/ShipEngineSDK/Model/CreateLabelRequestBody.cs b/ShipEngineSDK/Model/CreateLabelRequestBody.cs index e9309ee1..759dccb0 100644 --- a/ShipEngineSDK/Model/CreateLabelRequestBody.cs +++ b/ShipEngineSDK/Model/CreateLabelRequestBody.cs @@ -30,167 +30,43 @@ public partial class CreateLabelRequestBody /// The shipment information used to generate the label /// /// The shipment information used to generate the label - [JsonPropertyName("shipment"), JsonPropertyOrder(1), JsonWriteOnly] - public required Shipment Shipment { get; set; } - - /// - /// Additional information some carriers may provide by which to identify a given label in their system. - /// - /// Additional information some carriers may provide by which to identify a given label in their system. - /// - /// This should not be used for input as it will be ignored on serialization. - /// - [JsonPropertyName("alternative_identifiers"), JsonInclude] - public List? AlternativeIdentifiers { get; set; } - - /// - /// If this label was created as part of a [batch](https://www.shipengine.com/docs/labels/bulk/), then this is the unique ID of that batch. - /// - /// If this label was created as part of a [batch](https://www.shipengine.com/docs/labels/bulk/), then this is the unique ID of that batch. - /// - /// This should not be used for input as it will be ignored on serialization. - /// - /// - /// se-28529731 - /// - [JsonPropertyName("batch_id"), JsonInclude] - public string? BatchId { get; set; } - - /// - /// The [shipping carrier](https://www.shipengine.com/docs/carriers/setup/) who will ship the package, such as `fedex`, `dhl_express`, `stamps_com`, etc. - /// - /// The [shipping carrier](https://www.shipengine.com/docs/carriers/setup/) who will ship the package, such as `fedex`, `dhl_express`, `stamps_com`, etc. - /// - /// This should not be used for input as it will be ignored on serialization. - /// - /// - /// dhl_express - /// - [JsonPropertyName("carrier_code"), JsonInclude] - public string? CarrierCode { get; set; } - - /// - /// The unique ID of the [carrier account](https://www.shipengine.com/docs/carriers/setup/) that was used to create this label - /// - /// The unique ID of the [carrier account](https://www.shipengine.com/docs/carriers/setup/) that was used to create this label - /// - /// This should not be used for input as it will be ignored on serialization. - /// - /// - /// se-28529731 - /// - [JsonPropertyName("carrier_id"), JsonInclude] - public string? CarrierId { get; set; } + [JsonPropertyName("shipment"), JsonPropertyOrder(1)] + public required ShipmentRequest Shipment { get; set; } /// /// The label charge event. /// /// The label charge event. - [JsonPropertyName("charge_event"), JsonPropertyOrder(6)] + [JsonPropertyName("charge_event"), JsonPropertyOrder(2)] public LabelChargeEvent? ChargeEvent { get; set; } - /// - /// The date and time that the label was created in ShipEngine. - /// - /// The date and time that the label was created in ShipEngine. - /// - /// This should not be used for input as it will be ignored on serialization. - /// - /// - /// 2018-09-23T15:00Z - /// - [JsonPropertyName("created_at"), JsonInclude] - public DateTimeOffset? CreatedAt { get; set; } - /// /// The display format that the label should be shown in. /// /// The display format that the label should be shown in. - [JsonPropertyName("display_scheme"), JsonPropertyOrder(8)] + [JsonPropertyName("display_scheme"), JsonPropertyOrder(3)] public DisplayScheme? DisplayScheme { get; set; } - /// - /// The link to download the customs form (a.k.a. commercial invoice) for this shipment, if any. Forms are in PDF format. This field is null if the shipment does not require a customs form, or if the carrier does not support it. - /// - /// The link to download the customs form (a.k.a. commercial invoice) for this shipment, if any. Forms are in PDF format. This field is null if the shipment does not require a customs form, or if the carrier does not support it. - /// - /// This should not be used for input as it will be ignored on serialization. - /// - [JsonPropertyName("form_download"), JsonInclude] - public Link? FormDownload { get; set; } - - /// - /// The link to submit an insurance claim for the shipment. This field is null if the shipment is not insured or if the insurance provider does not support online claim submission. - /// - /// The link to submit an insurance claim for the shipment. This field is null if the shipment is not insured or if the insurance provider does not support online claim submission. - /// - /// This should not be used for input as it will be ignored on serialization. - /// - [JsonPropertyName("insurance_claim"), JsonInclude] - public Link? InsuranceClaim { get; set; } - - /// - /// The insurance cost for this package. Add this to the `shipment_cost` field to get the total cost. - /// - /// The insurance cost for this package. Add this to the `shipment_cost` field to get the total cost. - /// - /// This should not be used for input as it will be ignored on serialization. - /// - [JsonPropertyName("insurance_cost"), JsonInclude] - public MonetaryValue? InsuranceCost { get; set; } - - /// - /// Indicates whether this is an international shipment. That is, the originating country and destination country are different. - /// - /// Indicates whether this is an international shipment. That is, the originating country and destination country are different. - /// - /// This should not be used for input as it will be ignored on serialization. - /// - [JsonPropertyName("is_international"), JsonInclude] - public bool? IsInternational { get; set; } - /// /// Indicates whether this is a return label. You may also want to set the `rma_number` so you know what is being returned. /// /// Indicates whether this is a return label. You may also want to set the `rma_number` so you know what is being returned. - [JsonPropertyName("is_return_label"), JsonPropertyOrder(13)] + [JsonPropertyName("is_return_label"), JsonPropertyOrder(4)] public bool? IsReturnLabel { get; set; } - /// - /// Gets or Sets LabelDownload - /// - /// - /// This should not be used for input as it will be ignored on serialization. - /// - [JsonPropertyName("label_download"), JsonInclude] - public LabelDownload? LabelDownload { get; set; } - /// /// Gets or Sets LabelDownloadType /// - [JsonPropertyName("label_download_type"), JsonPropertyOrder(15), JsonWriteOnly] + [JsonPropertyName("label_download_type"), JsonPropertyOrder(5), JsonWriteOnly] public LabelDownloadType? LabelDownloadType { get; set; } /// /// The file format that you want the label to be in. We recommend `pdf` format because it is supported by all carriers, whereas some carriers do not support the `png` or `zpl` formats. /// /// The file format that you want the label to be in. We recommend `pdf` format because it is supported by all carriers, whereas some carriers do not support the `png` or `zpl` formats. - [JsonPropertyName("label_format"), JsonPropertyOrder(16)] + [JsonPropertyName("label_format"), JsonPropertyOrder(6)] public LabelFormat? LabelFormat { get; set; } - /// - /// A string that uniquely identifies the label. This ID is generated by ShipEngine when the label is created. - /// - /// A string that uniquely identifies the label. This ID is generated by ShipEngine when the label is created. - /// - /// This should not be used for input as it will be ignored on serialization. - /// - /// - /// se-28529731 - /// - [JsonPropertyName("label_id"), JsonInclude] - public string? LabelId { get; set; } - /// /// The label image resource that was used to create a custom label image. /// @@ -198,14 +74,14 @@ public partial class CreateLabelRequestBody /// /// img_DtBXupDBxREpHnwEXhTfgK /// - [JsonPropertyName("label_image_id"), JsonPropertyOrder(18)] + [JsonPropertyName("label_image_id"), JsonPropertyOrder(7)] public string? LabelImageId { get; set; } /// /// The layout (size) that you want the label to be in. The `label_format` determines which sizes are allowed. `4x6` is supported for all label formats, whereas `letter` (8.5\" x 11\") is only supported for `pdf` format. /// /// The layout (size) that you want the label to be in. The `label_format` determines which sizes are allowed. `4x6` is supported for all label formats, whereas `letter` (8.5\" x 11\") is only supported for `pdf` format. - [JsonPropertyName("label_layout"), JsonPropertyOrder(19)] + [JsonPropertyName("label_layout"), JsonPropertyOrder(8)] public LabelLayout? LabelLayout { get; set; } /// @@ -215,95 +91,16 @@ public partial class CreateLabelRequestBody /// /// se-28529731 /// - [JsonPropertyName("outbound_label_id"), JsonPropertyOrder(20), JsonWriteOnly] + [JsonPropertyName("outbound_label_id"), JsonPropertyOrder(9), JsonWriteOnly] public string? OutboundLabelId { get; set; } - /// - /// The [package type](https://www.shipengine.com/docs/reference/list-carrier-packages/), such as `thick_envelope`, `small_flat_rate_box`, `large_package`, etc. The code `package` indicates a custom or unknown package type. - /// - /// The [package type](https://www.shipengine.com/docs/reference/list-carrier-packages/), such as `thick_envelope`, `small_flat_rate_box`, `large_package`, etc. The code `package` indicates a custom or unknown package type. - /// - /// This should not be used for input as it will be ignored on serialization. - /// - /// - /// small_flat_rate_box - /// - [JsonPropertyName("package_code"), JsonInclude] - public string? PackageCode { get; set; } - - /// - /// The label's package(s). > **Note:** Some carriers only allow one package per label. If you attempt to create a multi-package label for a carrier that doesn't allow it, an error will be returned. - /// - /// The label's package(s). > **Note:** Some carriers only allow one package per label. If you attempt to create a multi-package label for a carrier that doesn't allow it, an error will be returned. - /// - /// This should not be used for input as it will be ignored on serialization. - /// - [JsonPropertyName("packages"), JsonInclude] - public List? Packages { get; set; } - - /// - /// The paperless details which may contain elements like `href`, `instructions` and `handoff_code`. - /// - /// The paperless details which may contain elements like `href`, `instructions` and `handoff_code`. - /// - /// This should not be used for input as it will be ignored on serialization. - /// - [JsonPropertyName("paperless_download"), JsonInclude] - public PaperlessDownload? PaperlessDownload { get; set; } - - /// - /// A list of rate details that are associated with shipping cost. This is useful for displaying a breakdown of the rate to the user. - /// - /// A list of rate details that are associated with shipping cost. This is useful for displaying a breakdown of the rate to the user. - /// - /// This should not be used for input as it will be ignored on serialization. - /// - [JsonPropertyName("rate_details"), JsonInclude] - public List? RateDetails { get; set; } - - /// - /// The total shipping cost for the specified comparison_rate_type. - /// - /// The total shipping cost for the specified comparison_rate_type. - /// - /// This should not be used for input as it will be ignored on serialization. - /// - [JsonPropertyName("requested_comparison_amount"), JsonInclude] - public MonetaryValue? RequestedComparisonAmount { get; set; } - /// /// An optional Return Merchandise Authorization number. This field is useful for return labels. You can set it to any string value. /// /// An optional Return Merchandise Authorization number. This field is useful for return labels. You can set it to any string value. - [JsonPropertyName("rma_number"), JsonPropertyOrder(26)] + [JsonPropertyName("rma_number"), JsonPropertyOrder(10)] public string? RmaNumber { get; set; } - /// - /// The [carrier service](https://www.shipengine.com/docs/shipping/use-a-carrier-service/) used to ship the package, such as `fedex_ground`, `usps_first_class_mail`, `flat_rate_envelope`, etc. - /// - /// The [carrier service](https://www.shipengine.com/docs/shipping/use-a-carrier-service/) used to ship the package, such as `fedex_ground`, `usps_first_class_mail`, `flat_rate_envelope`, etc. - /// - /// This should not be used for input as it will be ignored on serialization. - /// - /// - /// usps_first_class_mail - /// - [JsonPropertyName("service_code"), JsonInclude] - public string? ServiceCode { get; set; } - - /// - /// The date that the package was (or will be) shippped. ShipEngine will take the day of week into consideration. For example, if the carrier does not operate on Sundays, then a package that would have shipped on Sunday will ship on Monday instead. - /// - /// The date that the package was (or will be) shippped. ShipEngine will take the day of week into consideration. For example, if the carrier does not operate on Sundays, then a package that would have shipped on Sunday will ship on Monday instead. - /// - /// This should not be used for input as it will be ignored on serialization. - /// - /// - /// 2018-09-23T00:00Z - /// - [JsonPropertyName("ship_date"), JsonInclude] - public DateTimeOffset? ShipDate { get; set; } - /// /// A unique identifier for a carrier drop off point where a merchant plans to deliver packages. This will take precedence over a shipment's ship from address. /// @@ -311,7 +108,7 @@ public partial class CreateLabelRequestBody /// /// 614940 /// - [JsonPropertyName("ship_from_service_point_id"), JsonPropertyOrder(29)] + [JsonPropertyName("ship_from_service_point_id"), JsonPropertyOrder(11)] public string? ShipFromServicePointId { get; set; } /// @@ -321,123 +118,22 @@ public partial class CreateLabelRequestBody /// /// 614940 /// - [JsonPropertyName("ship_to_service_point_id"), JsonPropertyOrder(30)] + [JsonPropertyName("ship_to_service_point_id"), JsonPropertyOrder(12)] public string? ShipToServicePointId { get; set; } - /// - /// The cost of shipping, delivery confirmation, and other carrier charges. This amount **does not** include insurance costs. - /// - /// The cost of shipping, delivery confirmation, and other carrier charges. This amount **does not** include insurance costs. - /// - /// This should not be used for input as it will be ignored on serialization. - /// - [JsonPropertyName("shipment_cost"), JsonInclude] - public MonetaryValue? ShipmentCost { get; set; } - - /// - /// The shipment that this label is for. ShipEngine can create a shipment for you automatically when you [create a label](https://www.shipengine.com/docs/labels/create-a-label/), or you can [create your own shipment](https://www.shipengine.com/docs/shipping/create-a-shipment/) and then [use it to print a label](https://www.shipengine.com/docs/labels/create-from-shipment/) - /// - /// The shipment that this label is for. ShipEngine can create a shipment for you automatically when you [create a label](https://www.shipengine.com/docs/labels/create-a-label/), or you can [create your own shipment](https://www.shipengine.com/docs/shipping/create-a-shipment/) and then [use it to print a label](https://www.shipengine.com/docs/labels/create-from-shipment/) - /// - /// This should not be used for input as it will be ignored on serialization. - /// - /// - /// se-28529731 - /// - [JsonPropertyName("shipment_id"), JsonInclude] - public string? ShipmentId { get; set; } - - /// - /// Gets or Sets Status - /// - /// - /// This should not be used for input as it will be ignored on serialization. - /// - [JsonPropertyName("status"), JsonInclude] - public LabelStatus? Status { get; set; } - /// /// Indicate if this label is being used only for testing purposes. If true, then no charge will be added to your account. /// /// Indicate if this label is being used only for testing purposes. If true, then no charge will be added to your account. - [JsonPropertyName("test_label"), JsonPropertyOrder(34), JsonWriteOnly, Obsolete] + [JsonPropertyName("test_label"), JsonPropertyOrder(13), JsonWriteOnly, Obsolete] public bool? TestLabel { get; set; } - /// - /// Indicates whether the shipment is trackable, in which case the `tracking_status` field will reflect the current status and each package will have a `tracking_number`. - /// - /// Indicates whether the shipment is trackable, in which case the `tracking_status` field will reflect the current status and each package will have a `tracking_number`. - /// - /// This should not be used for input as it will be ignored on serialization. - /// - [JsonPropertyName("trackable"), JsonInclude] - public bool? Trackable { get; set; } - - /// - /// The tracking number for the package. Tracking number formats vary across carriers. - /// - /// The tracking number for the package. Tracking number formats vary across carriers. - /// - /// This should not be used for input as it will be ignored on serialization. - /// - /// - /// 782758401696 - /// - [JsonPropertyName("tracking_number"), JsonInclude] - public string? TrackingNumber { get; set; } - - /// - /// The current status of the package, such as `in_transit` or `delivered` - /// - /// The current status of the package, such as `in_transit` or `delivered` - /// - /// This should not be used for input as it will be ignored on serialization. - /// - [JsonPropertyName("tracking_status"), JsonInclude] - public TrackingStatus? TrackingStatus { get; set; } - - /// - /// The URL to track the package. This URL is provided by the carrier and is unique to the tracking number. - /// - /// The URL to track the package. This URL is provided by the carrier and is unique to the tracking number. - /// - /// This should not be used for input as it will be ignored on serialization. - /// - /// - /// https://www.fedex.com/fedextrack/?action=track&trackingnumber=1234 - /// - [JsonPropertyName("tracking_url"), JsonInclude] - public string? TrackingUrl { get; set; } - /// /// Gets or Sets ValidateAddress /// - [JsonPropertyName("validate_address"), JsonPropertyOrder(39), JsonWriteOnly] + [JsonPropertyName("validate_address"), JsonPropertyOrder(14), JsonWriteOnly] public ValidateAddress? ValidateAddress { get; set; } - /// - /// Indicates whether the label has been [voided](https://www.shipengine.com/docs/labels/voiding/) - /// - /// Indicates whether the label has been [voided](https://www.shipengine.com/docs/labels/voiding/) - /// - /// This should not be used for input as it will be ignored on serialization. - /// - [JsonPropertyName("voided"), JsonInclude] - public bool? Voided { get; set; } - - /// - /// The date and time that the label was [voided](https://www.shipengine.com/docs/labels/voiding/), or `null` if the label has not been voided - /// - /// The date and time that the label was [voided](https://www.shipengine.com/docs/labels/voiding/), or `null` if the label has not been voided - /// - /// This should not be used for input as it will be ignored on serialization. - /// - /// - /// 2018-09-23T15:00Z - /// - [JsonPropertyName("voided_at"), JsonInclude] - public DateTimeOffset? VoidedAt { get; set; } - /// /// Returns the string presentation of the object @@ -449,46 +145,19 @@ public override string ToString() sb.Append("class CreateLabelRequestBody {\n"); #pragma warning disable CS0612 // Type or member is obsolete sb.Append(" Shipment: ").Append(Shipment).Append("\n"); - sb.Append(" AlternativeIdentifiers: ").Append(AlternativeIdentifiers).Append("\n"); - sb.Append(" BatchId: ").Append(BatchId).Append("\n"); - sb.Append(" CarrierCode: ").Append(CarrierCode).Append("\n"); - sb.Append(" CarrierId: ").Append(CarrierId).Append("\n"); sb.Append(" ChargeEvent: ").Append(ChargeEvent).Append("\n"); - sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n"); sb.Append(" DisplayScheme: ").Append(DisplayScheme).Append("\n"); - sb.Append(" FormDownload: ").Append(FormDownload).Append("\n"); - sb.Append(" InsuranceClaim: ").Append(InsuranceClaim).Append("\n"); - sb.Append(" InsuranceCost: ").Append(InsuranceCost).Append("\n"); - sb.Append(" IsInternational: ").Append(IsInternational).Append("\n"); sb.Append(" IsReturnLabel: ").Append(IsReturnLabel).Append("\n"); - sb.Append(" LabelDownload: ").Append(LabelDownload).Append("\n"); sb.Append(" LabelDownloadType: ").Append(LabelDownloadType).Append("\n"); sb.Append(" LabelFormat: ").Append(LabelFormat).Append("\n"); - sb.Append(" LabelId: ").Append(LabelId).Append("\n"); sb.Append(" LabelImageId: ").Append(LabelImageId).Append("\n"); sb.Append(" LabelLayout: ").Append(LabelLayout).Append("\n"); sb.Append(" OutboundLabelId: ").Append(OutboundLabelId).Append("\n"); - sb.Append(" PackageCode: ").Append(PackageCode).Append("\n"); - sb.Append(" Packages: ").Append(Packages).Append("\n"); - sb.Append(" PaperlessDownload: ").Append(PaperlessDownload).Append("\n"); - sb.Append(" RateDetails: ").Append(RateDetails).Append("\n"); - sb.Append(" RequestedComparisonAmount: ").Append(RequestedComparisonAmount).Append("\n"); sb.Append(" RmaNumber: ").Append(RmaNumber).Append("\n"); - sb.Append(" ServiceCode: ").Append(ServiceCode).Append("\n"); - sb.Append(" ShipDate: ").Append(ShipDate).Append("\n"); sb.Append(" ShipFromServicePointId: ").Append(ShipFromServicePointId).Append("\n"); sb.Append(" ShipToServicePointId: ").Append(ShipToServicePointId).Append("\n"); - sb.Append(" ShipmentCost: ").Append(ShipmentCost).Append("\n"); - sb.Append(" ShipmentId: ").Append(ShipmentId).Append("\n"); - sb.Append(" Status: ").Append(Status).Append("\n"); sb.Append(" TestLabel: ").Append(TestLabel).Append("\n"); - sb.Append(" Trackable: ").Append(Trackable).Append("\n"); - sb.Append(" TrackingNumber: ").Append(TrackingNumber).Append("\n"); - sb.Append(" TrackingStatus: ").Append(TrackingStatus).Append("\n"); - sb.Append(" TrackingUrl: ").Append(TrackingUrl).Append("\n"); sb.Append(" ValidateAddress: ").Append(ValidateAddress).Append("\n"); - sb.Append(" Voided: ").Append(Voided).Append("\n"); - sb.Append(" VoidedAt: ").Append(VoidedAt).Append("\n"); #pragma warning restore CS0612 // Type or member is obsolete sb.Append("}\n"); return sb.ToString(); diff --git a/ShipEngineSDK/Model/LabelRequest.cs b/ShipEngineSDK/Model/LabelRequest.cs new file mode 100644 index 00000000..85c5eed5 --- /dev/null +++ b/ShipEngineSDK/Model/LabelRequest.cs @@ -0,0 +1,153 @@ +// +// DO NOT MODIFY THIS FILE + +// Changes can be made in a corresponding partial file, or by changing +// the template in /generation/templates and generating the class again. + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Text.Json.Serialization.Metadata; +using System.Text.RegularExpressions; + +namespace ShipEngineSDK.Model; + +/// +/// A label represents the physical sticker that you affix to a package to ship it. ShipEngine makes it easy for you to [create labels](https://www.shipengine.com/docs/labels/create-a-label/) and then download them in PDF, PNG, or ZPL format so you can print them. +/// +public partial class LabelRequest +{ + + /// + /// The label charge event. + /// + /// The label charge event. + [JsonPropertyName("charge_event"), JsonPropertyOrder(1)] + public LabelChargeEvent? ChargeEvent { get; set; } + + /// + /// The display format that the label should be shown in. + /// + /// The display format that the label should be shown in. + [JsonPropertyName("display_scheme"), JsonPropertyOrder(2)] + public DisplayScheme? DisplayScheme { get; set; } + + /// + /// Indicates whether this is a return label. You may also want to set the `rma_number` so you know what is being returned. + /// + /// Indicates whether this is a return label. You may also want to set the `rma_number` so you know what is being returned. + [JsonPropertyName("is_return_label"), JsonPropertyOrder(3)] + public bool? IsReturnLabel { get; set; } + + /// + /// Gets or Sets LabelDownloadType + /// + [JsonPropertyName("label_download_type"), JsonPropertyOrder(4), JsonWriteOnly] + public LabelDownloadType? LabelDownloadType { get; set; } + + /// + /// The file format that you want the label to be in. We recommend `pdf` format because it is supported by all carriers, whereas some carriers do not support the `png` or `zpl` formats. + /// + /// The file format that you want the label to be in. We recommend `pdf` format because it is supported by all carriers, whereas some carriers do not support the `png` or `zpl` formats. + [JsonPropertyName("label_format"), JsonPropertyOrder(5)] + public LabelFormat? LabelFormat { get; set; } + + /// + /// The label image resource that was used to create a custom label image. + /// + /// The label image resource that was used to create a custom label image. + /// + /// img_DtBXupDBxREpHnwEXhTfgK + /// + [JsonPropertyName("label_image_id"), JsonPropertyOrder(6)] + public string? LabelImageId { get; set; } + + /// + /// The layout (size) that you want the label to be in. The `label_format` determines which sizes are allowed. `4x6` is supported for all label formats, whereas `letter` (8.5\" x 11\") is only supported for `pdf` format. + /// + /// The layout (size) that you want the label to be in. The `label_format` determines which sizes are allowed. `4x6` is supported for all label formats, whereas `letter` (8.5\" x 11\") is only supported for `pdf` format. + [JsonPropertyName("label_layout"), JsonPropertyOrder(7)] + public LabelLayout? LabelLayout { get; set; } + + /// + /// The `label_id` of the original (outgoing) label that the return label is for. This associates the two labels together, which is required by some carriers. + /// + /// The `label_id` of the original (outgoing) label that the return label is for. This associates the two labels together, which is required by some carriers. + /// + /// se-28529731 + /// + [JsonPropertyName("outbound_label_id"), JsonPropertyOrder(8), JsonWriteOnly] + public string? OutboundLabelId { get; set; } + + /// + /// An optional Return Merchandise Authorization number. This field is useful for return labels. You can set it to any string value. + /// + /// An optional Return Merchandise Authorization number. This field is useful for return labels. You can set it to any string value. + [JsonPropertyName("rma_number"), JsonPropertyOrder(9)] + public string? RmaNumber { get; set; } + + /// + /// The shipment information used to generate the label + /// + /// The shipment information used to generate the label + [JsonPropertyName("shipment"), JsonPropertyOrder(10)] + public ShipmentRequest? Shipment { get; set; } + + /// + /// Indicate if this label is being used only for testing purposes. If true, then no charge will be added to your account. + /// + /// Indicate if this label is being used only for testing purposes. If true, then no charge will be added to your account. + [JsonPropertyName("test_label"), JsonPropertyOrder(11), JsonWriteOnly, Obsolete] + public bool? TestLabel { get; set; } + + /// + /// Gets or Sets ValidateAddress + /// + [JsonPropertyName("validate_address"), JsonPropertyOrder(12), JsonWriteOnly] + public ValidateAddress? ValidateAddress { get; set; } + + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class LabelRequest {\n"); +#pragma warning disable CS0612 // Type or member is obsolete + sb.Append(" ChargeEvent: ").Append(ChargeEvent).Append("\n"); + sb.Append(" DisplayScheme: ").Append(DisplayScheme).Append("\n"); + sb.Append(" IsReturnLabel: ").Append(IsReturnLabel).Append("\n"); + sb.Append(" LabelDownloadType: ").Append(LabelDownloadType).Append("\n"); + sb.Append(" LabelFormat: ").Append(LabelFormat).Append("\n"); + sb.Append(" LabelImageId: ").Append(LabelImageId).Append("\n"); + sb.Append(" LabelLayout: ").Append(LabelLayout).Append("\n"); + sb.Append(" OutboundLabelId: ").Append(OutboundLabelId).Append("\n"); + sb.Append(" RmaNumber: ").Append(RmaNumber).Append("\n"); + sb.Append(" Shipment: ").Append(Shipment).Append("\n"); + sb.Append(" TestLabel: ").Append(TestLabel).Append("\n"); + sb.Append(" ValidateAddress: ").Append(ValidateAddress).Append("\n"); +#pragma warning restore CS0612 // Type or member is obsolete + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson(JsonSerializerOptions options) + { + return JsonSerializer.Serialize(this, options); + } + +} \ No newline at end of file diff --git a/ShipEngineSDK/Model/RateShipmentRequest.cs b/ShipEngineSDK/Model/RateShipmentRequest.cs new file mode 100644 index 00000000..44a78444 --- /dev/null +++ b/ShipEngineSDK/Model/RateShipmentRequest.cs @@ -0,0 +1,61 @@ +// +// DO NOT MODIFY THIS FILE + +// Changes can be made in a corresponding partial file, or by changing +// the template in /generation/templates and generating the class again. + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Text.Json.Serialization.Metadata; +using System.Text.RegularExpressions; + +namespace ShipEngineSDK.Model; + +/// +/// RateShipmentRequest +/// +public partial class RateShipmentRequest +{ + + /// + /// The shipment object + /// + /// The shipment object + [JsonPropertyName("shipment"), JsonPropertyOrder(1)] + public AddressValidatingShipment? Shipment { get; set; } + + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class RateShipmentRequest {\n"); +#pragma warning disable CS0612 // Type or member is obsolete + sb.Append(" Shipment: ").Append(Shipment).Append("\n"); +#pragma warning restore CS0612 // Type or member is obsolete + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson(JsonSerializerOptions options) + { + return JsonSerializer.Serialize(this, options); + } + +} \ No newline at end of file diff --git a/ShipEngineSDK/Model/ShipmentRequest.cs b/ShipEngineSDK/Model/ShipmentRequest.cs index 54c0f9ed..bb387a51 100644 --- a/ShipEngineSDK/Model/ShipmentRequest.cs +++ b/ShipEngineSDK/Model/ShipmentRequest.cs @@ -21,17 +21,173 @@ namespace ShipEngineSDK.Model; /// -/// ShipmentRequest +/// The information necessary to ship a package, such as the origin, the destination, the carrier service, and the package dimensions and weight. > **Note:** Either `ship_from` or `warehouse_id` must be set. /// public partial class ShipmentRequest { /// - /// The shipment object + /// The carrier account that is billed for the shipping charges /// - /// The shipment object - [JsonPropertyName("shipment"), JsonPropertyOrder(1)] - public AddressValidatingShipment? Shipment { get; set; } + /// The carrier account that is billed for the shipping charges + /// + /// se-28529731 + /// + [JsonPropertyName("carrier_id"), JsonPropertyOrder(1)] + public required string CarrierId { get; set; } + + /// + /// The packages in the shipment. > **Note:** Some carriers only allow one package per shipment. If you attempt to create a multi-package shipment for a carrier that doesn't allow it, an error will be returned. + /// + /// The packages in the shipment. > **Note:** Some carriers only allow one package per shipment. If you attempt to create a multi-package shipment for a carrier that doesn't allow it, an error will be returned. + [JsonPropertyName("packages"), JsonPropertyOrder(2)] + public required List Packages { get; set; } + + /// + /// The [carrier service](https://www.shipengine.com/docs/shipping/use-a-carrier-service/) used to ship the package, such as `fedex_ground`, `usps_first_class_mail`, `flat_rate_envelope`, etc. + /// + /// The [carrier service](https://www.shipengine.com/docs/shipping/use-a-carrier-service/) used to ship the package, such as `fedex_ground`, `usps_first_class_mail`, `flat_rate_envelope`, etc. + /// + /// usps_first_class_mail + /// + [JsonPropertyName("service_code"), JsonPropertyOrder(3)] + public required string ServiceCode { get; set; } + + /// + /// The recipient's mailing address + /// + /// The recipient's mailing address + [JsonPropertyName("ship_to"), JsonPropertyOrder(4)] + public required ShippingAddressTo ShipTo { get; set; } + + /// + /// Advanced shipment options. These are entirely optional. + /// + /// Advanced shipment options. These are entirely optional. + [JsonPropertyName("advanced_options"), JsonPropertyOrder(5)] + public AdvancedShipmentOptions? AdvancedOptions { get; set; } + + /// + /// Calculate a rate for this shipment with the requested carrier using a ratecard that differs from the default. Only supported for UPS and USPS. + /// + /// Calculate a rate for this shipment with the requested carrier using a ratecard that differs from the default. Only supported for UPS and USPS. + /// + /// retail + /// + [JsonPropertyName("comparison_rate_type"), JsonPropertyOrder(6)] + public string? ComparisonRateType { get; set; } + + /// + /// The type of delivery confirmation that is required for this shipment. + /// + /// The type of delivery confirmation that is required for this shipment. + [JsonPropertyName("confirmation"), JsonPropertyOrder(7)] + public DeliveryConfirmation? Confirmation { get; set; } + + /// + /// Customs information. This is usually only needed for international shipments. + /// + /// Customs information. This is usually only needed for international shipments. + [JsonPropertyName("customs"), JsonPropertyOrder(8)] + public InternationalShipmentOptions? Customs { get; set; } + + /// + /// ID that the Order Source assigned + /// + /// ID that the Order Source assigned + [JsonPropertyName("external_order_id"), JsonPropertyOrder(9)] + public string? ExternalOrderId { get; set; } + + /// + /// A unique user-defined key to identify a shipment. This can be used to retrieve the shipment. > **Warning:** The `external_shipment_id` is limited to 50 characters. Any additional characters will be truncated. + /// + /// A unique user-defined key to identify a shipment. This can be used to retrieve the shipment. > **Warning:** The `external_shipment_id` is limited to 50 characters. Any additional characters will be truncated. + [JsonPropertyName("external_shipment_id"), JsonPropertyOrder(10)] + public string? ExternalShipmentId { get; set; } + + /// + /// The insurance provider to use for any insured packages in the shipment. + /// + /// The insurance provider to use for any insured packages in the shipment. + [JsonPropertyName("insurance_provider"), JsonPropertyOrder(11)] + public InsuranceProvider? InsuranceProvider { get; set; } + + /// + /// An optional indicator if the shipment is intended to be a return. Defaults to false if not provided. + /// + /// An optional indicator if the shipment is intended to be a return. Defaults to false if not provided. + [JsonPropertyName("is_return"), JsonPropertyOrder(12)] + public bool? IsReturn { get; set; } + + /// + /// Describe the packages included in this shipment as related to potential metadata that was imported from external order sources + /// + /// Describe the packages included in this shipment as related to potential metadata that was imported from external order sources + [JsonPropertyName("items"), JsonPropertyOrder(13)] + public List? Items { get; set; } + + /// + /// Gets or Sets OrderSourceCode + /// + [JsonPropertyName("order_source_code"), JsonPropertyOrder(14)] + public OrderSourceName? OrderSourceCode { get; set; } + + /// + /// The return address for this shipment. Defaults to the `ship_from` address. + /// + /// The return address for this shipment. Defaults to the `ship_from` address. + [JsonPropertyName("return_to"), JsonPropertyOrder(15)] + public ShippingAddress? ReturnTo { get; set; } + + /// + /// The date that the shipment was (or will be) shippped. ShipEngine will take the day of week into consideration. For example, if the carrier does not operate on Sundays, then a package that would have shipped on Sunday will ship on Monday instead. + /// + /// The date that the shipment was (or will be) shippped. ShipEngine will take the day of week into consideration. For example, if the carrier does not operate on Sundays, then a package that would have shipped on Sunday will ship on Monday instead. + /// + /// 2018-09-23T00:00Z + /// + [JsonPropertyName("ship_date"), JsonPropertyOrder(16)] + public DateTimeOffset? ShipDate { get; set; } + + /// + /// The shipment's origin address. If you frequently ship from the same location, consider [creating a warehouse](https://www.shipengine.com/docs/reference/create-warehouse/). Then you can simply specify the `warehouse_id` rather than the complete address each time. + /// + /// The shipment's origin address. If you frequently ship from the same location, consider [creating a warehouse](https://www.shipengine.com/docs/reference/create-warehouse/). Then you can simply specify the `warehouse_id` rather than the complete address each time. + [JsonPropertyName("ship_from"), JsonPropertyOrder(17)] + public ShippingAddressFrom? ShipFrom { get; set; } + + /// + /// A non-unique user-defined number used to identify a shipment. If undefined, this will match the external_shipment_id of the shipment. > **Warning:** The `shipment_number` is limited to 50 characters. Any additional characters will be truncated. + /// + /// A non-unique user-defined number used to identify a shipment. If undefined, this will match the external_shipment_id of the shipment. > **Warning:** The `shipment_number` is limited to 50 characters. Any additional characters will be truncated. + [JsonPropertyName("shipment_number"), JsonPropertyOrder(18)] + public string? ShipmentNumber { get; set; } + + /// + /// ID of the shipping rule, which you want to use to automate carrier/carrier service selection for the shipment + /// + /// ID of the shipping rule, which you want to use to automate carrier/carrier service selection for the shipment + /// + /// se-28529731 + /// + [JsonPropertyName("shipping_rule_id"), JsonPropertyOrder(19)] + public string? ShippingRuleId { get; set; } + + /// + /// Gets or Sets TaxIdentifiers + /// + [JsonPropertyName("tax_identifiers"), JsonPropertyOrder(20)] + public List? TaxIdentifiers { get; set; } + + /// + /// The [warehouse](https://www.shipengine.com/docs/shipping/ship-from-a-warehouse/) that the shipment is being shipped from. Either `warehouse_id` or `ship_from` must be specified. + /// + /// The [warehouse](https://www.shipengine.com/docs/shipping/ship-from-a-warehouse/) that the shipment is being shipped from. Either `warehouse_id` or `ship_from` must be specified. + /// + /// se-28529731 + /// + [JsonPropertyName("warehouse_id"), JsonPropertyOrder(21)] + public string? WarehouseId { get; set; } /// @@ -43,7 +199,27 @@ public override string ToString() var sb = new StringBuilder(); sb.Append("class ShipmentRequest {\n"); #pragma warning disable CS0612 // Type or member is obsolete - sb.Append(" Shipment: ").Append(Shipment).Append("\n"); + sb.Append(" CarrierId: ").Append(CarrierId).Append("\n"); + sb.Append(" Packages: ").Append(Packages).Append("\n"); + sb.Append(" ServiceCode: ").Append(ServiceCode).Append("\n"); + sb.Append(" ShipTo: ").Append(ShipTo).Append("\n"); + sb.Append(" AdvancedOptions: ").Append(AdvancedOptions).Append("\n"); + sb.Append(" ComparisonRateType: ").Append(ComparisonRateType).Append("\n"); + sb.Append(" Confirmation: ").Append(Confirmation).Append("\n"); + sb.Append(" Customs: ").Append(Customs).Append("\n"); + sb.Append(" ExternalOrderId: ").Append(ExternalOrderId).Append("\n"); + sb.Append(" ExternalShipmentId: ").Append(ExternalShipmentId).Append("\n"); + sb.Append(" InsuranceProvider: ").Append(InsuranceProvider).Append("\n"); + sb.Append(" IsReturn: ").Append(IsReturn).Append("\n"); + sb.Append(" Items: ").Append(Items).Append("\n"); + sb.Append(" OrderSourceCode: ").Append(OrderSourceCode).Append("\n"); + sb.Append(" ReturnTo: ").Append(ReturnTo).Append("\n"); + sb.Append(" ShipDate: ").Append(ShipDate).Append("\n"); + sb.Append(" ShipFrom: ").Append(ShipFrom).Append("\n"); + sb.Append(" ShipmentNumber: ").Append(ShipmentNumber).Append("\n"); + sb.Append(" ShippingRuleId: ").Append(ShippingRuleId).Append("\n"); + sb.Append(" TaxIdentifiers: ").Append(TaxIdentifiers).Append("\n"); + sb.Append(" WarehouseId: ").Append(WarehouseId).Append("\n"); #pragma warning restore CS0612 // Type or member is obsolete sb.Append("}\n"); return sb.ToString(); diff --git a/ShipEngineSDK/Model/ShippingAddress.cs b/ShipEngineSDK/Model/ShippingAddress.cs index 7a318328..e2d5e938 100644 --- a/ShipEngineSDK/Model/ShippingAddress.cs +++ b/ShipEngineSDK/Model/ShippingAddress.cs @@ -36,13 +36,6 @@ public partial class ShippingAddress [JsonPropertyName("address_line1"), JsonPropertyOrder(1)] public required string AddressLine1 { get; set; } - /// - /// Indicates whether this is a residential address. - /// - /// Indicates whether this is a residential address. - [JsonPropertyName("address_residential_indicator"), JsonPropertyOrder(2)] - public required AddressResidentialIndicator AddressResidentialIndicator { get; set; } - /// /// The name of the city or locality /// @@ -50,19 +43,9 @@ public partial class ShippingAddress /// /// Winnipeg /// - [JsonPropertyName("city_locality"), JsonPropertyOrder(3)] + [JsonPropertyName("city_locality"), JsonPropertyOrder(2)] public required string CityLocality { get; set; } - /// - /// The two-letter [ISO 3166-1 country code](https://en.wikipedia.org/wiki/ISO_3166-1) - /// - /// The two-letter [ISO 3166-1 country code](https://en.wikipedia.org/wiki/ISO_3166-1) - /// - /// CA - /// - [JsonPropertyName("country_code"), JsonPropertyOrder(4)] - public required string CountryCode { get; set; } - /// /// The name of a contact person at this address. This field may be set instead of - or in addition to - the `company_name` field. /// @@ -70,19 +53,9 @@ public partial class ShippingAddress /// /// John Doe /// - [JsonPropertyName("name"), JsonPropertyOrder(5)] + [JsonPropertyName("name"), JsonPropertyOrder(3)] public required string Name { get; set; } - /// - /// The phone number of a contact person at this address. The format of this phone number varies depending on the country. - /// - /// The phone number of a contact person at this address. The format of this phone number varies depending on the country. - /// - /// +1 204-253-9411 ext. 123 - /// - [JsonPropertyName("phone"), JsonPropertyOrder(6)] - public required string Phone { get; set; } - /// /// postal code /// @@ -90,7 +63,7 @@ public partial class ShippingAddress /// /// 78756-3717 /// - [JsonPropertyName("postal_code"), JsonPropertyOrder(7)] + [JsonPropertyName("postal_code"), JsonPropertyOrder(4)] public required string PostalCode { get; set; } /// @@ -100,7 +73,7 @@ public partial class ShippingAddress /// /// Manitoba /// - [JsonPropertyName("state_province"), JsonPropertyOrder(8)] + [JsonPropertyName("state_province"), JsonPropertyOrder(5)] public required string StateProvince { get; set; } /// @@ -110,7 +83,7 @@ public partial class ShippingAddress /// /// Unit 408 /// - [JsonPropertyName("address_line2"), JsonPropertyOrder(9)] + [JsonPropertyName("address_line2"), JsonPropertyOrder(6)] public string? AddressLine2 { get; set; } /// @@ -120,9 +93,16 @@ public partial class ShippingAddress /// /// Building #7 /// - [JsonPropertyName("address_line3"), JsonPropertyOrder(10)] + [JsonPropertyName("address_line3"), JsonPropertyOrder(7)] public string? AddressLine3 { get; set; } + /// + /// Indicates whether this is a residential address. + /// + /// Indicates whether this is a residential address. + [JsonPropertyName("address_residential_indicator"), JsonPropertyOrder(8)] + public AddressResidentialIndicator? AddressResidentialIndicator { get; set; } + /// /// If this is a business address, then the company name should be specified here. /// @@ -130,9 +110,19 @@ public partial class ShippingAddress /// /// The Home Depot /// - [JsonPropertyName("company_name"), JsonPropertyOrder(11)] + [JsonPropertyName("company_name"), JsonPropertyOrder(9)] public string? CompanyName { get; set; } + /// + /// The two-letter [ISO 3166-1 country code](https://en.wikipedia.org/wiki/ISO_3166-1) + /// + /// The two-letter [ISO 3166-1 country code](https://en.wikipedia.org/wiki/ISO_3166-1) + /// + /// CA + /// + [JsonPropertyName("country_code"), JsonPropertyOrder(10)] + public string? CountryCode { get; set; } + /// /// Email for the address owner. /// @@ -140,16 +130,26 @@ public partial class ShippingAddress /// /// example@example.com /// - [JsonPropertyName("email"), JsonPropertyOrder(12)] + [JsonPropertyName("email"), JsonPropertyOrder(11)] public string? Email { get; set; } /// /// Additional text about how to handle the shipment at this address. /// /// Additional text about how to handle the shipment at this address. - [JsonPropertyName("instructions"), JsonPropertyOrder(13)] + [JsonPropertyName("instructions"), JsonPropertyOrder(12)] public string? Instructions { get; set; } + /// + /// The phone number of a contact person at this address. The format of this phone number varies depending on the country. + /// + /// The phone number of a contact person at this address. The format of this phone number varies depending on the country. + /// + /// +1 204-253-9411 ext. 123 + /// + [JsonPropertyName("phone"), JsonPropertyOrder(13)] + public string? Phone { get; set; } + /// /// Returns the string presentation of the object @@ -161,18 +161,18 @@ public override string ToString() sb.Append("class ShippingAddress {\n"); #pragma warning disable CS0612 // Type or member is obsolete sb.Append(" AddressLine1: ").Append(AddressLine1).Append("\n"); - sb.Append(" AddressResidentialIndicator: ").Append(AddressResidentialIndicator).Append("\n"); sb.Append(" CityLocality: ").Append(CityLocality).Append("\n"); - sb.Append(" CountryCode: ").Append(CountryCode).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append(" Phone: ").Append(Phone).Append("\n"); sb.Append(" PostalCode: ").Append(PostalCode).Append("\n"); sb.Append(" StateProvince: ").Append(StateProvince).Append("\n"); sb.Append(" AddressLine2: ").Append(AddressLine2).Append("\n"); sb.Append(" AddressLine3: ").Append(AddressLine3).Append("\n"); + sb.Append(" AddressResidentialIndicator: ").Append(AddressResidentialIndicator).Append("\n"); sb.Append(" CompanyName: ").Append(CompanyName).Append("\n"); + sb.Append(" CountryCode: ").Append(CountryCode).Append("\n"); sb.Append(" Email: ").Append(Email).Append("\n"); sb.Append(" Instructions: ").Append(Instructions).Append("\n"); + sb.Append(" Phone: ").Append(Phone).Append("\n"); #pragma warning restore CS0612 // Type or member is obsolete sb.Append("}\n"); return sb.ToString(); diff --git a/ShipEngineSDK/Model/ShippingAddressFrom.cs b/ShipEngineSDK/Model/ShippingAddressFrom.cs new file mode 100644 index 00000000..43f5da0e --- /dev/null +++ b/ShipEngineSDK/Model/ShippingAddressFrom.cs @@ -0,0 +1,190 @@ +// +// DO NOT MODIFY THIS FILE + +// Changes can be made in a corresponding partial file, or by changing +// the template in /generation/templates and generating the class again. + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Text.Json.Serialization.Metadata; +using System.Text.RegularExpressions; + +namespace ShipEngineSDK.Model; + +/// +/// ShippingAddressFrom +/// +public partial class ShippingAddressFrom +{ + + /// + /// The first line of the street address. For some addresses, this may be the only line. Other addresses may require 2 or 3 lines. + /// + /// The first line of the street address. For some addresses, this may be the only line. Other addresses may require 2 or 3 lines. + /// + /// 1999 Bishop Grandin Blvd. + /// + [JsonPropertyName("address_line1"), JsonPropertyOrder(1)] + public required string AddressLine1 { get; set; } + + /// + /// The name of the city or locality + /// + /// The name of the city or locality + /// + /// Winnipeg + /// + [JsonPropertyName("city_locality"), JsonPropertyOrder(2)] + public required string CityLocality { get; set; } + + /// + /// The two-letter [ISO 3166-1 country code](https://en.wikipedia.org/wiki/ISO_3166-1) + /// + /// The two-letter [ISO 3166-1 country code](https://en.wikipedia.org/wiki/ISO_3166-1) + /// + /// CA + /// + [JsonPropertyName("country_code"), JsonPropertyOrder(3)] + public required string CountryCode { get; set; } + + /// + /// The name of a contact person at this address. This field may be set instead of - or in addition to - the `company_name` field. + /// + /// The name of a contact person at this address. This field may be set instead of - or in addition to - the `company_name` field. + /// + /// John Doe + /// + [JsonPropertyName("name"), JsonPropertyOrder(4)] + public required string Name { get; set; } + + /// + /// The phone number of a contact person at this address. The format of this phone number varies depending on the country. + /// + /// The phone number of a contact person at this address. The format of this phone number varies depending on the country. + /// + /// +1 204-253-9411 ext. 123 + /// + [JsonPropertyName("phone"), JsonPropertyOrder(5)] + public required string Phone { get; set; } + + /// + /// postal code + /// + /// postal code + /// + /// 78756-3717 + /// + [JsonPropertyName("postal_code"), JsonPropertyOrder(6)] + public required string PostalCode { get; set; } + + /// + /// The state or province. For some countries (including the U.S.) only abbreviations are allowed. Other countries allow the full name or abbreviation. + /// + /// The state or province. For some countries (including the U.S.) only abbreviations are allowed. Other countries allow the full name or abbreviation. + /// + /// Manitoba + /// + [JsonPropertyName("state_province"), JsonPropertyOrder(7)] + public required string StateProvince { get; set; } + + /// + /// The second line of the street address. For some addresses, this line may not be needed. + /// + /// The second line of the street address. For some addresses, this line may not be needed. + /// + /// Unit 408 + /// + [JsonPropertyName("address_line2"), JsonPropertyOrder(8)] + public string? AddressLine2 { get; set; } + + /// + /// The third line of the street address. For some addresses, this line may not be needed. + /// + /// The third line of the street address. For some addresses, this line may not be needed. + /// + /// Building #7 + /// + [JsonPropertyName("address_line3"), JsonPropertyOrder(9)] + public string? AddressLine3 { get; set; } + + /// + /// Indicates whether this is a residential address. + /// + /// Indicates whether this is a residential address. + [JsonPropertyName("address_residential_indicator"), JsonPropertyOrder(10)] + public AddressResidentialIndicator? AddressResidentialIndicator { get; set; } + + /// + /// If this is a business address, then the company name should be specified here. + /// + /// If this is a business address, then the company name should be specified here. + /// + /// The Home Depot + /// + [JsonPropertyName("company_name"), JsonPropertyOrder(11)] + public string? CompanyName { get; set; } + + /// + /// Email for the address owner. + /// + /// Email for the address owner. + /// + /// example@example.com + /// + [JsonPropertyName("email"), JsonPropertyOrder(12)] + public string? Email { get; set; } + + /// + /// Additional text about how to handle the shipment at this address. + /// + /// Additional text about how to handle the shipment at this address. + [JsonPropertyName("instructions"), JsonPropertyOrder(13)] + public string? Instructions { get; set; } + + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class ShippingAddressFrom {\n"); +#pragma warning disable CS0612 // Type or member is obsolete + sb.Append(" AddressLine1: ").Append(AddressLine1).Append("\n"); + sb.Append(" CityLocality: ").Append(CityLocality).Append("\n"); + sb.Append(" CountryCode: ").Append(CountryCode).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Phone: ").Append(Phone).Append("\n"); + sb.Append(" PostalCode: ").Append(PostalCode).Append("\n"); + sb.Append(" StateProvince: ").Append(StateProvince).Append("\n"); + sb.Append(" AddressLine2: ").Append(AddressLine2).Append("\n"); + sb.Append(" AddressLine3: ").Append(AddressLine3).Append("\n"); + sb.Append(" AddressResidentialIndicator: ").Append(AddressResidentialIndicator).Append("\n"); + sb.Append(" CompanyName: ").Append(CompanyName).Append("\n"); + sb.Append(" Email: ").Append(Email).Append("\n"); + sb.Append(" Instructions: ").Append(Instructions).Append("\n"); +#pragma warning restore CS0612 // Type or member is obsolete + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson(JsonSerializerOptions options) + { + return JsonSerializer.Serialize(this, options); + } + +} \ No newline at end of file diff --git a/ShipEngineSDK/Model/ShippingAddressTo.cs b/ShipEngineSDK/Model/ShippingAddressTo.cs index 837a413c..a5b2db68 100644 --- a/ShipEngineSDK/Model/ShippingAddressTo.cs +++ b/ShipEngineSDK/Model/ShippingAddressTo.cs @@ -36,13 +36,6 @@ public partial class ShippingAddressTo [JsonPropertyName("address_line1"), JsonPropertyOrder(1)] public required string AddressLine1 { get; set; } - /// - /// Indicates whether this is a residential address. - /// - /// Indicates whether this is a residential address. - [JsonPropertyName("address_residential_indicator"), JsonPropertyOrder(2)] - public required AddressResidentialIndicator AddressResidentialIndicator { get; set; } - /// /// The name of the city or locality /// @@ -50,19 +43,9 @@ public partial class ShippingAddressTo /// /// Winnipeg /// - [JsonPropertyName("city_locality"), JsonPropertyOrder(3)] + [JsonPropertyName("city_locality"), JsonPropertyOrder(2)] public required string CityLocality { get; set; } - /// - /// The two-letter [ISO 3166-1 country code](https://en.wikipedia.org/wiki/ISO_3166-1) - /// - /// The two-letter [ISO 3166-1 country code](https://en.wikipedia.org/wiki/ISO_3166-1) - /// - /// CA - /// - [JsonPropertyName("country_code"), JsonPropertyOrder(4)] - public required string CountryCode { get; set; } - /// /// The name of a contact person at this address. This field may be set instead of - or in addition to - the `company_name` field. /// @@ -70,19 +53,9 @@ public partial class ShippingAddressTo /// /// John Doe /// - [JsonPropertyName("name"), JsonPropertyOrder(5)] + [JsonPropertyName("name"), JsonPropertyOrder(3)] public required string Name { get; set; } - /// - /// The phone number of a contact person at this address. The format of this phone number varies depending on the country. - /// - /// The phone number of a contact person at this address. The format of this phone number varies depending on the country. - /// - /// +1 204-253-9411 ext. 123 - /// - [JsonPropertyName("phone"), JsonPropertyOrder(6)] - public required string Phone { get; set; } - /// /// postal code /// @@ -90,7 +63,7 @@ public partial class ShippingAddressTo /// /// 78756-3717 /// - [JsonPropertyName("postal_code"), JsonPropertyOrder(7)] + [JsonPropertyName("postal_code"), JsonPropertyOrder(4)] public required string PostalCode { get; set; } /// @@ -100,7 +73,7 @@ public partial class ShippingAddressTo /// /// Manitoba /// - [JsonPropertyName("state_province"), JsonPropertyOrder(8)] + [JsonPropertyName("state_province"), JsonPropertyOrder(5)] public required string StateProvince { get; set; } /// @@ -110,7 +83,7 @@ public partial class ShippingAddressTo /// /// Unit 408 /// - [JsonPropertyName("address_line2"), JsonPropertyOrder(9)] + [JsonPropertyName("address_line2"), JsonPropertyOrder(6)] public string? AddressLine2 { get; set; } /// @@ -120,9 +93,16 @@ public partial class ShippingAddressTo /// /// Building #7 /// - [JsonPropertyName("address_line3"), JsonPropertyOrder(10)] + [JsonPropertyName("address_line3"), JsonPropertyOrder(7)] public string? AddressLine3 { get; set; } + /// + /// Indicates whether this is a residential address. + /// + /// Indicates whether this is a residential address. + [JsonPropertyName("address_residential_indicator"), JsonPropertyOrder(8)] + public AddressResidentialIndicator? AddressResidentialIndicator { get; set; } + /// /// If this is a business address, then the company name should be specified here. /// @@ -130,9 +110,19 @@ public partial class ShippingAddressTo /// /// The Home Depot /// - [JsonPropertyName("company_name"), JsonPropertyOrder(11)] + [JsonPropertyName("company_name"), JsonPropertyOrder(9)] public string? CompanyName { get; set; } + /// + /// The two-letter [ISO 3166-1 country code](https://en.wikipedia.org/wiki/ISO_3166-1) + /// + /// The two-letter [ISO 3166-1 country code](https://en.wikipedia.org/wiki/ISO_3166-1) + /// + /// CA + /// + [JsonPropertyName("country_code"), JsonPropertyOrder(10)] + public string? CountryCode { get; set; } + /// /// Email for the address owner. /// @@ -140,22 +130,32 @@ public partial class ShippingAddressTo /// /// example@example.com /// - [JsonPropertyName("email"), JsonPropertyOrder(12)] + [JsonPropertyName("email"), JsonPropertyOrder(11)] public string? Email { get; set; } /// /// Gets or Sets Geolocation /// - [JsonPropertyName("geolocation"), JsonPropertyOrder(13)] + [JsonPropertyName("geolocation"), JsonPropertyOrder(12)] public List? Geolocation { get; set; } /// /// Additional text about how to handle the shipment at this address. /// /// Additional text about how to handle the shipment at this address. - [JsonPropertyName("instructions"), JsonPropertyOrder(14)] + [JsonPropertyName("instructions"), JsonPropertyOrder(13)] public string? Instructions { get; set; } + /// + /// The phone number of a contact person at this address. The format of this phone number varies depending on the country. + /// + /// The phone number of a contact person at this address. The format of this phone number varies depending on the country. + /// + /// +1 204-253-9411 ext. 123 + /// + [JsonPropertyName("phone"), JsonPropertyOrder(14)] + public string? Phone { get; set; } + /// /// Returns the string presentation of the object @@ -167,19 +167,19 @@ public override string ToString() sb.Append("class ShippingAddressTo {\n"); #pragma warning disable CS0612 // Type or member is obsolete sb.Append(" AddressLine1: ").Append(AddressLine1).Append("\n"); - sb.Append(" AddressResidentialIndicator: ").Append(AddressResidentialIndicator).Append("\n"); sb.Append(" CityLocality: ").Append(CityLocality).Append("\n"); - sb.Append(" CountryCode: ").Append(CountryCode).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append(" Phone: ").Append(Phone).Append("\n"); sb.Append(" PostalCode: ").Append(PostalCode).Append("\n"); sb.Append(" StateProvince: ").Append(StateProvince).Append("\n"); sb.Append(" AddressLine2: ").Append(AddressLine2).Append("\n"); sb.Append(" AddressLine3: ").Append(AddressLine3).Append("\n"); + sb.Append(" AddressResidentialIndicator: ").Append(AddressResidentialIndicator).Append("\n"); sb.Append(" CompanyName: ").Append(CompanyName).Append("\n"); + sb.Append(" CountryCode: ").Append(CountryCode).Append("\n"); sb.Append(" Email: ").Append(Email).Append("\n"); sb.Append(" Geolocation: ").Append(Geolocation).Append("\n"); sb.Append(" Instructions: ").Append(Instructions).Append("\n"); + sb.Append(" Phone: ").Append(Phone).Append("\n"); #pragma warning restore CS0612 // Type or member is obsolete sb.Append("}\n"); return sb.ToString(); diff --git a/generation/swagger.json b/generation/swagger.json index 76983ee1..c2e6e9a6 100644 --- a/generation/swagger.json +++ b/generation/swagger.json @@ -2,7 +2,7 @@ "openapi": "3.0.0", "info": { "title": "ShipEngine API", - "version": "1.1.202410081510", + "version": "1.1.202410092210", "termsOfService": "https://www.shipengine.com/terms-of-service/", "x-logo": { "url": "https://shipengine.github.io/img/shipengine-logo-square.png", @@ -6435,13 +6435,10 @@ "description": "Any residential or business mailing address, anywhere in the world.\n\n> **Note:** Either `name` or `company_name` must be set. Both may be specified, if relevant.\n", "required": [ "name", - "phone", "address_line1", "city_locality", "state_province", - "postal_code", - "country_code", - "address_residential_indicator" + "postal_code" ], "additionalProperties": false, "allOf": [ @@ -10247,7 +10244,7 @@ "additionalProperties": false, "allOf": [ { - "$ref": "#/components/schemas/label" + "$ref": "#/components/schemas/label_request" } ], "properties": { @@ -10265,111 +10262,20 @@ } } }, - "label": { - "title": "label", + "label_request": { + "title": "label_request", "type": "object", "description": "A label represents the physical sticker that you affix to a package to ship it. ShipEngine makes it easy for you to [create labels](https://www.shipengine.com/docs/labels/create-a-label/) and then download them in PDF, PNG, or ZPL format so you can print them.\n", "additionalProperties": false, "properties": { - "label_id": { - "readOnly": true, - "allOf": [ - { - "$ref": "#/components/schemas/se_id" - } - ], - "description": "A string that uniquely identifies the label. This ID is generated by ShipEngine when the label is created.\n" - }, - "status": { - "readOnly": true, - "allOf": [ - { - "$ref": "#/components/schemas/label_status" - } - ] - }, - "shipment_id": { - "readOnly": true, - "allOf": [ - { - "$ref": "#/components/schemas/se_id" - } - ], - "description": "The shipment that this label is for. ShipEngine can create a shipment for you automatically when you [create a label](https://www.shipengine.com/docs/labels/create-a-label/), or you can [create your own shipment](https://www.shipengine.com/docs/shipping/create-a-shipment/) and then [use it to print a label](https://www.shipengine.com/docs/labels/create-from-shipment/)\n" - }, "shipment": { - "writeOnly": true, "allOf": [ { - "$ref": "#/components/schemas/shipment" + "$ref": "#/components/schemas/shipment_request" } ], "description": "The shipment information used to generate the label" }, - "ship_date": { - "allOf": [ - { - "$ref": "#/components/schemas/date" - } - ], - "readOnly": true, - "description": "The date that the package was (or will be) shippped. ShipEngine will take the day of week into consideration. For example, if the carrier does not operate on Sundays, then a package that would have shipped on Sunday will ship on Monday instead.\n" - }, - "created_at": { - "readOnly": true, - "allOf": [ - { - "$ref": "#/components/schemas/date_time" - } - ], - "description": "The date and time that the label was created in ShipEngine." - }, - "shipment_cost": { - "readOnly": true, - "allOf": [ - { - "$ref": "#/components/schemas/monetary_value" - } - ], - "description": "The cost of shipping, delivery confirmation, and other carrier charges. This amount **does not** include insurance costs.\n" - }, - "insurance_cost": { - "readOnly": true, - "allOf": [ - { - "$ref": "#/components/schemas/monetary_value" - } - ], - "description": "The insurance cost for this package. Add this to the `shipment_cost` field to get the total cost.\n" - }, - "requested_comparison_amount": { - "readOnly": true, - "allOf": [ - { - "$ref": "#/components/schemas/monetary_value" - } - ], - "description": "The total shipping cost for the specified comparison_rate_type.\n" - }, - "rate_details": { - "readOnly": true, - "description": "A list of rate details that are associated with shipping cost. This is useful for\ndisplaying a breakdown of the rate to the user.\n", - "type": "array", - "items": { - "allOf": [ - { - "$ref": "#/components/schemas/rate_detail" - } - ] - } - }, - "tracking_number": { - "type": "string", - "minLength": 1, - "readOnly": true, - "example": "782758401696", - "description": "The tracking number for the package. Tracking number formats vary across carriers." - }, "is_return_label": { "type": "boolean", "description": "Indicates whether this is a return label. You may also want to set the `rma_number` so you know what is being returned.\n" @@ -10379,29 +10285,6 @@ "nullable": true, "description": "An optional Return Merchandise Authorization number. This field is useful for return labels. You can set it to any string value.\n" }, - "is_international": { - "type": "boolean", - "readOnly": true, - "description": "Indicates whether this is an international shipment. That is, the originating country and destination country are different.\n" - }, - "batch_id": { - "readOnly": true, - "allOf": [ - { - "$ref": "#/components/schemas/se_id" - } - ], - "description": "If this label was created as part of a [batch](https://www.shipengine.com/docs/labels/bulk/), then this is the unique ID of that batch.\n" - }, - "carrier_id": { - "readOnly": true, - "allOf": [ - { - "$ref": "#/components/schemas/se_id" - } - ], - "description": "The unique ID of the [carrier account](https://www.shipengine.com/docs/carriers/setup/) that was used to create this label\n" - }, "charge_event": { "allOf": [ { @@ -10419,15 +10302,6 @@ "writeOnly": true, "description": "The `label_id` of the original (outgoing) label that the return label is for. This associates the two labels together, which is\nrequired by some carriers.\n" }, - "service_code": { - "allOf": [ - { - "$ref": "#/components/schemas/service_code" - } - ], - "readOnly": true, - "description": "The [carrier service](https://www.shipengine.com/docs/shipping/use-a-carrier-service/) used to ship the package, such as `fedex_ground`, `usps_first_class_mail`, `flat_rate_envelope`, etc.\n" - }, "test_label": { "writeOnly": true, "type": "boolean", @@ -10435,15 +10309,6 @@ "deprecated": true, "description": "Indicate if this label is being used only for testing purposes. If true, then no charge will be added to your account." }, - "package_code": { - "readOnly": true, - "allOf": [ - { - "$ref": "#/components/schemas/package_code" - } - ], - "description": "The [package type](https://www.shipengine.com/docs/reference/list-carrier-packages/), such as `thick_envelope`, `small_flat_rate_box`, `large_package`, etc. The code `package` indicates a custom or unknown package type.\n" - }, "validate_address": { "writeOnly": true, "default": "validate_and_clean", @@ -10453,21 +10318,6 @@ } ] }, - "voided": { - "type": "boolean", - "readOnly": true, - "description": "Indicates whether the label has been [voided](https://www.shipengine.com/docs/labels/voiding/)\n" - }, - "voided_at": { - "nullable": true, - "readOnly": true, - "allOf": [ - { - "$ref": "#/components/schemas/date_time" - } - ], - "description": "The date and time that the label was [voided](https://www.shipengine.com/docs/labels/voiding/), or `null` if the label has not been voided\n" - }, "label_download_type": { "writeOnly": true, "default": "url", @@ -10504,11 +10354,6 @@ ], "description": "The layout (size) that you want the label to be in. The `label_format` determines which sizes are allowed. `4x6` is supported for all label formats, whereas `letter` (8.5\" x 11\") is only supported for `pdf` format.\n" }, - "trackable": { - "type": "boolean", - "readOnly": true, - "description": "Indicates whether the shipment is trackable, in which case the `tracking_status` field will reflect the current status and each package will have a `tracking_number`.\n" - }, "label_image_id": { "nullable": true, "allOf": [ @@ -10517,201 +10362,80 @@ } ], "description": "The label image resource that was used to create a custom label image." - }, - "carrier_code": { - "readOnly": true, - "allOf": [ - { - "$ref": "#/components/schemas/carrier_code" - } - ], - "description": "The [shipping carrier](https://www.shipengine.com/docs/carriers/setup/) who will ship the package, such as `fedex`, `dhl_express`, `stamps_com`, etc.\n" - }, - "tracking_status": { - "readOnly": true, - "allOf": [ - { - "$ref": "#/components/schemas/tracking_status" - } - ], - "description": "The current status of the package, such as `in_transit` or `delivered`" - }, - "label_download": { + } + } + }, + "shipment_request": { + "title": "shipment_request", + "type": "object", + "description": "The information necessary to ship a package, such as the origin, the destination, the carrier service, and the package dimensions and weight.\n\n> **Note:** Either `ship_from` or `warehouse_id` must be set.\n", + "required": [ + "carrier_id", + "service_code", + "ship_to", + "packages" + ], + "additionalProperties": false, + "properties": { + "carrier_id": { "allOf": [ { - "$ref": "#/components/schemas/label_download" + "$ref": "#/components/schemas/se_id" } ], - "readOnly": true + "description": "The carrier account that is billed for the shipping charges" }, - "form_download": { - "readOnly": true, - "nullable": true, + "service_code": { "allOf": [ { - "$ref": "#/components/schemas/link" + "$ref": "#/components/schemas/service_code" } ], - "description": "The link to download the customs form (a.k.a. commercial invoice) for this shipment, if any. Forms are in PDF format. This field is null if the shipment does not require a customs form, or if the carrier does not support it.\n" + "description": "The [carrier service](https://www.shipengine.com/docs/shipping/use-a-carrier-service/) used to ship the package, such as `fedex_ground`, `usps_first_class_mail`, `flat_rate_envelope`, etc.\n" }, - "paperless_download": { - "readOnly": true, - "nullable": true, + "shipping_rule_id": { "allOf": [ { - "$ref": "#/components/schemas/paperless_download" + "$ref": "#/components/schemas/se_id" } ], - "description": "The paperless details which may contain elements like `href`, `instructions` and `handoff_code`.\n" + "description": "ID of the shipping rule, which you want to use to automate carrier/carrier service selection for the shipment\n" }, - "insurance_claim": { - "readOnly": true, + "external_order_id": { + "type": "string", "nullable": true, - "allOf": [ - { - "$ref": "#/components/schemas/link" - } - ], - "description": "The link to submit an insurance claim for the shipment. This field is null if the shipment is not insured or if the insurance provider does not support online claim submission.\n" + "description": "ID that the Order Source assigned" }, - "packages": { + "items": { "type": "array", - "readOnly": true, - "description": "The label's package(s).\n\n> **Note:** Some carriers only allow one package per label. If you attempt to create a multi-package label for a carrier that doesn't allow it, an error will be returned.\n", + "default": [], "items": { "allOf": [ { - "$ref": "#/components/schemas/label_package" - }, - { - "$ref": "#/components/schemas/alternative_identifiers" + "$ref": "#/components/schemas/shipment_item" } ] - } + }, + "description": "Describe the packages included in this shipment as related to potential metadata that was imported from\nexternal order sources\n" }, - "alternative_identifiers": { + "tax_identifiers": { "type": "array", - "readOnly": true, "nullable": true, - "description": "Additional information some carriers may provide by which to identify a given label in their system. \n", "items": { - "$ref": "#/components/schemas/alternative_identifier" + "allOf": [ + { + "$ref": "#/components/schemas/tax_identifier" + } + ] } }, - "tracking_url": { - "readOnly": true, + "external_shipment_id": { + "type": "string", + "maxLength": 50, "nullable": true, - "type": "string", - "example": "https://www.fedex.com/fedextrack/?action=track&trackingnumber=1234", - "description": "The URL to track the package. This URL is provided by the carrier and is unique to the tracking number.\n" - } - } - }, - "shipment": { - "title": "shipment", - "type": "object", - "description": "The information necessary to ship a package, such as the origin, the destination, the carrier service, and the package dimensions and weight.\n\n> **Note:** Either `ship_from` or `warehouse_id` must be set.\n", - "required": [ - "shipment_id", - "carrier_id", - "service_code", - "ship_date", - "created_at", - "modified_at", - "shipment_status", - "ship_to", - "ship_from", - "warehouse_id", - "return_to", - "confirmation", - "customs", - "advanced_options", - "insurance_provider", - "tags", - "packages", - "total_weight" - ], - "additionalProperties": false, - "allOf": [ - { - "$ref": "#/components/schemas/partial_shipment" - } - ] - }, - "partial_shipment": { - "title": "partial_shipment", - "type": "object", - "description": "The information necessary to ship a package, such as the origin, the destination, the carrier service, and the package dimensions and weight.\n", - "additionalProperties": false, - "properties": { - "shipment_id": { - "readOnly": true, - "allOf": [ - { - "$ref": "#/components/schemas/se_id" - } - ], - "description": "A string that uniquely identifies the shipment" - }, - "carrier_id": { - "allOf": [ - { - "$ref": "#/components/schemas/se_id" - } - ], - "description": "The carrier account that is billed for the shipping charges" - }, - "service_code": { - "allOf": [ - { - "$ref": "#/components/schemas/service_code" - } - ], - "description": "The [carrier service](https://www.shipengine.com/docs/shipping/use-a-carrier-service/) used to ship the package, such as `fedex_ground`, `usps_first_class_mail`, `flat_rate_envelope`, etc.\n" - }, - "shipping_rule_id": { - "allOf": [ - { - "$ref": "#/components/schemas/se_id" - } - ], - "description": "ID of the shipping rule, which you want to use to automate carrier/carrier service selection for the shipment\n" - }, - "external_order_id": { - "type": "string", - "nullable": true, - "description": "ID that the Order Source assigned" - }, - "items": { - "type": "array", - "default": [], - "items": { - "allOf": [ - { - "$ref": "#/components/schemas/shipment_item" - } - ] - }, - "description": "Describe the packages included in this shipment as related to potential metadata that was imported from\nexternal order sources\n" - }, - "tax_identifiers": { - "type": "array", - "nullable": true, - "items": { - "allOf": [ - { - "$ref": "#/components/schemas/tax_identifier" - } - ] - } - }, - "external_shipment_id": { - "type": "string", - "maxLength": 50, - "nullable": true, - "description": "A unique user-defined key to identify a shipment. This can be used to retrieve the shipment.\n\n> **Warning:** The `external_shipment_id` is limited to 50 characters. Any additional characters will be truncated.\n" - }, - "shipment_number": { + "description": "A unique user-defined key to identify a shipment. This can be used to retrieve the shipment.\n\n> **Warning:** The `external_shipment_id` is limited to 50 characters. Any additional characters will be truncated.\n" + }, + "shipment_number": { "type": "string", "maxLength": 50, "nullable": true, @@ -10725,34 +10449,6 @@ ], "description": "The date that the shipment was (or will be) shippped. ShipEngine will take the day of week into consideration. For example, if the carrier does not operate on Sundays, then a package that would have shipped on Sunday will ship on Monday instead.\n" }, - "created_at": { - "readOnly": true, - "allOf": [ - { - "$ref": "#/components/schemas/date_time" - } - ], - "description": "The date and time that the shipment was created in ShipEngine." - }, - "modified_at": { - "readOnly": true, - "allOf": [ - { - "$ref": "#/components/schemas/date_time" - } - ], - "description": "The date and time that the shipment was created or last modified." - }, - "shipment_status": { - "readOnly": true, - "default": "pending", - "allOf": [ - { - "$ref": "#/components/schemas/shipment_status" - } - ], - "description": "The current status of the shipment" - }, "ship_to": { "allOf": [ { @@ -10764,7 +10460,7 @@ "ship_from": { "allOf": [ { - "$ref": "#/components/schemas/shipping_address" + "$ref": "#/components/schemas/shipping_address_from" } ], "description": "The shipment's origin address. If you frequently ship from the same location, consider [creating a warehouse](https://www.shipengine.com/docs/reference/create-warehouse/). Then you can simply specify the `warehouse_id` rather than the complete address each time.\n" @@ -10829,20 +10525,6 @@ ], "description": "The insurance provider to use for any insured packages in the shipment.\n" }, - "tags": { - "type": "array", - "readOnly": true, - "default": [], - "minItems": 0, - "items": { - "allOf": [ - { - "$ref": "#/components/schemas/tag" - } - ] - }, - "description": "Arbitrary tags associated with this shipment. Tags can be used to categorize shipments, and shipments can be queried by their tags.\n" - }, "order_source_code": { "allOf": [ { @@ -10862,15 +10544,6 @@ }, "description": "The packages in the shipment.\n\n> **Note:** Some carriers only allow one package per shipment. If you attempt to create a multi-package shipment for a carrier that doesn't allow it, an error will be returned.\n" }, - "total_weight": { - "readOnly": true, - "allOf": [ - { - "$ref": "#/components/schemas/weight" - } - ], - "description": "The combined weight of all packages in the shipment" - }, "comparison_rate_type": { "nullable": true, "type": "string", @@ -11039,17 +10712,6 @@ "example": "2018-09-23T00:00:00.000Z", "description": "An [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) string that represents a date, but not a specific time. The value _may_ contain a time component, but it will be set to `00:00:00` UTC by ShipEngine.\n" }, - "shipment_status": { - "title": "shipment_status", - "type": "string", - "enum": [ - "pending", - "processing", - "label_purchased", - "cancelled" - ], - "description": "The possible shipment status values" - }, "shipping_address_to": { "title": "shipping_address_to", "type": "object", @@ -11098,10 +10760,14 @@ } } }, - "shipping_address": { - "title": "shipping_address", + "shipping_address_from": { + "title": "shipping_address_from", "type": "object", "additionalProperties": false, + "required": [ + "phone", + "country_code" + ], "allOf": [ { "$ref": "#/components/schemas/address" @@ -11125,6 +10791,19 @@ } } }, + "shipping_address": { + "title": "shipping_address", + "type": "object", + "additionalProperties": false, + "allOf": [ + { + "$ref": "#/components/schemas/address" + }, + { + "$ref": "#/components/schemas/partial_shipping_address" + } + ] + }, "delivery_confirmation": { "title": "delivery_confirmation", "type": "string", @@ -11506,7 +11185,7 @@ "title": "advanced_shipment_options", "type": "object", "description": "Advanced shipment options", - "additionalProperties": false, + "additionalProperties": true, "properties": { "bill_to_account": { "type": "string", @@ -11784,23 +11463,6 @@ ], "description": "The possible insurance provider values" }, - "tag": { - "title": "tag", - "type": "object", - "description": "Tags are arbitrary strings that you can use to categorize shipments. For example, you may want to use tags to distinguish between domestic and international shipments, or between insured and uninsured shipments. Or maybe you want to create a tag for each of your customers so you can easily retrieve every shipment for a customer.\n", - "required": [ - "name" - ], - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "minLength": 1, - "example": "Fragile", - "description": "The tag name." - } - } - }, "package": { "title": "package", "type": "object", @@ -12098,121 +11760,835 @@ "packaging_instruction": { "type": "string", "nullable": true, - "default": null, - "description": "The specific standardized packaging instructions from the relevant regulatory agency that have been applied to the parcel/container." + "default": null, + "description": "The specific standardized packaging instructions from the relevant regulatory agency that have been applied to the parcel/container." + }, + "packaging_instruction_section": { + "$ref": "#/components/schemas/packaging_instruction_section" + }, + "packaging_type": { + "type": "string", + "nullable": true, + "default": null, + "description": "The type of exterior packaging used to contain the dangerous good." + }, + "transport_mean": { + "$ref": "#/components/schemas/transport_mean" + }, + "transport_category": { + "type": "string", + "nullable": true, + "default": null, + "description": "Transport category assign to dangerous goods for the transport purpose." + }, + "regulation_authority": { + "type": "string", + "nullable": true, + "default": null, + "description": "Name of the regulatory authority." + }, + "regulation_level": { + "$ref": "#/components/schemas/regulation_level" + }, + "radioactive": { + "type": "boolean", + "nullable": true, + "example": false, + "description": "Indication if the substance is radioactive." + }, + "reportable_quantity": { + "type": "boolean", + "nullable": true, + "example": false, + "description": "Indication if the substance needs to be reported to regulatory authority based on the quantity." + }, + "tunnel_code": { + "type": "string", + "nullable": true, + "default": null, + "description": "Defines which types of tunnels the shipment is allowed to go through" + }, + "additional_description": { + "type": "string", + "nullable": true, + "default": null, + "description": "Provider additonal description regarding the dangerous goods. This is used as a placed holder to provider additional context and varies by carrier" + } + } + }, + "packaging_group": { + "title": "packaging_group", + "type": "string", + "enum": [ + "i", + "ii", + "iii" + ] + }, + "dangerous_amount": { + "title": "dangerous_amount", + "type": "object", + "description": "This model represents the amount of the dangerous goods..", + "additionalProperties": false, + "properties": { + "amount": { + "type": "number", + "minimum": 0, + "default": 0, + "description": "The amount of dangerous goods." + }, + "unit": { + "type": "string", + "nullable": true, + "default": null, + "description": "The unit of dangerous goods." + } + } + }, + "packaging_instruction_section": { + "title": "packaging_instruction_section", + "type": "string", + "enum": [ + "section_1", + "section_2", + "section_1a", + "section_1b" + ] + }, + "transport_mean": { + "title": "transport_mean", + "type": "string", + "enum": [ + "ground", + "water", + "cargo_aircraft_only", + "passenger_aircraft" + ] + }, + "regulation_level": { + "title": "regulation_level", + "type": "string", + "enum": [ + "lightly_regulated", + "fully_regulated", + "limited_quantities", + "excepted_quantity" + ] + }, + "label_charge_event": { + "title": "label_charge_event", + "type": "string", + "enum": [ + "carrier_default", + "on_creation", + "on_carrier_acceptance" + ], + "description": "Determines when the user's account will be charged for the label." + }, + "validate_address": { + "title": "validate_address", + "type": "string", + "enum": [ + "no_validation", + "validate_only", + "validate_and_clean" + ], + "description": "The possible validate address values" + }, + "label_download_type": { + "title": "label_download_type", + "type": "string", + "enum": [ + "url", + "inline" + ], + "description": "There are two different ways to [download a label](https://www.shipengine.com/docs/labels/downloading/):\n\n|Label Download Type | Description\n|--------------------|------------------------------\n|`url` |You will receive a URL, which you can use to download the label in a separate request. The URL will remain valid for 90 days.

This is the default if `label_download_type` is unspecified.\n|`inline` |You will receive the Base64-encoded label as part of the response. No need for a second request to download the label.\n" + }, + "create_label_response_body": { + "title": "create_label_response_body", + "type": "object", + "description": "A create label response body", + "additionalProperties": false, + "required": [ + "label_id", + "status", + "shipment_id", + "ship_date", + "created_at", + "shipment_cost", + "insurance_cost", + "tracking_number", + "is_international", + "batch_id", + "carrier_id", + "service_code", + "voided", + "voided_at", + "label_image_id", + "label_format", + "label_layout", + "trackable", + "carrier_code", + "tracking_status", + "label_download", + "form_download", + "paperless_download", + "insurance_claim", + "packages", + "is_return_label", + "rma_number", + "charge_event", + "package_code", + "display_scheme" + ], + "allOf": [ + { + "$ref": "#/components/schemas/label" + } + ] + }, + "label": { + "title": "label", + "type": "object", + "description": "A label represents the physical sticker that you affix to a package to ship it. ShipEngine makes it easy for you to [create labels](https://www.shipengine.com/docs/labels/create-a-label/) and then download them in PDF, PNG, or ZPL format so you can print them.\n", + "additionalProperties": false, + "properties": { + "label_id": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/components/schemas/se_id" + } + ], + "description": "A string that uniquely identifies the label. This ID is generated by ShipEngine when the label is created.\n" + }, + "status": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/components/schemas/label_status" + } + ] + }, + "shipment_id": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/components/schemas/se_id" + } + ], + "description": "The shipment that this label is for. ShipEngine can create a shipment for you automatically when you [create a label](https://www.shipengine.com/docs/labels/create-a-label/), or you can [create your own shipment](https://www.shipengine.com/docs/shipping/create-a-shipment/) and then [use it to print a label](https://www.shipengine.com/docs/labels/create-from-shipment/)\n" + }, + "shipment": { + "writeOnly": true, + "allOf": [ + { + "$ref": "#/components/schemas/shipment" + } + ], + "description": "The shipment information used to generate the label" + }, + "ship_date": { + "allOf": [ + { + "$ref": "#/components/schemas/date" + } + ], + "readOnly": true, + "description": "The date that the package was (or will be) shippped. ShipEngine will take the day of week into consideration. For example, if the carrier does not operate on Sundays, then a package that would have shipped on Sunday will ship on Monday instead.\n" + }, + "created_at": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/components/schemas/date_time" + } + ], + "description": "The date and time that the label was created in ShipEngine." + }, + "shipment_cost": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/components/schemas/monetary_value" + } + ], + "description": "The cost of shipping, delivery confirmation, and other carrier charges. This amount **does not** include insurance costs.\n" + }, + "insurance_cost": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/components/schemas/monetary_value" + } + ], + "description": "The insurance cost for this package. Add this to the `shipment_cost` field to get the total cost.\n" + }, + "requested_comparison_amount": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/components/schemas/monetary_value" + } + ], + "description": "The total shipping cost for the specified comparison_rate_type.\n" + }, + "rate_details": { + "readOnly": true, + "description": "A list of rate details that are associated with shipping cost. This is useful for\ndisplaying a breakdown of the rate to the user.\n", + "type": "array", + "items": { + "allOf": [ + { + "$ref": "#/components/schemas/rate_detail" + } + ] + } + }, + "tracking_number": { + "type": "string", + "minLength": 1, + "readOnly": true, + "example": "782758401696", + "description": "The tracking number for the package. Tracking number formats vary across carriers." + }, + "is_return_label": { + "type": "boolean", + "description": "Indicates whether this is a return label. You may also want to set the `rma_number` so you know what is being returned.\n" + }, + "rma_number": { + "type": "string", + "nullable": true, + "description": "An optional Return Merchandise Authorization number. This field is useful for return labels. You can set it to any string value.\n" + }, + "is_international": { + "type": "boolean", + "readOnly": true, + "description": "Indicates whether this is an international shipment. That is, the originating country and destination country are different.\n" + }, + "batch_id": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/components/schemas/se_id" + } + ], + "description": "If this label was created as part of a [batch](https://www.shipengine.com/docs/labels/bulk/), then this is the unique ID of that batch.\n" + }, + "carrier_id": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/components/schemas/se_id" + } + ], + "description": "The unique ID of the [carrier account](https://www.shipengine.com/docs/carriers/setup/) that was used to create this label\n" + }, + "charge_event": { + "allOf": [ + { + "$ref": "#/components/schemas/label_charge_event" + } + ], + "description": "The label charge event.\n" + }, + "outbound_label_id": { + "allOf": [ + { + "$ref": "#/components/schemas/se_id" + } + ], + "writeOnly": true, + "description": "The `label_id` of the original (outgoing) label that the return label is for. This associates the two labels together, which is\nrequired by some carriers.\n" + }, + "service_code": { + "allOf": [ + { + "$ref": "#/components/schemas/service_code" + } + ], + "readOnly": true, + "description": "The [carrier service](https://www.shipengine.com/docs/shipping/use-a-carrier-service/) used to ship the package, such as `fedex_ground`, `usps_first_class_mail`, `flat_rate_envelope`, etc.\n" + }, + "test_label": { + "writeOnly": true, + "type": "boolean", + "default": false, + "deprecated": true, + "description": "Indicate if this label is being used only for testing purposes. If true, then no charge will be added to your account." + }, + "package_code": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/components/schemas/package_code" + } + ], + "description": "The [package type](https://www.shipengine.com/docs/reference/list-carrier-packages/), such as `thick_envelope`, `small_flat_rate_box`, `large_package`, etc. The code `package` indicates a custom or unknown package type.\n" + }, + "validate_address": { + "writeOnly": true, + "default": "validate_and_clean", + "allOf": [ + { + "$ref": "#/components/schemas/validate_address" + } + ] + }, + "voided": { + "type": "boolean", + "readOnly": true, + "description": "Indicates whether the label has been [voided](https://www.shipengine.com/docs/labels/voiding/)\n" + }, + "voided_at": { + "nullable": true, + "readOnly": true, + "allOf": [ + { + "$ref": "#/components/schemas/date_time" + } + ], + "description": "The date and time that the label was [voided](https://www.shipengine.com/docs/labels/voiding/), or `null` if the label has not been voided\n" + }, + "label_download_type": { + "writeOnly": true, + "default": "url", + "allOf": [ + { + "$ref": "#/components/schemas/label_download_type" + } + ] + }, + "label_format": { + "default": "pdf", + "allOf": [ + { + "$ref": "#/components/schemas/label_format" + } + ], + "description": "The file format that you want the label to be in. We recommend `pdf` format because it is supported by all carriers, whereas some carriers do not support the `png` or `zpl` formats.\n" + }, + "display_scheme": { + "default": "label", + "allOf": [ + { + "$ref": "#/components/schemas/display_scheme" + } + ], + "description": "The display format that the label should be shown in." + }, + "label_layout": { + "default": "4x6", + "allOf": [ + { + "$ref": "#/components/schemas/label_layout" + } + ], + "description": "The layout (size) that you want the label to be in. The `label_format` determines which sizes are allowed. `4x6` is supported for all label formats, whereas `letter` (8.5\" x 11\") is only supported for `pdf` format.\n" + }, + "trackable": { + "type": "boolean", + "readOnly": true, + "description": "Indicates whether the shipment is trackable, in which case the `tracking_status` field will reflect the current status and each package will have a `tracking_number`.\n" + }, + "label_image_id": { + "nullable": true, + "allOf": [ + { + "$ref": "#/components/schemas/image_id" + } + ], + "description": "The label image resource that was used to create a custom label image." + }, + "carrier_code": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/components/schemas/carrier_code" + } + ], + "description": "The [shipping carrier](https://www.shipengine.com/docs/carriers/setup/) who will ship the package, such as `fedex`, `dhl_express`, `stamps_com`, etc.\n" + }, + "tracking_status": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/components/schemas/tracking_status" + } + ], + "description": "The current status of the package, such as `in_transit` or `delivered`" + }, + "label_download": { + "allOf": [ + { + "$ref": "#/components/schemas/label_download" + } + ], + "readOnly": true + }, + "form_download": { + "readOnly": true, + "nullable": true, + "allOf": [ + { + "$ref": "#/components/schemas/link" + } + ], + "description": "The link to download the customs form (a.k.a. commercial invoice) for this shipment, if any. Forms are in PDF format. This field is null if the shipment does not require a customs form, or if the carrier does not support it.\n" + }, + "paperless_download": { + "readOnly": true, + "nullable": true, + "allOf": [ + { + "$ref": "#/components/schemas/paperless_download" + } + ], + "description": "The paperless details which may contain elements like `href`, `instructions` and `handoff_code`.\n" + }, + "insurance_claim": { + "readOnly": true, + "nullable": true, + "allOf": [ + { + "$ref": "#/components/schemas/link" + } + ], + "description": "The link to submit an insurance claim for the shipment. This field is null if the shipment is not insured or if the insurance provider does not support online claim submission.\n" + }, + "packages": { + "type": "array", + "readOnly": true, + "description": "The label's package(s).\n\n> **Note:** Some carriers only allow one package per label. If you attempt to create a multi-package label for a carrier that doesn't allow it, an error will be returned.\n", + "items": { + "allOf": [ + { + "$ref": "#/components/schemas/label_package" + }, + { + "$ref": "#/components/schemas/alternative_identifiers" + } + ] + } + }, + "alternative_identifiers": { + "type": "array", + "readOnly": true, + "nullable": true, + "description": "Additional information some carriers may provide by which to identify a given label in their system. \n", + "items": { + "$ref": "#/components/schemas/alternative_identifier" + } + }, + "tracking_url": { + "readOnly": true, + "nullable": true, + "type": "string", + "example": "https://www.fedex.com/fedextrack/?action=track&trackingnumber=1234", + "description": "The URL to track the package. This URL is provided by the carrier and is unique to the tracking number.\n" + } + } + }, + "shipment": { + "title": "shipment", + "type": "object", + "description": "The information necessary to ship a package, such as the origin, the destination, the carrier service, and the package dimensions and weight.\n\n> **Note:** Either `ship_from` or `warehouse_id` must be set.\n", + "required": [ + "shipment_id", + "carrier_id", + "service_code", + "ship_date", + "created_at", + "modified_at", + "shipment_status", + "ship_to", + "ship_from", + "warehouse_id", + "return_to", + "confirmation", + "customs", + "advanced_options", + "insurance_provider", + "tags", + "packages", + "total_weight" + ], + "additionalProperties": false, + "allOf": [ + { + "$ref": "#/components/schemas/partial_shipment" + } + ] + }, + "partial_shipment": { + "title": "partial_shipment", + "type": "object", + "description": "The information necessary to ship a package, such as the origin, the destination, the carrier service, and the package dimensions and weight.\n", + "additionalProperties": false, + "properties": { + "shipment_id": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/components/schemas/se_id" + } + ], + "description": "A string that uniquely identifies the shipment" + }, + "carrier_id": { + "allOf": [ + { + "$ref": "#/components/schemas/se_id" + } + ], + "description": "The carrier account that is billed for the shipping charges" + }, + "service_code": { + "allOf": [ + { + "$ref": "#/components/schemas/service_code" + } + ], + "description": "The [carrier service](https://www.shipengine.com/docs/shipping/use-a-carrier-service/) used to ship the package, such as `fedex_ground`, `usps_first_class_mail`, `flat_rate_envelope`, etc.\n" + }, + "shipping_rule_id": { + "allOf": [ + { + "$ref": "#/components/schemas/se_id" + } + ], + "description": "ID of the shipping rule, which you want to use to automate carrier/carrier service selection for the shipment\n" + }, + "external_order_id": { + "type": "string", + "nullable": true, + "description": "ID that the Order Source assigned" + }, + "items": { + "type": "array", + "default": [], + "items": { + "allOf": [ + { + "$ref": "#/components/schemas/shipment_item" + } + ] + }, + "description": "Describe the packages included in this shipment as related to potential metadata that was imported from\nexternal order sources\n" + }, + "tax_identifiers": { + "type": "array", + "nullable": true, + "items": { + "allOf": [ + { + "$ref": "#/components/schemas/tax_identifier" + } + ] + } + }, + "external_shipment_id": { + "type": "string", + "maxLength": 50, + "nullable": true, + "description": "A unique user-defined key to identify a shipment. This can be used to retrieve the shipment.\n\n> **Warning:** The `external_shipment_id` is limited to 50 characters. Any additional characters will be truncated.\n" + }, + "shipment_number": { + "type": "string", + "maxLength": 50, + "nullable": true, + "description": "A non-unique user-defined number used to identify a shipment. If undefined, this will match the external_shipment_id of the shipment.\n\n> **Warning:** The `shipment_number` is limited to 50 characters. Any additional characters will be truncated.\n" + }, + "ship_date": { + "allOf": [ + { + "$ref": "#/components/schemas/date" + } + ], + "description": "The date that the shipment was (or will be) shippped. ShipEngine will take the day of week into consideration. For example, if the carrier does not operate on Sundays, then a package that would have shipped on Sunday will ship on Monday instead.\n" + }, + "created_at": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/components/schemas/date_time" + } + ], + "description": "The date and time that the shipment was created in ShipEngine." + }, + "modified_at": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/components/schemas/date_time" + } + ], + "description": "The date and time that the shipment was created or last modified." + }, + "shipment_status": { + "readOnly": true, + "default": "pending", + "allOf": [ + { + "$ref": "#/components/schemas/shipment_status" + } + ], + "description": "The current status of the shipment" + }, + "ship_to": { + "allOf": [ + { + "$ref": "#/components/schemas/shipping_address_to" + } + ], + "description": "The recipient's mailing address" + }, + "ship_from": { + "allOf": [ + { + "$ref": "#/components/schemas/shipping_address" + } + ], + "description": "The shipment's origin address. If you frequently ship from the same location, consider [creating a warehouse](https://www.shipengine.com/docs/reference/create-warehouse/). Then you can simply specify the `warehouse_id` rather than the complete address each time.\n" + }, + "warehouse_id": { + "nullable": true, + "default": null, + "allOf": [ + { + "$ref": "#/components/schemas/se_id" + } + ], + "description": "The [warehouse](https://www.shipengine.com/docs/shipping/ship-from-a-warehouse/) that the shipment is being shipped from. Either `warehouse_id` or `ship_from` must be specified.\n" + }, + "return_to": { + "allOf": [ + { + "$ref": "#/components/schemas/shipping_address" + } + ], + "description": "The return address for this shipment. Defaults to the `ship_from` address.\n" + }, + "is_return": { + "type": "boolean", + "nullable": true, + "default": false, + "description": "An optional indicator if the shipment is intended to be a return. Defaults to false if not provided.\n" }, - "packaging_instruction_section": { - "$ref": "#/components/schemas/packaging_instruction_section" + "confirmation": { + "default": "none", + "allOf": [ + { + "$ref": "#/components/schemas/delivery_confirmation" + } + ], + "description": "The type of delivery confirmation that is required for this shipment." }, - "packaging_type": { - "type": "string", + "customs": { "nullable": true, "default": null, - "description": "The type of exterior packaging used to contain the dangerous good." + "allOf": [ + { + "$ref": "#/components/schemas/international_shipment_options" + } + ], + "description": "Customs information. This is usually only needed for international shipments.\n" }, - "transport_mean": { - "$ref": "#/components/schemas/transport_mean" + "advanced_options": { + "allOf": [ + { + "$ref": "#/components/schemas/advanced_shipment_options" + } + ], + "description": "Advanced shipment options. These are entirely optional." }, - "transport_category": { - "type": "string", - "nullable": true, - "default": null, - "description": "Transport category assign to dangerous goods for the transport purpose." + "insurance_provider": { + "default": "none", + "allOf": [ + { + "$ref": "#/components/schemas/insurance_provider" + } + ], + "description": "The insurance provider to use for any insured packages in the shipment.\n" }, - "regulation_authority": { - "type": "string", - "nullable": true, - "default": null, - "description": "Name of the regulatory authority." + "tags": { + "type": "array", + "readOnly": true, + "default": [], + "minItems": 0, + "items": { + "allOf": [ + { + "$ref": "#/components/schemas/tag" + } + ] + }, + "description": "Arbitrary tags associated with this shipment. Tags can be used to categorize shipments, and shipments can be queried by their tags.\n" }, - "regulation_level": { - "$ref": "#/components/schemas/regulation_level" + "order_source_code": { + "allOf": [ + { + "$ref": "#/components/schemas/order_source_name" + } + ] }, - "radioactive": { - "type": "boolean", - "nullable": true, - "example": false, - "description": "Indication if the substance is radioactive." + "packages": { + "type": "array", + "minItems": 1, + "items": { + "allOf": [ + { + "$ref": "#/components/schemas/package" + } + ] + }, + "description": "The packages in the shipment.\n\n> **Note:** Some carriers only allow one package per shipment. If you attempt to create a multi-package shipment for a carrier that doesn't allow it, an error will be returned.\n" }, - "reportable_quantity": { - "type": "boolean", - "nullable": true, - "example": false, - "description": "Indication if the substance needs to be reported to regulatory authority based on the quantity." + "total_weight": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/components/schemas/weight" + } + ], + "description": "The combined weight of all packages in the shipment" }, - "tunnel_code": { - "type": "string", + "comparison_rate_type": { "nullable": true, - "default": null, - "description": "Defines which types of tunnels the shipment is allowed to go through" - }, - "additional_description": { "type": "string", - "nullable": true, - "default": null, - "description": "Provider additonal description regarding the dangerous goods. This is used as a placed holder to provider additional context and varies by carrier" + "description": "Calculate a rate for this shipment with the requested carrier using a ratecard that differs from the default. Only supported for UPS and USPS.", + "example": "retail" } } }, - "packaging_group": { - "title": "packaging_group", + "shipment_status": { + "title": "shipment_status", "type": "string", "enum": [ - "i", - "ii", - "iii" - ] + "pending", + "processing", + "label_purchased", + "cancelled" + ], + "description": "The possible shipment status values" }, - "dangerous_amount": { - "title": "dangerous_amount", + "tag": { + "title": "tag", "type": "object", - "description": "This model represents the amount of the dangerous goods..", + "description": "Tags are arbitrary strings that you can use to categorize shipments. For example, you may want to use tags to distinguish between domestic and international shipments, or between insured and uninsured shipments. Or maybe you want to create a tag for each of your customers so you can easily retrieve every shipment for a customer.\n", + "required": [ + "name" + ], "additionalProperties": false, "properties": { - "amount": { - "type": "number", - "minimum": 0, - "default": 0, - "description": "The amount of dangerous goods." - }, - "unit": { + "name": { "type": "string", - "nullable": true, - "default": null, - "description": "The unit of dangerous goods." + "minLength": 1, + "example": "Fragile", + "description": "The tag name." } } }, - "packaging_instruction_section": { - "title": "packaging_instruction_section", - "type": "string", - "enum": [ - "section_1", - "section_2", - "section_1a", - "section_1b" - ] - }, - "transport_mean": { - "title": "transport_mean", - "type": "string", - "enum": [ - "ground", - "water", - "cargo_aircraft_only", - "passenger_aircraft" - ] - }, - "regulation_level": { - "title": "regulation_level", - "type": "string", - "enum": [ - "lightly_regulated", - "fully_regulated", - "limited_quantities", - "excepted_quantity" - ] - }, "rate_detail": { "title": "rate_detail", "type": "object", @@ -12319,35 +12695,6 @@ ], "description": "Type of a tax added to shipping cost" }, - "label_charge_event": { - "title": "label_charge_event", - "type": "string", - "enum": [ - "carrier_default", - "on_creation", - "on_carrier_acceptance" - ], - "description": "Determines when the user's account will be charged for the label." - }, - "validate_address": { - "title": "validate_address", - "type": "string", - "enum": [ - "no_validation", - "validate_only", - "validate_and_clean" - ], - "description": "The possible validate address values" - }, - "label_download_type": { - "title": "label_download_type", - "type": "string", - "enum": [ - "url", - "inline" - ], - "description": "There are two different ways to [download a label](https://www.shipengine.com/docs/labels/downloading/):\n\n|Label Download Type | Description\n|--------------------|------------------------------\n|`url` |You will receive a URL, which you can use to download the label in a separate request. The URL will remain valid for 90 days.

This is the default if `label_download_type` is unspecified.\n|`inline` |You will receive the Base64-encoded label as part of the response. No need for a second request to download the label.\n" - }, "tracking_status": { "title": "tracking_status", "type": "string", @@ -12537,49 +12884,6 @@ } } }, - "create_label_response_body": { - "title": "create_label_response_body", - "type": "object", - "description": "A create label response body", - "additionalProperties": false, - "required": [ - "label_id", - "status", - "shipment_id", - "ship_date", - "created_at", - "shipment_cost", - "insurance_cost", - "tracking_number", - "is_international", - "batch_id", - "carrier_id", - "service_code", - "voided", - "voided_at", - "label_image_id", - "label_format", - "label_layout", - "trackable", - "carrier_code", - "tracking_status", - "label_download", - "form_download", - "paperless_download", - "insurance_claim", - "packages", - "is_return_label", - "rma_number", - "charge_event", - "package_code", - "display_scheme" - ], - "allOf": [ - { - "$ref": "#/components/schemas/label" - } - ] - }, "get_label_by_external_shipment_id_response_body": { "title": "get_label_by_external_shipment_id_response_body", "type": "object", @@ -14173,7 +14477,7 @@ "$ref": "#/components/schemas/shipment_id_request" }, { - "$ref": "#/components/schemas/shipment_request" + "$ref": "#/components/schemas/rate_shipment_request" } ], "allOf": [ @@ -14196,8 +14500,8 @@ } } }, - "shipment_request": { - "title": "shipment_request", + "rate_shipment_request": { + "title": "rate_shipment_request", "type": "object", "properties": { "shipment": {