Skip to content

Commit

Permalink
feat (DEVEXP-96): Add generated sources
Browse files Browse the repository at this point in the history
  • Loading branch information
JPPortier committed Dec 15, 2023
1 parent 82d160c commit 4a53d76
Show file tree
Hide file tree
Showing 65 changed files with 13,334 additions and 0 deletions.

Large diffs are not rendered by default.

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);
}
}
Loading

0 comments on commit 4a53d76

Please sign in to comment.