Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] Docstrings, part 2 #461

Merged
merged 9 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions EasyPost/Models/API/Address.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,66 +10,154 @@

namespace EasyPost.Models.API
{
/// <summary>
/// Class representing an <a href="https://www.easypost.com/docs/api#address-object">EasyPost address</a>.
/// </summary>
public class Address : EasyPostObject, IAddressParameter
{
#region JSON Properties

/// <summary>
/// The specific designation for the address (only relevant if the address is a carrier facility).
/// </summary>
[JsonProperty("carrier_facility")]
public string? CarrierFacility { get; set; }

/// <summary>
/// The city the address is located in.
/// </summary>
[JsonProperty("city")]
public string? City { get; set; }

/// <summary>
/// The name of the company.
/// </summary>
[JsonProperty("company")]
public string? Company { get; set; }

/// <summary>
/// The ISO 3166 code of the country the address is located in.
/// </summary>
[JsonProperty("country")]
public string? Country { get; set; }

/// <summary>
/// The email address of the person or organization.
/// </summary>
[JsonProperty("email")]
public string? Email { get; set; }

/// <summary>
/// Potential error encountered while processing the address.
/// </summary>
[JsonProperty("error")]
public string? Error { get; set; }

/// <summary>
/// The federal tax ID of the person or organization.
/// </summary>
[JsonProperty("federal_tax_id")]
public string? FederalTaxId { get; set; }

/// <summary>
/// A human-readable message for any errors that occurred during the address's life cycle.
/// </summary>
[JsonProperty("message")]
public string? Message { get; set; }

/// <summary>
/// The name of the person or organization.
/// </summary>
[JsonProperty("name")]
public string? Name { get; set; }

/// <summary>
/// The phone number of the person or organization.
/// </summary>
[JsonProperty("phone")]
public string? Phone { get; set; }

/// <summary>
/// Whether the address is a residential address.
/// </summary>
[JsonProperty("residential")]
public bool? Residential { get; set; }

/// <summary>
/// The state the address is located in.
/// </summary>
[JsonProperty("state")]
public string? State { get; set; }

/// <summary>
/// The state tax ID of the person or organization.
/// </summary>
[JsonProperty("state_tax_id")]
public string? StateTaxId { get; set; }

/// <summary>
/// The first line of the street address.
/// </summary>
[JsonProperty("street1")]
public string? Street1 { get; set; }

/// <summary>
/// The second line of the street address.
/// </summary>
[JsonProperty("street2")]
public string? Street2 { get; set; }

/// <summary>
/// The result of any verifications.
/// </summary>
[JsonProperty("verifications")]
public Verifications? Verifications { get; set; }

/// <summary>
/// The zip code the address is located in.
/// </summary>
[JsonProperty("zip")]
public string? Zip { get; set; }

#endregion

/// <summary>
/// Initializes a new instance of the <see cref="Address"/> class.
/// </summary>
internal Address()
{
}
}

/// <summary>
/// Class representing a collection of EasyPost <see cref="Address"/>es.
/// </summary>
public class AddressCollection : PaginatedCollection<Address>
{
#region JSON Properties

/// <summary>
/// The <see cref="Address"/>es in the collection.
/// </summary>
[JsonProperty("addresses")]
public List<Address>? Addresses { get; set; }

#endregion

/// <summary>
/// Initializes a new instance of the <see cref="AddressCollection"/> class.
/// </summary>
internal AddressCollection()
{
}

/// <summary>
/// Construct the parameter set for retrieving the next page of this paginated collection.
/// </summary>
/// <param name="entries">The entries on the current page of this paginated collection.</param>
/// <param name="pageSize">The request size of the next page.</param>
/// <typeparam name="TParameters">The type of parameters to construct.</typeparam>
/// <returns>A TParameters-type parameters set.</returns>
protected internal override TParameters BuildNextPageParameters<TParameters>(IEnumerable<Address> entries, int? pageSize = null)
{
BetaFeatures.Parameters.Addresses.All parameters = Filters != null ? (BetaFeatures.Parameters.Addresses.All)Filters : new BetaFeatures.Parameters.Addresses.All();
Expand Down
21 changes: 21 additions & 0 deletions EasyPost/Models/API/ApiKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,53 @@

namespace EasyPost.Models.API
{
/// <summary>
/// Class representing an <a href="https://www.easypost.com/docs/api#api-key-object">EasyPost API key</a>.
/// </summary>
public class ApiKey : EasyPostObject
{
#region JSON Properties

/// <summary>
/// The actual key value to use for authentication.
/// </summary>
[JsonProperty("key")]
public string? Key { get; set; }

#endregion

/// <summary>
/// Initializes a new instance of the <see cref="ApiKey"/> class.
/// </summary>
internal ApiKey()
{
}
}

/// <summary>
/// Class representing a collection of EasyPost <see cref="ApiKey"/>s.
/// </summary>
public class ApiKeyCollection : EasyPostObject
{
#region JSON Properties

/// <summary>
/// A list of all child user's API keys.
/// </summary>
[JsonProperty("children")]
public List<ApiKeyCollection>? Children { get; set; }

/// <summary>
/// A lis of all API keys active for the current user's account.
/// </summary>
[JsonProperty("keys")]
public List<ApiKey>? Keys { get; set; }

#endregion

/// <summary>
/// Initializes a new instance of the <see cref="ApiKeyCollection"/> class.
/// </summary>
internal ApiKeyCollection()
{
}
Expand Down
75 changes: 74 additions & 1 deletion EasyPost/Models/API/Batch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,49 +10,122 @@

namespace EasyPost.Models.API
{
public class Batch : EasyPostObject, IBatchParameter
/// <summary>
/// Class representing an <a href="https://www.easypost.com/docs/api#batch-object">EasyPost batch</a>.
/// </summary>
public class Batch : EasyPostObject
{
#region JSON Properties

/// <summary>
/// Potential error encountered while processing the batch.
/// </summary>
[JsonProperty("error")]
public string? Error { get; set; }

/// <summary>
/// The URL of the label image.
/// </summary>
[JsonProperty("label_url")]
public string? LabelUrl { get; set; }

/// <summary>
/// A human-readable message for any errors that occurred during the batch's life cycle.
/// </summary>
[JsonProperty("message")]
public string? Message { get; set; }

/// <summary>
/// The number of shipments in the batch.
/// </summary>
[JsonProperty("num_shipments")]
public int? NumShipments { get; set; }

/// <summary>
/// An optional field that may be used in place of ID in some API endpoints.
/// </summary>
[JsonProperty("reference")]
public string? Reference { get; set; }

/// <summary>
/// The <see cref="ScanForm"/> associated with the batch.
/// </summary>
[JsonProperty("scan_form")]
public ScanForm? ScanForm { get; set; }

/// <summary>
/// The <see cref="BatchShipment"/>s associated with the batch.
/// </summary>
[JsonProperty("shipments")]
public List<BatchShipment>? Shipments { get; set; }

/// <summary>
/// The current state of the batch.
/// Possible values include: "creating", "creation_failed", "created", "purchasing", "purchase_failed", "purchased", "label_generating" and "label_generated".
/// </summary>
[JsonProperty("state")]
public string? State { get; set; }

/// <summary>
/// A dictionary of <see cref="BatchShipment"/> statuses and their counts.
/// Valid statuses are:
/// <list type="bullet">
/// <item>
/// <description>"postage_purchased"</description>
/// </item>
/// <item>
/// <description>"postage_purchase_failed"</description>
/// </item>
/// <item>
/// <description>"queued_for_purchase"</description>
/// </item>
/// <item>
/// <description>"creation_failed"</description>
/// </item>
/// </list>
/// </summary>
[JsonProperty("status")]
public Dictionary<string, int>? Status { get; set; }

#endregion

/// <summary>
/// Initializes a new instance of the <see cref="Batch"/> class.
/// </summary>
internal Batch()
{
}
}

/// <summary>
/// Class representing a collection of EasyPost <see cref="Batch"/>es.
/// </summary>
public class BatchCollection : PaginatedCollection<Batch>
{
#region JSON Properties

/// <summary>
/// The <see cref="Batch"/>es in the collection.
/// </summary>
[JsonProperty("batches")]
public List<Batch>? Batches { get; set; }

#endregion

/// <summary>
/// Initializes a new instance of the <see cref="BatchCollection"/> class.
/// </summary>
internal BatchCollection()
{
}

/// <summary>
/// Construct the parameter set for retrieving the next page of this paginated collection.
/// </summary>
/// <param name="entries">The entries on the current page of this paginated collection.</param>
/// <param name="pageSize">The request size of the next page.</param>
/// <typeparam name="TParameters">The type of parameters to construct.</typeparam>
/// <returns>A TParameters-type parameters set.</returns>
protected internal override TParameters BuildNextPageParameters<TParameters>(IEnumerable<Batch> entries, int? pageSize = null)
{
BetaFeatures.Parameters.Shipments.All parameters = Filters != null ? (BetaFeatures.Parameters.Shipments.All)Filters : new BetaFeatures.Parameters.Shipments.All();
Expand Down
32 changes: 32 additions & 0 deletions EasyPost/Models/API/BatchShipment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,51 @@

namespace EasyPost.Models.API
{
/// <summary>
/// Class representing an <a href="https://www.easypost.com/docs/api#batch-shipment-object">EasyPost batch shipment</a>.
/// </summary>
public class BatchShipment : EasyPostObject
{
#region JSON Properties

/// <summary>
/// A human-readable message for any errors that occurred during the batch shipment's life cycle.
/// </summary>
[JsonProperty("batch_message")]
public string? BatchMessage { get; set; }

/// <summary>
/// The current state of the batch shipment.
/// Valid statuses are:
/// <list type="bullet">
/// <item>
/// <description>"postage_purchased"</description>
/// </item>
/// <item>
/// <description>"postage_purchase_failed"</description>
/// </item>
/// <item>
/// <description>"queued_for_purchase"</description>
/// </item>
/// <item>
/// <description>"creation_failed"</description>
/// </item>
/// </list>
/// </summary>
[JsonProperty("batch_status")]
public string? BatchStatus { get; set; }

/// <summary>
/// The tracking code associated with the batch shipment.
/// </summary>
[JsonProperty("tracking_code")]
public string? TrackingCode { get; set; }

#endregion

/// <summary>
/// Initializes a new instance of the <see cref="BatchShipment"/> class.
/// </summary>
internal BatchShipment()
{
}
Expand Down
Loading