-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat (DEVEXP-96): Add generated sources
- Loading branch information
Showing
65 changed files
with
13,334 additions
and
0 deletions.
There are no files selected for viewing
434 changes: 434 additions & 0 deletions
434
openapi-contracts/src/main/com/sinch/sdk/domains/voice/adapters/api/v1/ApplicationsApi.java
Large diffs are not rendered by default.
Oops, something went wrong.
116 changes: 116 additions & 0 deletions
116
openapi-contracts/src/main/com/sinch/sdk/domains/voice/adapters/api/v1/CalloutsApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
/* | ||
* Voice API | Sinch | ||
* The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. | ||
* | ||
* The version of the OpenAPI document: 1.0.1 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
package com.sinch.sdk.domains.voice.adapters.api.v1; | ||
|
||
import com.fasterxml.jackson.core.type.TypeReference; | ||
import com.sinch.sdk.core.exceptions.ApiException; | ||
import com.sinch.sdk.core.exceptions.ApiExceptionBuilder; | ||
import com.sinch.sdk.core.http.AuthManager; | ||
import com.sinch.sdk.core.http.HttpClient; | ||
import com.sinch.sdk.core.http.HttpMapper; | ||
import com.sinch.sdk.core.http.HttpMethod; | ||
import com.sinch.sdk.core.http.HttpRequest; | ||
import com.sinch.sdk.core.http.HttpResponse; | ||
import com.sinch.sdk.core.http.HttpStatus; | ||
import com.sinch.sdk.core.http.URLParameter; | ||
import com.sinch.sdk.core.models.ServerConfiguration; | ||
import com.sinch.sdk.domains.voice.models.dto.v1.CalloutRequestDto; | ||
import com.sinch.sdk.domains.voice.models.dto.v1.GetCalloutResponseObjDto; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.Collection; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.logging.Logger; | ||
|
||
// @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") | ||
public class CalloutsApi { | ||
|
||
private static final Logger LOGGER = Logger.getLogger(CalloutsApi.class.getName()); | ||
private HttpClient httpClient; | ||
private ServerConfiguration serverConfiguration; | ||
private Map<String, AuthManager> authManagersByOasSecuritySchemes; | ||
private HttpMapper mapper; | ||
|
||
public CalloutsApi( | ||
HttpClient httpClient, | ||
ServerConfiguration serverConfiguration, | ||
Map<String, AuthManager> authManagersByOasSecuritySchemes, | ||
HttpMapper mapper) { | ||
this.httpClient = httpClient; | ||
this.serverConfiguration = serverConfiguration; | ||
this.authManagersByOasSecuritySchemes = authManagersByOasSecuritySchemes; | ||
this.mapper = mapper; | ||
} | ||
|
||
/** | ||
* Callout Request Makes a call out to a phone number. The types of callouts currently supported | ||
* are conference callouts, text-to-speech callouts, and custom callouts. The custom callout is | ||
* the most flexible, but text-to-speech and conference callouts are more convenient. | ||
* | ||
* @param calloutRequestDto (optional) | ||
* @return GetCalloutResponseObjDto | ||
* @throws ApiException if fails to make API call | ||
*/ | ||
public GetCalloutResponseObjDto callouts(CalloutRequestDto calloutRequestDto) | ||
throws ApiException { | ||
|
||
LOGGER.finest("[callouts]" + " " + "calloutRequestDto: " + calloutRequestDto); | ||
|
||
HttpRequest httpRequest = calloutsRequestBuilder(calloutRequestDto); | ||
HttpResponse response = | ||
httpClient.invokeAPI( | ||
this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); | ||
|
||
if (HttpStatus.isSuccessfulStatus(response.getCode())) { | ||
TypeReference<GetCalloutResponseObjDto> localVarReturnType = | ||
new TypeReference<GetCalloutResponseObjDto>() {}; | ||
return mapper.deserialize(response, localVarReturnType); | ||
} | ||
// fallback to default errors handling: | ||
// all error cases definition are not required from specs: will try some "hardcoded" content | ||
// parsing | ||
throw ApiExceptionBuilder.build( | ||
response.getMessage(), | ||
response.getCode(), | ||
mapper.deserialize(response, new TypeReference<HashMap<String, ?>>() {})); | ||
} | ||
|
||
private HttpRequest calloutsRequestBuilder(CalloutRequestDto calloutRequestDto) | ||
throws ApiException { | ||
|
||
String localVarPath = "/calling/v1/callouts"; | ||
|
||
List<URLParameter> localVarQueryParams = new ArrayList<>(); | ||
|
||
Map<String, String> localVarHeaderParams = new HashMap<>(); | ||
|
||
final Collection<String> localVarAccepts = Arrays.asList("application/json"); | ||
|
||
final Collection<String> localVarContentTypes = Arrays.asList("application/json"); | ||
|
||
final Collection<String> localVarAuthNames = Arrays.asList("Basic", "Signed"); | ||
final String serializedBody = mapper.serialize(localVarContentTypes, calloutRequestDto); | ||
|
||
return new HttpRequest( | ||
localVarPath, | ||
HttpMethod.POST, | ||
localVarQueryParams, | ||
serializedBody, | ||
localVarHeaderParams, | ||
localVarAccepts, | ||
localVarContentTypes, | ||
localVarAuthNames); | ||
} | ||
} |
Oops, something went wrong.