public NameValueCollection ToNameValueCollection(TCAPIVersion version) { NameValueCollection nvc = new NameValueCollection(); TinCanJsonConverter converter = new TinCanJsonConverter(); if (!string.IsNullOrEmpty(verb)) nvc["verb"] = verb.ToLower(); if (targetObject != null) nvc["object"] = converter.SerializeToJSON(targetObject); if (!string.IsNullOrEmpty(registration)) nvc["registration"] = registration; nvc["context"] = context.ToString(); if (actor != null) switch( version) { case TCAPIVersion.TinCan090: nvc["actor"] = converter.SerializeToJSON((Model.TinCan090.Actor)actor); break; default: nvc["actor"] = converter.SerializeToJSON(actor); break; } if (since != null) nvc["since"] = since.Value.ToString(); if (until != null) nvc["until"] = until.Value.ToString(); nvc["limit"] = limit.ToString(); nvc["authoritative"] = authoritative.ToString(); nvc["sparse"] = sparse.ToString(); if (instructor != null) nvc["instructor"] = converter.SerializeToJSON(instructor); nvc["ascending"] = ascending.ToString(); if (!string.IsNullOrEmpty(continueToken)) nvc["continueToken"] = continueToken; nvc["historical"] = historical.ToString(); return nvc; }
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; }