mirror of
https://github.com/Tribufu/TribufuDotNet
synced 2026-08-09 21:01:07 +00:00
* Migrate to new tribufu project structure * Update .gitignore * Remove old api files * Update Directory.Build.props * Rename solution
207 lines
7.5 KiB
C#
207 lines
7.5 KiB
C#
/*
|
|
* Tribufu API
|
|
*
|
|
* API to access Tribufu services.
|
|
*
|
|
* The version of the OpenAPI document: 1.4.3
|
|
* Contact: contact@tribufu.com
|
|
* Generated by: https://github.com/openapitools/openapi-generator.git
|
|
*/
|
|
|
|
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Linq;
|
|
using System.IO;
|
|
using System.Runtime.Serialization;
|
|
using System.Text;
|
|
using System.Text.RegularExpressions;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Converters;
|
|
using Newtonsoft.Json.Linq;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
|
|
|
|
namespace Tribufu.Model
|
|
{
|
|
/// <summary>
|
|
/// Product
|
|
/// </summary>
|
|
[DataContract(Name = "Product")]
|
|
public partial class Product : IValidatableObject
|
|
{
|
|
|
|
/// <summary>
|
|
/// Gets or Sets Type
|
|
/// </summary>
|
|
[DataMember(Name = "type", EmitDefaultValue = false)]
|
|
public ProductType? Type { get; set; }
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="Product" /> class.
|
|
/// </summary>
|
|
[JsonConstructorAttribute]
|
|
protected Product() { }
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="Product" /> class.
|
|
/// </summary>
|
|
/// <param name="id">id.</param>
|
|
/// <param name="name">name (required).</param>
|
|
/// <param name="sku">sku.</param>
|
|
/// <param name="description">description.</param>
|
|
/// <param name="type">type.</param>
|
|
/// <param name="slug">slug.</param>
|
|
/// <param name="imageUrl">imageUrl.</param>
|
|
/// <param name="prices">prices.</param>
|
|
/// <param name="createdAt">createdAt.</param>
|
|
/// <param name="updatedAt">updatedAt.</param>
|
|
/// <param name="deletedAt">deletedAt.</param>
|
|
public Product(string id = default(string), string name = default(string), string sku = default(string), string description = default(string), ProductType? type = default(ProductType?), string slug = default(string), string imageUrl = default(string), List<ProductPrice> prices = default(List<ProductPrice>), DateTime createdAt = default(DateTime), DateTime? updatedAt = default(DateTime?), DateTime? deletedAt = default(DateTime?))
|
|
{
|
|
// to ensure "name" is required (not null)
|
|
if (name == null)
|
|
{
|
|
throw new ArgumentNullException("name is a required property for Product and cannot be null");
|
|
}
|
|
this.Name = name;
|
|
this.Id = id;
|
|
this.Sku = sku;
|
|
this.Description = description;
|
|
this.Type = type;
|
|
this.Slug = slug;
|
|
this.ImageUrl = imageUrl;
|
|
this.Prices = prices;
|
|
this.CreatedAt = createdAt;
|
|
this.UpdatedAt = updatedAt;
|
|
this.DeletedAt = deletedAt;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets or Sets Id
|
|
/// </summary>
|
|
[DataMember(Name = "id", EmitDefaultValue = false)]
|
|
public string Id { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or Sets Name
|
|
/// </summary>
|
|
[DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)]
|
|
public string Name { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or Sets Sku
|
|
/// </summary>
|
|
[DataMember(Name = "sku", EmitDefaultValue = true)]
|
|
public string Sku { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or Sets Description
|
|
/// </summary>
|
|
[DataMember(Name = "description", EmitDefaultValue = true)]
|
|
public string Description { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or Sets Slug
|
|
/// </summary>
|
|
[DataMember(Name = "slug", EmitDefaultValue = true)]
|
|
public string Slug { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or Sets ImageUrl
|
|
/// </summary>
|
|
[DataMember(Name = "image_url", EmitDefaultValue = true)]
|
|
public string ImageUrl { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or Sets Prices
|
|
/// </summary>
|
|
[DataMember(Name = "prices", EmitDefaultValue = true)]
|
|
public List<ProductPrice> Prices { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or Sets CreatedAt
|
|
/// </summary>
|
|
[DataMember(Name = "created_at", EmitDefaultValue = false)]
|
|
public DateTime CreatedAt { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or Sets UpdatedAt
|
|
/// </summary>
|
|
[DataMember(Name = "updated_at", EmitDefaultValue = true)]
|
|
public DateTime? UpdatedAt { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or Sets DeletedAt
|
|
/// </summary>
|
|
[DataMember(Name = "deleted_at", EmitDefaultValue = true)]
|
|
public DateTime? DeletedAt { get; set; }
|
|
|
|
/// <summary>
|
|
/// Returns the string presentation of the object
|
|
/// </summary>
|
|
/// <returns>String presentation of the object</returns>
|
|
public override string ToString()
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.Append("class Product {\n");
|
|
sb.Append(" Id: ").Append(Id).Append("\n");
|
|
sb.Append(" Name: ").Append(Name).Append("\n");
|
|
sb.Append(" Sku: ").Append(Sku).Append("\n");
|
|
sb.Append(" Description: ").Append(Description).Append("\n");
|
|
sb.Append(" Type: ").Append(Type).Append("\n");
|
|
sb.Append(" Slug: ").Append(Slug).Append("\n");
|
|
sb.Append(" ImageUrl: ").Append(ImageUrl).Append("\n");
|
|
sb.Append(" Prices: ").Append(Prices).Append("\n");
|
|
sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n");
|
|
sb.Append(" UpdatedAt: ").Append(UpdatedAt).Append("\n");
|
|
sb.Append(" DeletedAt: ").Append(DeletedAt).Append("\n");
|
|
sb.Append("}\n");
|
|
return sb.ToString();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns the JSON string presentation of the object
|
|
/// </summary>
|
|
/// <returns>JSON string presentation of the object</returns>
|
|
public virtual string ToJson()
|
|
{
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
|
}
|
|
|
|
/// <summary>
|
|
/// To validate all properties of the instance
|
|
/// </summary>
|
|
/// <param name="validationContext">Validation context</param>
|
|
/// <returns>Validation Result</returns>
|
|
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
|
|
{
|
|
// Name (string) maxLength
|
|
if (this.Name != null && this.Name.Length > 75)
|
|
{
|
|
yield return new ValidationResult("Invalid value for Name, length must be less than 75.", new [] { "Name" });
|
|
}
|
|
|
|
// Sku (string) maxLength
|
|
if (this.Sku != null && this.Sku.Length > 75)
|
|
{
|
|
yield return new ValidationResult("Invalid value for Sku, length must be less than 75.", new [] { "Sku" });
|
|
}
|
|
|
|
// Slug (string) maxLength
|
|
if (this.Slug != null && this.Slug.Length > 75)
|
|
{
|
|
yield return new ValidationResult("Invalid value for Slug, length must be less than 75.", new [] { "Slug" });
|
|
}
|
|
|
|
// ImageUrl (string) maxLength
|
|
if (this.ImageUrl != null && this.ImageUrl.Length > 255)
|
|
{
|
|
yield return new ValidationResult("Invalid value for ImageUrl, length must be less than 255.", new [] { "ImageUrl" });
|
|
}
|
|
|
|
yield break;
|
|
}
|
|
}
|
|
|
|
}
|