public DocumentIdentifier DocumentAddFile(string documentUri, byte[] fileContent, string filename) { IRequest request = new ClientHttpPostRequest <byte[]>(_environment, _responseParser, documentUri + "/files?filename=" + HttpUtility.UrlEncode(filename), fileContent); IResponse response = _client.SendRequest(request); DocumentIdentifier document = _responseParser.FromJsonString <DocumentIdentifier>(response.ResponseContent); return(document); }
public IRequest AddAuthenticationHeaders(IRequest request) { IResponse response = GetTokenResponse(); if (response.IsSuccessStatusCode()) { Token token = _responseParser.FromJsonString <Token>(response.ResponseContent); request.HttpRequestMessage.Headers.Authorization = new AuthenticationHeaderValue($"{token.token_type} {token.access_token}"); return(request); } else { throw new Exception("Getting token failed"); } }