ToParameterMap() public method

public ToParameterMap ( TinCan.TCAPIVersion version ) : String>.Dictionary
version TinCan.TCAPIVersion
return String>.Dictionary
示例#1
0
        public async Task <StatementsResultLrsResponse> QueryStatementsAsync(StatementsQuery query)
        {
            var r = new StatementsResultLrsResponse();

            var req = new MyHttpRequest
            {
                Method      = "GET",
                Resource    = "statements",
                QueryParams = query.ToParameterMap(Version)
            };

            var res = await MakeRequest(req);

            if (res.Status != HttpStatusCode.OK)
            {
                r.Success       = false;
                r.HttpException = res.Ex;
                r.SetErrMsgFromBytes(res.Content);
                return(r);
            }

            r.Success = true;
            r.Content = new StatementsResult(new Json.StringOfJson(Encoding.UTF8.GetString(res.Content)));

            return(r);
        }
示例#2
0
        public async Task <StatementsResultLRSResponse> QueryStatements(StatementsQuery query)
        {
            var r = new StatementsResultLRSResponse();

            var req = new MyHTTPRequest();

            req.method      = HttpMethod.Get;
            req.resource    = "statements";
            req.queryParams = query.ToParameterMap(version);

            var res = await MakeRequest(req);

            if (res.status != HttpStatusCode.OK)
            {
                r.success       = false;
                r.httpException = res.ex;
                r.SetErrMsgFromBytes(res.content, (int)res.status);
                return(r);
            }

            r.success = true;
            r.content = new StatementsResult(new Json.StringOfJSON(Encoding.UTF8.GetString(res.content, 0, res.content.Length)));

            return(r);
        }
示例#3
0
        public StatementsResultLRSResponse QueryStatements(StatementsQuery query)
        {
            var r = new StatementsResultLRSResponse();

            var req = new MyHTTPRequest();
            req.method = "GET";
            req.resource = "statements";
            req.queryParams = query.ToParameterMap(version);

            var res = MakeSyncRequest(req);
            if (res.status != HttpStatusCode.OK)
            {
                r.success = false;
                r.httpException = res.ex;
                r.SetErrMsgFromBytes(res.content);
                return r;
            }

            r.success = true;
            r.content = new StatementsResult(new Json.StringOfJSON(Encoding.UTF8.GetString(res.content)));

            return r;
        }