public bool Convert() { using (RESTCall wc = new RESTCall()) { string url = this.accessToken.Audience + "api/v1/file/v2t"; wc.Headers.Add("ntx-token", ntxToken.ntxToken); var resbyte = wc.UploadFile(url, "POST", this.mp3file); var res = System.Text.Encoding.UTF8.GetString(resbyte); converted = true; this.Raw = res; this.Chunks = RawToChunks(this.Raw); this.Terms = ChunksToTerms(this.Chunks); } return(true); }
/// <summary>Create new HTTP request with json payload.</summary> /// <param name="baseURL">Request base URL</param> /// <param name="urlFormData">Request call data, endpoint and json payload</param> /// <returns>Task for request</returns> public async Task <HttpResponseMessage> NewRequestAsync(string baseURL, RESTCall callData) { HttpRequestMessage request = new HttpRequestMessage() { RequestUri = new Uri(baseURL + callData.Endpoint), Method = HttpMethod.Post, }; request.Headers.Add("X-CENTRIFY-NATIVE-CLIENT", "true"); request.Headers.Add("X-CFY-SRC", "ccli"); if (AuthValue.Length > 2) { request.Headers.Add("Authorization", "Bearer " + AuthValue); } StringContent content = new StringContent(callData.JsonTemplate, Encoding.UTF8, "application/json"); request.Content = content; return(await m_client.SendAsync(request)); }