private async Task <LrsResponse> DeleteDocument(string resource, Dictionary <string, string> queryParams) { var r = new LrsResponse(); var req = new MyHttpRequest { Method = "DELETE", Resource = resource, QueryParams = queryParams }; var res = await MakeRequest(req); if (res.Status != HttpStatusCode.NoContent) { r.Success = false; r.HttpException = res.Ex; r.SetErrMsgFromBytes(res.Content); return(r); } r.Success = true; return(r); }
private async Task <LrsResponse> SaveDocument(string resource, Dictionary <string, string> queryParams, Document document) { var r = new LrsResponse(); var req = new MyHttpRequest { Method = "PUT", Resource = resource, QueryParams = queryParams, ContentType = document.ContentType, Content = document.Content }; if (!string.IsNullOrEmpty(document.Etag)) { req.Headers = new Dictionary <string, string> { { "If-Match", document.Etag } }; } else { req.Headers = new Dictionary <string, string> { { "If-None-Match", "*" } }; } var res = await MakeRequest(req); if (res.Status != HttpStatusCode.NoContent) { r.Success = false; r.HttpException = res.Ex; r.SetErrMsgFromBytes(res.Content); return(r); } r.Success = true; return(r); }