Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Contract" /> class.
 /// </summary>
 /// <param name="competitorId">The Smarkets competitor model id.</param>
 /// <param name="contractType">contractType.</param>
 /// <param name="created">When was the contract created in the Smarkets exchange (required).</param>
 /// <param name="displayOrder">Smarkets will display the contracts sorted by these values, in descending order.</param>
 /// <param name="hidden">Hidden contracts aren&#x27;t displayed in our website.</param>
 /// <param name="id">This ID uniquely identifies the contract (required).</param>
 /// <param name="info">info.</param>
 /// <param name="marketId">This ID uniquely identifies the market (required).</param>
 /// <param name="modified">The datetime of the last modification made by Smarkets to the&lt;br&gt; contract properties (required).</param>
 /// <param name="name">Name for the contract, as displayed in our website.&lt;br&gt; Examples can be team names, horse names or other winning outcomes for each market.&lt;br&gt; It should not be used to identify the contract.&lt;br&gt; The contract_type field should be used instead. (required).</param>
 /// <param name="outcomeTimestamp">If the contract has settled, this will have the settlement datetime, null otherwise (required).</param>
 /// <param name="reductionFactor">reductionFactor.</param>
 /// <param name="slug">Slug concisely represents the contract.&lt;br&gt; It should not be used to identify the contract.&lt;br&gt; The contract_type field should be used instead. (required).</param>
 /// <param name="stateOrOutcome"> state_or_outcome can have the following values: &lt;ul&gt; &lt;li&gt;new: The contract was just created and is still not available for betting &lt;li&gt;open: open for betting &lt;li&gt;live: open and trading live in-play &lt;li&gt;halted: Trading on this contract has halted &lt;li&gt;winner: settled as winner. &lt;li&gt;loser:  settled as loser. &lt;li&gt;deadheat: settled as a deadheat - a tie with other contract. &lt;li&gt;reduced: withdrawn and a reduction factor was applied. &lt;li&gt;voided: no longer available for betting &lt;li&gt;unavailable: not currently available for betting &lt;/ul&gt;      (required).</param>
 public Contract(int?competitorId = default(int?), ContractsResponseContractType contractType = default(ContractsResponseContractType), DateTime?created = default(DateTime?), int?displayOrder = default(int?), bool?hidden = default(bool?), string id = default(string), ContractsResponseInfo info = default(ContractsResponseInfo), string marketId = default(string), DateTime?modified = default(DateTime?), string name = default(string), DateTime?outcomeTimestamp = default(DateTime?), string reductionFactor = default(string), string slug = default(string), StateOrOutcomeEnum stateOrOutcome = default(StateOrOutcomeEnum))
 {
     // to ensure "created" is required (not null)
     if (created == null)
     {
         throw new InvalidDataException("created is a required property for Contract and cannot be null");
     }
     else
     {
         this.Created = created;
     }
     // to ensure "id" is required (not null)
     if (id == null)
     {
         throw new InvalidDataException("id is a required property for Contract and cannot be null");
     }
     else
     {
         this.Id = id;
     }
     // to ensure "marketId" is required (not null)
     if (marketId == null)
     {
         throw new InvalidDataException("marketId is a required property for Contract and cannot be null");
     }
     else
     {
         this.MarketId = marketId;
     }
     // to ensure "modified" is required (not null)
     if (modified == null)
     {
         throw new InvalidDataException("modified is a required property for Contract and cannot be null");
     }
     else
     {
         this.Modified = modified;
     }
     // to ensure "name" is required (not null)
     if (name == null)
     {
         throw new InvalidDataException("name is a required property for Contract and cannot be null");
     }
     else
     {
         this.Name = name;
     }
     // to ensure "outcomeTimestamp" is required (not null)
     if (outcomeTimestamp == null)
     {
         this.OutcomeTimestamp = outcomeTimestamp;
         //throw new InvalidDataException("outcomeTimestamp is a required property for Contract and cannot be null");
     }
     else
     {
         this.OutcomeTimestamp = outcomeTimestamp;
     }
     // to ensure "slug" is required (not null)
     if (slug == null)
     {
         throw new InvalidDataException("slug is a required property for Contract and cannot be null");
     }
     else
     {
         this.Slug = slug;
     }
     // to ensure "stateOrOutcome" is required (not null)
     if (stateOrOutcome == null)
     {
         throw new InvalidDataException("stateOrOutcome is a required property for Contract and cannot be null");
     }
     else
     {
         this.StateOrOutcome = stateOrOutcome;
     }
     this.CompetitorId    = competitorId;
     this.ContractType    = contractType;
     this.DisplayOrder    = displayOrder;
     this.Hidden          = hidden;
     this.Info            = info;
     this.ReductionFactor = reductionFactor;
 }