Cloudmersive / Cloudmersive.APIClient.Apex.VirusScan

Cloudmersive API Client for Apex for Virus Scan API
Apache License 2.0
1 stars 0 forks source link

getting lots of errors running the provided code #2

Open njay22 opened 3 years ago

njay22 commented 3 years ago

Following the instructions given on [(https://api.cloudmersive.com/salesforce-apex-client.asp)], 'virus' tab we ran the following code through Anonymous Editor:

`SwagScanApi api = new SwagScanApi(); SwagClient client = api.getClient();

// Configure API key authorization: Apikey ApiKeyAuth Apikey = (ApiKeyAuth) client.getAuthentication('Apikey'); Apikey.setApiKey('YOUR API KEY');

Map params = new Map{ 'inputFile' => Blob.valueOf('Sample text file\nContents') };

try { // cross your fingers SwagVirusScanResult result = api.scanFile(params); System.debug(result); } catch (Swagger.ApiException e) { // ...handle your exceptions }`

  1. This gives error because Map is supposed to be declared as Map<string,Object). We fixed that.
  2. Then get error that 'Invalid type: ApiKeyAuth'. We fixed that by using 'Swagger.ApiKeyAuth'
  3. Then get the error "System.CalloutException: no protocol: "callout:virusapi/virus/scan/file"" - which makes sense because in swagger.invoke(...) it is hardcoding the endpoint to the above ("callout:virusapi/virus/scan/file") (in methods toPath and to Endpoint) - need to remove the extra double quotes in the start and end

Please advise why these errors are appearing as we are using the files as provided

anaWHO commented 1 week ago

Has this issue been fixed? I encounter the same errors when installing the SDK for Salesforce.