Exemplo n.º 1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="type">The type</param>
 /// <param name="propertyId">The property id</param>
 /// <param name="dataValue">The data value</param>
 public Snak(string type, EntityId propertyId, DataValue dataValue)
 {
     if (propertyId.prefix != "p")
     {
          throw new ArgumentException("propertyId must be a valid property id", "propertyId");
     }
     this.type = type;
     this.propertyId = propertyId;
     this.dataValue = dataValue;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Set a claim value.
 /// </summary>
 /// <param name="claim">GUID identifying the claim</param>
 /// <param name="snakType">The type of the snak</param>
 /// <param name="value">The value of the snak when creating a claim with a snak that has a value</param>
 /// <param name="baseRevisionId">The numeric identifier for the revision to base the modification on</param>
 /// <param name="summary">The summary for the change</param>
 /// <returns>The result</returns>
 internal JsonObject setClaimValue(string claim, string snakType, DataValue value, int baseRevisionId, string summary)
 {
     Dictionary<string, string> parameters = new Dictionary<string, string>()
     {
         { "action", "wbsetclaimvalue" },
         { "claim", claim },
         { "snaktype", snakType }
     };
     if (value != null)
     {
         parameters["value"] = value.encode().ToString();
     }
     return this.editAction(parameters, new Dictionary<string, string>(), baseRevisionId, summary);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Create a claim.
 /// </summary>
 /// <param name="entity">The id of the entity you are adding the claim to</param>
 /// <param name="snakType">The type of the snak</param>
 /// <param name="property">The id of the snak property</param>
 /// <param name="value">The value of the snak when creating a claim with a snak that has a value</param>
 /// <param name="baseRevisionId">The numeric identifier for the revision to base the modification on</param>
 /// <param name="summary">The summary for the change</param>
 /// <returns>The result</returns>
 internal JsonObject createClaim(string entity, string snakType, string property, DataValue value, int baseRevisionId, string summary)
 {
     Dictionary<string, string> parameters = new Dictionary<string, string>()
     {
         { "action", "wbcreateclaim" },
         { "entity", entity },
         { "snaktype", snakType },
         { "property", property }
     };
     if (value != null)
     {
         parameters["value"] = value.encode().ToString();
     }
     return this.editAction(parameters, new Dictionary<string, string>(), baseRevisionId, summary);
 }