ToNameValueCollection() public method

Transforms the Query object into a NameValueCollection, which will be transformed into a query string.
public ToNameValueCollection ( TCAPIVersion version ) : NameValueCollection
version TCAPIVersion The TCAPI Version to serialize the statement as.
return System.Collections.Specialized.NameValueCollection
Esempio n. 1
0
 private WebHeaderCollection GetWebHeaders()
 {
     WebHeaderCollection whc;
     StatementQueryObject qo = new StatementQueryObject();
     qo.Limit = 1;
     NameValueCollection nvc = qo.ToNameValueCollection(version);
     HttpMethods.GetRequest(nvc, endpoint + STATEMENTS, authentification, out whc, "0.95");
     return whc;
 }
Esempio n. 2
0
 /// <summary>
 /// Retreives all statements based matched by the query
 /// </summary>
 /// <param name="queryObject">Object to create a statement query with</param>
 /// <returns>A StatementResult with all the statements</returns>
 public StatementResult GetStatements(StatementQueryObject queryObject)
 {
     NameValueCollection nvc = queryObject.ToNameValueCollection(version);
     string resultAsJSON = HttpMethods.GetRequest(nvc, endpoint + STATEMENTS, authentification, versionString);
     TinCanJsonConverter converter = new TinCanJsonConverter();
     StatementResult result = null;
     switch (version)
     {
         case TCAPIVersion.TinCan095:
             result = (StatementResult)converter.DeserializeJSON(resultAsJSON, typeof(StatementResult));
             break;
         case TCAPIVersion.TinCan090:
             result = (StatementResult)((Model.TinCan090.StatementResult)converter.DeserializeJSON(resultAsJSON, typeof(Model.TinCan090.StatementResult)));
             break;
     }
     return result;
 }
 private static WebHeaderCollection GetWebHeaders(Uri endPoint, IAuthenticationConfiguration authentication, TCAPIVersion version)
 {
     WebHeaderCollection whc;
     var qo = new StatementQueryObject { Limit = 1 };
     NameValueCollection nvc = qo.ToNameValueCollection(version);
     HttpMethods.GetRequest(nvc, endPoint + STATEMENTS, authentication, out whc, "0.95");
     return whc;
 }