public static void Run() { var configuration = new Configuration { AppSid = Common.MyAppSid, AppKey = Common.MyAppKey }; var apiInstance = new ClassificationApi(configuration); try { var request = new GetSupportedFileFormatsRequest(); // Get supported file formats results FormatCollection response = apiInstance.GetSupportedFileFormats(request); foreach (Format formatval in response.Formats) { Console.WriteLine("FileFormat: " + formatval.FileFormat + " Ext: " + formatval.Extension); } } catch (Exception e) { Console.WriteLine("Exception while calling ClassificationApi: " + e.Message); } }
/// <summary> /// Retrieves list of supported file formats. /// </summary> /// <param name="request">Request. <see cref="GetSupportedFileFormatsRequest" /></param> /// <returns><see cref="FormatCollection"/></returns> public FormatCollection GetSupportedFileFormats(GetSupportedFileFormatsRequest request) { // create path and map variables var resourcePath = this.configuration.GetApiRootUrl() + "/classification/formats"; resourcePath = Regex .Replace(resourcePath, "\\*", string.Empty) .Replace("&", "&") .Replace("/?", "?"); try { var response = this.apiInvoker.InvokeApi( resourcePath, "GET", null, null, null); if (response != null) { return((FormatCollection)SerializationHelper.Deserialize(response, typeof(FormatCollection))); } return(null); } catch (ApiException ex) { if (ex.ErrorCode == 404) { return(null); } throw; } }
public void GetSupportedFileFormatsTest() { var request = new GetSupportedFileFormatsRequest(); var response = ViewerApi.GetSupportedFileFormats(request); Assert.IsTrue(response.Formats.Count > 0); foreach (var entry in response.Formats) { Assert.IsNotEmpty(entry.Extension); Assert.IsNotEmpty(entry.FileFormat); } }
/// <summary> /// Retrieves list of supported file formats. /// </summary> /// <param name="request">Request. <see cref="GetSupportedFileFormatsRequest" /></param> /// <returns><see cref="FileFormatsResponse"/></returns> public FileFormatsResponse GetSupportedFileFormats(GetSupportedFileFormatsRequest request) { // create path and map variables var resourcePath = this.configuration.GetApiRootUrl() + "/assembly/formats"; resourcePath = Regex .Replace(resourcePath, "\\*", string.Empty) .Replace("&", "&") .Replace("/?", "?"); var response = this.apiInvoker.InvokeApi( resourcePath, "GET", null, null, null); if (response != null) { return((FileFormatsResponse)SerializationHelper.Deserialize(response, typeof(FileFormatsResponse))); } return(null); }