mirror of
https://github.com/taigrr/elevenlabs.git
synced 2026-04-01 18:58:52 -07:00
initial commit from swagger base
This commit is contained in:
518
api_history.go
Normal file
518
api_history.go
Normal file
@@ -0,0 +1,518 @@
|
||||
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"fmt"
|
||||
"github.com/antihax/optional"
|
||||
)
|
||||
|
||||
// Linger please
|
||||
var (
|
||||
_ context.Context
|
||||
)
|
||||
|
||||
type HistoryApiService service
|
||||
/*
|
||||
HistoryApiService Delete History Item
|
||||
Delete a history item by its ID
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param historyItemId History item ID to be used, you can use GET https://api.elevenlabs.io/v1/history to receive a list of history items and their IDs.
|
||||
* @param optional nil or *HistoryApiDeleteHistoryItemV1HistoryHistoryItemIdDeleteOpts - Optional Parameters:
|
||||
* @param "XiApiKey" (optional.String) - Your API key. This is required by most endpoints to access our API programatically. You can view your xi-api-key using the 'Profile' tab on the website.
|
||||
@return Object
|
||||
*/
|
||||
|
||||
type HistoryApiDeleteHistoryItemV1HistoryHistoryItemIdDeleteOpts struct {
|
||||
XiApiKey optional.String
|
||||
}
|
||||
|
||||
func (a *HistoryApiService) DeleteHistoryItemV1HistoryHistoryItemIdDelete(ctx context.Context, historyItemId string, localVarOptionals *HistoryApiDeleteHistoryItemV1HistoryHistoryItemIdDeleteOpts) (Object, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Delete")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue Object
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/v1/history/{history_item_id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"history_item_id"+"}", fmt.Sprintf("%v", historyItemId), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals.XiApiKey.IsSet() {
|
||||
localVarHeaderParams["xi-api-key"] = parameterToString(localVarOptionals.XiApiKey.Value(), "")
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v Object
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 422 {
|
||||
var v HttpValidationError
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
/*
|
||||
HistoryApiService Delete History Items
|
||||
Delete a number of history items by their IDs.
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param body
|
||||
* @param optional nil or *HistoryApiDeleteHistoryItemsV1HistoryDeletePostOpts - Optional Parameters:
|
||||
* @param "XiApiKey" (optional.String) - Your API key. This is required by most endpoints to access our API programatically. You can view your xi-api-key using the 'Profile' tab on the website.
|
||||
@return Object
|
||||
*/
|
||||
|
||||
type HistoryApiDeleteHistoryItemsV1HistoryDeletePostOpts struct {
|
||||
XiApiKey optional.String
|
||||
}
|
||||
|
||||
func (a *HistoryApiService) DeleteHistoryItemsV1HistoryDeletePost(ctx context.Context, body BodyDeleteHistoryItemsV1HistoryDeletePost, localVarOptionals *HistoryApiDeleteHistoryItemsV1HistoryDeletePostOpts) (Object, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue Object
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/v1/history/delete"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{"application/json"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals.XiApiKey.IsSet() {
|
||||
localVarHeaderParams["xi-api-key"] = parameterToString(localVarOptionals.XiApiKey.Value(), "")
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = &body
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v Object
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 422 {
|
||||
var v HttpValidationError
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
/*
|
||||
HistoryApiService Download History Items
|
||||
Download one or more history items. If one history item ID is provided, we will return a single audio file. If more than one history item IDs are provided, we will provide the history items packed into a .zip file.
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param body
|
||||
* @param optional nil or *HistoryApiDownloadHistoryItemsV1HistoryDownloadPostOpts - Optional Parameters:
|
||||
* @param "XiApiKey" (optional.String) - Your API key. This is required by most endpoints to access our API programatically. You can view your xi-api-key using the 'Profile' tab on the website.
|
||||
|
||||
*/
|
||||
|
||||
type HistoryApiDownloadHistoryItemsV1HistoryDownloadPostOpts struct {
|
||||
XiApiKey optional.String
|
||||
}
|
||||
|
||||
func (a *HistoryApiService) DownloadHistoryItemsV1HistoryDownloadPost(ctx context.Context, body BodyDownloadHistoryItemsV1HistoryDownloadPost, localVarOptionals *HistoryApiDownloadHistoryItemsV1HistoryDownloadPostOpts) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/v1/history/download"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{"application/json"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals.XiApiKey.IsSet() {
|
||||
localVarHeaderParams["xi-api-key"] = parameterToString(localVarOptionals.XiApiKey.Value(), "")
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = &body
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 422 {
|
||||
var v HttpValidationError
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
/*
|
||||
HistoryApiService Get Audio From History Item
|
||||
Returns the audio of an history item.
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param historyItemId History item ID to be used, you can use GET https://api.elevenlabs.io/v1/history to receive a list of history items and their IDs.
|
||||
* @param optional nil or *HistoryApiGetAudioFromHistoryItemV1HistoryHistoryItemIdAudioGetOpts - Optional Parameters:
|
||||
* @param "XiApiKey" (optional.String) - Your API key. This is required by most endpoints to access our API programatically. You can view your xi-api-key using the 'Profile' tab on the website.
|
||||
|
||||
*/
|
||||
|
||||
type HistoryApiGetAudioFromHistoryItemV1HistoryHistoryItemIdAudioGetOpts struct {
|
||||
XiApiKey optional.String
|
||||
}
|
||||
|
||||
func (a *HistoryApiService) GetAudioFromHistoryItemV1HistoryHistoryItemIdAudioGet(ctx context.Context, historyItemId string, localVarOptionals *HistoryApiGetAudioFromHistoryItemV1HistoryHistoryItemIdAudioGetOpts) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/v1/history/{history_item_id}/audio"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"history_item_id"+"}", fmt.Sprintf("%v", historyItemId), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"audio/mpeg", "application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals.XiApiKey.IsSet() {
|
||||
localVarHeaderParams["xi-api-key"] = parameterToString(localVarOptionals.XiApiKey.Value(), "")
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 422 {
|
||||
var v HttpValidationError
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
/*
|
||||
HistoryApiService Get Generated Items
|
||||
Returns metadata about all your generated audio.
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param optional nil or *HistoryApiGetGeneratedItemsV1HistoryGetOpts - Optional Parameters:
|
||||
* @param "XiApiKey" (optional.String) - Your API key. This is required by most endpoints to access our API programatically. You can view your xi-api-key using the 'Profile' tab on the website.
|
||||
@return GetHistoryResponseModel
|
||||
*/
|
||||
|
||||
type HistoryApiGetGeneratedItemsV1HistoryGetOpts struct {
|
||||
XiApiKey optional.String
|
||||
}
|
||||
|
||||
func (a *HistoryApiService) GetGeneratedItemsV1HistoryGet(ctx context.Context, localVarOptionals *HistoryApiGetGeneratedItemsV1HistoryGetOpts) (GetHistoryResponseModel, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue GetHistoryResponseModel
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/v1/history"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals.XiApiKey.IsSet() {
|
||||
localVarHeaderParams["xi-api-key"] = parameterToString(localVarOptionals.XiApiKey.Value(), "")
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v GetHistoryResponseModel
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 422 {
|
||||
var v HttpValidationError
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
224
api_samples.go
Normal file
224
api_samples.go
Normal file
@@ -0,0 +1,224 @@
|
||||
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"fmt"
|
||||
"github.com/antihax/optional"
|
||||
)
|
||||
|
||||
// Linger please
|
||||
var (
|
||||
_ context.Context
|
||||
)
|
||||
|
||||
type SamplesApiService service
|
||||
/*
|
||||
SamplesApiService Delete Sample
|
||||
Removes a sample by its ID.
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param voiceId Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices.
|
||||
* @param sampleId Sample ID to be used, you can use GET https://api.elevenlabs.io/v1/voices/{voice_id} to list all the available samples for a voice.
|
||||
* @param optional nil or *SamplesApiDeleteSampleV1VoicesVoiceIdSamplesSampleIdDeleteOpts - Optional Parameters:
|
||||
* @param "XiApiKey" (optional.String) - Your API key. This is required by most endpoints to access our API programatically. You can view your xi-api-key using the 'Profile' tab on the website.
|
||||
@return Object
|
||||
*/
|
||||
|
||||
type SamplesApiDeleteSampleV1VoicesVoiceIdSamplesSampleIdDeleteOpts struct {
|
||||
XiApiKey optional.String
|
||||
}
|
||||
|
||||
func (a *SamplesApiService) DeleteSampleV1VoicesVoiceIdSamplesSampleIdDelete(ctx context.Context, voiceId string, sampleId string, localVarOptionals *SamplesApiDeleteSampleV1VoicesVoiceIdSamplesSampleIdDeleteOpts) (Object, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Delete")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue Object
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/v1/voices/{voice_id}/samples/{sample_id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"voice_id"+"}", fmt.Sprintf("%v", voiceId), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"sample_id"+"}", fmt.Sprintf("%v", sampleId), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals.XiApiKey.IsSet() {
|
||||
localVarHeaderParams["xi-api-key"] = parameterToString(localVarOptionals.XiApiKey.Value(), "")
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v Object
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 422 {
|
||||
var v HttpValidationError
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
/*
|
||||
SamplesApiService Get Audio From Sample
|
||||
Returns the audio corresponding to a sample attached to a voice.
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param voiceId Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices.
|
||||
* @param sampleId Sample ID to be used, you can use GET https://api.elevenlabs.io/v1/voices/{voice_id} to list all the available samples for a voice.
|
||||
* @param optional nil or *SamplesApiGetAudioFromSampleV1VoicesVoiceIdSamplesSampleIdAudioGetOpts - Optional Parameters:
|
||||
* @param "XiApiKey" (optional.String) - Your API key. This is required by most endpoints to access our API programatically. You can view your xi-api-key using the 'Profile' tab on the website.
|
||||
|
||||
*/
|
||||
|
||||
type SamplesApiGetAudioFromSampleV1VoicesVoiceIdSamplesSampleIdAudioGetOpts struct {
|
||||
XiApiKey optional.String
|
||||
}
|
||||
|
||||
func (a *SamplesApiService) GetAudioFromSampleV1VoicesVoiceIdSamplesSampleIdAudioGet(ctx context.Context, voiceId string, sampleId string, localVarOptionals *SamplesApiGetAudioFromSampleV1VoicesVoiceIdSamplesSampleIdAudioGetOpts) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/v1/voices/{voice_id}/samples/{sample_id}/audio"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"voice_id"+"}", fmt.Sprintf("%v", voiceId), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"sample_id"+"}", fmt.Sprintf("%v", sampleId), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"audio/_*", "application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals.XiApiKey.IsSet() {
|
||||
localVarHeaderParams["xi-api-key"] = parameterToString(localVarOptionals.XiApiKey.Value(), "")
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 422 {
|
||||
var v HttpValidationError
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
209
api_text_to_speech.go
Normal file
209
api_text_to_speech.go
Normal file
@@ -0,0 +1,209 @@
|
||||
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"fmt"
|
||||
"github.com/antihax/optional"
|
||||
)
|
||||
|
||||
// Linger please
|
||||
var (
|
||||
_ context.Context
|
||||
)
|
||||
|
||||
type TextToSpeechApiService service
|
||||
/*
|
||||
TextToSpeechApiService Text To Speech
|
||||
Converts text into speech using a voice of your choice and returns audio.
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param body
|
||||
* @param voiceId Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices.
|
||||
* @param optional nil or *TextToSpeechApiTextToSpeechV1TextToSpeechVoiceIdPostOpts - Optional Parameters:
|
||||
* @param "XiApiKey" (optional.String) - Your API key. This is required by most endpoints to access our API programatically. You can view your xi-api-key using the 'Profile' tab on the website.
|
||||
|
||||
*/
|
||||
|
||||
type TextToSpeechApiTextToSpeechV1TextToSpeechVoiceIdPostOpts struct {
|
||||
XiApiKey optional.String
|
||||
}
|
||||
|
||||
func (a *TextToSpeechApiService) TextToSpeechV1TextToSpeechVoiceIdPost(ctx context.Context, body BodyTextToSpeechV1TextToSpeechVoiceIdPost, voiceId string, localVarOptionals *TextToSpeechApiTextToSpeechV1TextToSpeechVoiceIdPostOpts) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/v1/text-to-speech/{voice_id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"voice_id"+"}", fmt.Sprintf("%v", voiceId), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{"application/json"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"audio/mpeg", "application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals.XiApiKey.IsSet() {
|
||||
localVarHeaderParams["xi-api-key"] = parameterToString(localVarOptionals.XiApiKey.Value(), "")
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = &body
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 422 {
|
||||
var v HttpValidationError
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
/*
|
||||
TextToSpeechApiService Text To Speech
|
||||
Converts text into speech using a voice of your choice and returns audio as an audio stream.
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param body
|
||||
* @param voiceId Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices.
|
||||
* @param optional nil or *TextToSpeechApiTextToSpeechV1TextToSpeechVoiceIdStreamPostOpts - Optional Parameters:
|
||||
* @param "XiApiKey" (optional.String) - Your API key. This is required by most endpoints to access our API programatically. You can view your xi-api-key using the 'Profile' tab on the website.
|
||||
|
||||
*/
|
||||
|
||||
type TextToSpeechApiTextToSpeechV1TextToSpeechVoiceIdStreamPostOpts struct {
|
||||
XiApiKey optional.String
|
||||
}
|
||||
|
||||
func (a *TextToSpeechApiService) TextToSpeechV1TextToSpeechVoiceIdStreamPost(ctx context.Context, body BodyTextToSpeechV1TextToSpeechVoiceIdStreamPost, voiceId string, localVarOptionals *TextToSpeechApiTextToSpeechV1TextToSpeechVoiceIdStreamPostOpts) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/v1/text-to-speech/{voice_id}/stream"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"voice_id"+"}", fmt.Sprintf("%v", voiceId), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{"application/json"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals.XiApiKey.IsSet() {
|
||||
localVarHeaderParams["xi-api-key"] = parameterToString(localVarOptionals.XiApiKey.Value(), "")
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = &body
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 422 {
|
||||
var v HttpValidationError
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
232
api_user.go
Normal file
232
api_user.go
Normal file
@@ -0,0 +1,232 @@
|
||||
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"github.com/antihax/optional"
|
||||
)
|
||||
|
||||
// Linger please
|
||||
var (
|
||||
_ context.Context
|
||||
)
|
||||
|
||||
type UserApiService service
|
||||
/*
|
||||
UserApiService Get User Info
|
||||
Gets information about the user
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param optional nil or *UserApiGetUserInfoV1UserGetOpts - Optional Parameters:
|
||||
* @param "XiApiKey" (optional.String) - Your API key. This is required by most endpoints to access our API programatically. You can view your xi-api-key using the 'Profile' tab on the website.
|
||||
@return UserResponseModel
|
||||
*/
|
||||
|
||||
type UserApiGetUserInfoV1UserGetOpts struct {
|
||||
XiApiKey optional.String
|
||||
}
|
||||
|
||||
func (a *UserApiService) GetUserInfoV1UserGet(ctx context.Context, localVarOptionals *UserApiGetUserInfoV1UserGetOpts) (UserResponseModel, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue UserResponseModel
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/v1/user"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals.XiApiKey.IsSet() {
|
||||
localVarHeaderParams["xi-api-key"] = parameterToString(localVarOptionals.XiApiKey.Value(), "")
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v UserResponseModel
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 422 {
|
||||
var v HttpValidationError
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
/*
|
||||
UserApiService Get User Subscription Info
|
||||
Gets extended information about the users subscription
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param optional nil or *UserApiGetUserSubscriptionInfoV1UserSubscriptionGetOpts - Optional Parameters:
|
||||
* @param "XiApiKey" (optional.String) - Your API key. This is required by most endpoints to access our API programatically. You can view your xi-api-key using the 'Profile' tab on the website.
|
||||
@return ExtendedSubscriptionResponseModel
|
||||
*/
|
||||
|
||||
type UserApiGetUserSubscriptionInfoV1UserSubscriptionGetOpts struct {
|
||||
XiApiKey optional.String
|
||||
}
|
||||
|
||||
func (a *UserApiService) GetUserSubscriptionInfoV1UserSubscriptionGet(ctx context.Context, localVarOptionals *UserApiGetUserSubscriptionInfoV1UserSubscriptionGetOpts) (ExtendedSubscriptionResponseModel, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue ExtendedSubscriptionResponseModel
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/v1/user/subscription"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals.XiApiKey.IsSet() {
|
||||
localVarHeaderParams["xi-api-key"] = parameterToString(localVarOptionals.XiApiKey.Value(), "")
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v ExtendedSubscriptionResponseModel
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 422 {
|
||||
var v HttpValidationError
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
865
api_voices.go
Normal file
865
api_voices.go
Normal file
@@ -0,0 +1,865 @@
|
||||
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"fmt"
|
||||
"github.com/antihax/optional"
|
||||
)
|
||||
|
||||
// Linger please
|
||||
var (
|
||||
_ context.Context
|
||||
)
|
||||
|
||||
type VoicesApiService service
|
||||
/*
|
||||
VoicesApiService Add Voice
|
||||
Add a new voice to your collection of voices in VoiceLab.
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param name
|
||||
* @param files
|
||||
* @param description
|
||||
* @param labels
|
||||
* @param optional nil or *VoicesApiAddVoiceV1VoicesAddPostOpts - Optional Parameters:
|
||||
* @param "XiApiKey" (optional.String) - Your API key. This is required by most endpoints to access our API programatically. You can view your xi-api-key using the 'Profile' tab on the website.
|
||||
@return AddVoiceResponseModel
|
||||
*/
|
||||
|
||||
type VoicesApiAddVoiceV1VoicesAddPostOpts struct {
|
||||
XiApiKey optional.String
|
||||
}
|
||||
|
||||
func (a *VoicesApiService) AddVoiceV1VoicesAddPost(ctx context.Context, name string, files []*os.File, description string, labels string, localVarOptionals *VoicesApiAddVoiceV1VoicesAddPostOpts) (AddVoiceResponseModel, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue AddVoiceResponseModel
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/v1/voices/add"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{"multipart/form-data"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals.XiApiKey.IsSet() {
|
||||
localVarHeaderParams["xi-api-key"] = parameterToString(localVarOptionals.XiApiKey.Value(), "")
|
||||
}
|
||||
localVarFormParams.Add("name", parameterToString(name, ""))
|
||||
localVarFormParams.Add("files", parameterToString(files, "multi"))
|
||||
localVarFormParams.Add("description", parameterToString(description, ""))
|
||||
localVarFormParams.Add("labels", parameterToString(labels, ""))
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v AddVoiceResponseModel
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 422 {
|
||||
var v HttpValidationError
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
/*
|
||||
VoicesApiService Delete Voice
|
||||
Deletes a voice by its ID.
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param voiceId Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices.
|
||||
* @param optional nil or *VoicesApiDeleteVoiceV1VoicesVoiceIdDeleteOpts - Optional Parameters:
|
||||
* @param "XiApiKey" (optional.String) - Your API key. This is required by most endpoints to access our API programatically. You can view your xi-api-key using the 'Profile' tab on the website.
|
||||
@return Object
|
||||
*/
|
||||
|
||||
type VoicesApiDeleteVoiceV1VoicesVoiceIdDeleteOpts struct {
|
||||
XiApiKey optional.String
|
||||
}
|
||||
|
||||
func (a *VoicesApiService) DeleteVoiceV1VoicesVoiceIdDelete(ctx context.Context, voiceId string, localVarOptionals *VoicesApiDeleteVoiceV1VoicesVoiceIdDeleteOpts) (Object, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Delete")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue Object
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/v1/voices/{voice_id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"voice_id"+"}", fmt.Sprintf("%v", voiceId), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals.XiApiKey.IsSet() {
|
||||
localVarHeaderParams["xi-api-key"] = parameterToString(localVarOptionals.XiApiKey.Value(), "")
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v Object
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 422 {
|
||||
var v HttpValidationError
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
/*
|
||||
VoicesApiService Edit Voice Settings
|
||||
Edit your settings for a specific voice. \"similarity_boost\" corresponds to\"Clarity + Similarity Enhancement\" in the web app and \"stability\" corresponds to \"Stability\" slider in the web app.
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param body
|
||||
* @param voiceId Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices.
|
||||
* @param optional nil or *VoicesApiEditVoiceSettingsV1VoicesVoiceIdSettingsEditPostOpts - Optional Parameters:
|
||||
* @param "XiApiKey" (optional.String) - Your API key. This is required by most endpoints to access our API programatically. You can view your xi-api-key using the 'Profile' tab on the website.
|
||||
@return Object
|
||||
*/
|
||||
|
||||
type VoicesApiEditVoiceSettingsV1VoicesVoiceIdSettingsEditPostOpts struct {
|
||||
XiApiKey optional.String
|
||||
}
|
||||
|
||||
func (a *VoicesApiService) EditVoiceSettingsV1VoicesVoiceIdSettingsEditPost(ctx context.Context, body Settings, voiceId string, localVarOptionals *VoicesApiEditVoiceSettingsV1VoicesVoiceIdSettingsEditPostOpts) (Object, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue Object
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/v1/voices/{voice_id}/settings/edit"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"voice_id"+"}", fmt.Sprintf("%v", voiceId), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{"application/json"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals.XiApiKey.IsSet() {
|
||||
localVarHeaderParams["xi-api-key"] = parameterToString(localVarOptionals.XiApiKey.Value(), "")
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = &body
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v Object
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 422 {
|
||||
var v HttpValidationError
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
/*
|
||||
VoicesApiService Edit Voice
|
||||
Edit a voice created by you.
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param name
|
||||
* @param files
|
||||
* @param description
|
||||
* @param labels
|
||||
* @param voiceId Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices.
|
||||
* @param optional nil or *VoicesApiEditVoiceV1VoicesVoiceIdEditPostOpts - Optional Parameters:
|
||||
* @param "XiApiKey" (optional.String) - Your API key. This is required by most endpoints to access our API programatically. You can view your xi-api-key using the 'Profile' tab on the website.
|
||||
@return Object
|
||||
*/
|
||||
|
||||
type VoicesApiEditVoiceV1VoicesVoiceIdEditPostOpts struct {
|
||||
XiApiKey optional.String
|
||||
}
|
||||
|
||||
func (a *VoicesApiService) EditVoiceV1VoicesVoiceIdEditPost(ctx context.Context, name string, files []*os.File, description string, labels string, voiceId string, localVarOptionals *VoicesApiEditVoiceV1VoicesVoiceIdEditPostOpts) (Object, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue Object
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/v1/voices/{voice_id}/edit"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"voice_id"+"}", fmt.Sprintf("%v", voiceId), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{"multipart/form-data"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals.XiApiKey.IsSet() {
|
||||
localVarHeaderParams["xi-api-key"] = parameterToString(localVarOptionals.XiApiKey.Value(), "")
|
||||
}
|
||||
localVarFormParams.Add("name", parameterToString(name, ""))
|
||||
localVarFormParams.Add("files", parameterToString(files, "multi"))
|
||||
localVarFormParams.Add("description", parameterToString(description, ""))
|
||||
localVarFormParams.Add("labels", parameterToString(labels, ""))
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v Object
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 422 {
|
||||
var v HttpValidationError
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
/*
|
||||
VoicesApiService Get Default Voice Settings.
|
||||
Gets the default settings for voices. \"similarity_boost\" corresponds to\"Clarity + Similarity Enhancement\" in the web app and \"stability\" corresponds to \"Stability\" slider in the web app.
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@return VoiceSettingsResponseModel
|
||||
*/
|
||||
func (a *VoicesApiService) GetDefaultVoiceSettingsV1VoicesSettingsDefaultGet(ctx context.Context) (VoiceSettingsResponseModel, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue VoiceSettingsResponseModel
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/v1/voices/settings/default"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v VoiceSettingsResponseModel
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
/*
|
||||
VoicesApiService Get Voice Settings
|
||||
Returns the settings for a specific voice. \"similarity_boost\" corresponds to\"Clarity + Similarity Enhancement\" in the web app and \"stability\" corresponds to \"Stability\" slider in the web app.
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param voiceId Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices.
|
||||
* @param optional nil or *VoicesApiGetVoiceSettingsV1VoicesVoiceIdSettingsGetOpts - Optional Parameters:
|
||||
* @param "XiApiKey" (optional.String) - Your API key. This is required by most endpoints to access our API programatically. You can view your xi-api-key using the 'Profile' tab on the website.
|
||||
@return VoiceSettingsResponseModel
|
||||
*/
|
||||
|
||||
type VoicesApiGetVoiceSettingsV1VoicesVoiceIdSettingsGetOpts struct {
|
||||
XiApiKey optional.String
|
||||
}
|
||||
|
||||
func (a *VoicesApiService) GetVoiceSettingsV1VoicesVoiceIdSettingsGet(ctx context.Context, voiceId string, localVarOptionals *VoicesApiGetVoiceSettingsV1VoicesVoiceIdSettingsGetOpts) (VoiceSettingsResponseModel, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue VoiceSettingsResponseModel
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/v1/voices/{voice_id}/settings"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"voice_id"+"}", fmt.Sprintf("%v", voiceId), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals.XiApiKey.IsSet() {
|
||||
localVarHeaderParams["xi-api-key"] = parameterToString(localVarOptionals.XiApiKey.Value(), "")
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v VoiceSettingsResponseModel
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 422 {
|
||||
var v HttpValidationError
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
/*
|
||||
VoicesApiService Get Voice
|
||||
Returns metadata about a specific voice.
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param voiceId Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices.
|
||||
* @param optional nil or *VoicesApiGetVoiceV1VoicesVoiceIdGetOpts - Optional Parameters:
|
||||
* @param "WithSettings" (optional.Bool) - If set will return settings information corresponding to the voice, requires authorization.
|
||||
* @param "XiApiKey" (optional.String) - Your API key. This is required by most endpoints to access our API programatically. You can view your xi-api-key using the 'Profile' tab on the website.
|
||||
@return VoiceResponseModel
|
||||
*/
|
||||
|
||||
type VoicesApiGetVoiceV1VoicesVoiceIdGetOpts struct {
|
||||
WithSettings optional.Bool
|
||||
XiApiKey optional.String
|
||||
}
|
||||
|
||||
func (a *VoicesApiService) GetVoiceV1VoicesVoiceIdGet(ctx context.Context, voiceId string, localVarOptionals *VoicesApiGetVoiceV1VoicesVoiceIdGetOpts) (VoiceResponseModel, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue VoiceResponseModel
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/v1/voices/{voice_id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"voice_id"+"}", fmt.Sprintf("%v", voiceId), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
if localVarOptionals != nil && localVarOptionals.WithSettings.IsSet() {
|
||||
localVarQueryParams.Add("with_settings", parameterToString(localVarOptionals.WithSettings.Value(), ""))
|
||||
}
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals.XiApiKey.IsSet() {
|
||||
localVarHeaderParams["xi-api-key"] = parameterToString(localVarOptionals.XiApiKey.Value(), "")
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v VoiceResponseModel
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 422 {
|
||||
var v HttpValidationError
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
/*
|
||||
VoicesApiService Get Voices
|
||||
Gets a list of all available voices for a user.
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param optional nil or *VoicesApiGetVoicesV1VoicesGetOpts - Optional Parameters:
|
||||
* @param "XiApiKey" (optional.String) - Your API key. This is required by most endpoints to access our API programatically. You can view your xi-api-key using the 'Profile' tab on the website.
|
||||
@return GetVoicesResponseModel
|
||||
*/
|
||||
|
||||
type VoicesApiGetVoicesV1VoicesGetOpts struct {
|
||||
XiApiKey optional.String
|
||||
}
|
||||
|
||||
func (a *VoicesApiService) GetVoicesV1VoicesGet(ctx context.Context, localVarOptionals *VoicesApiGetVoicesV1VoicesGetOpts) (GetVoicesResponseModel, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue GetVoicesResponseModel
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/v1/voices"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals.XiApiKey.IsSet() {
|
||||
localVarHeaderParams["xi-api-key"] = parameterToString(localVarOptionals.XiApiKey.Value(), "")
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v GetVoicesResponseModel
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 422 {
|
||||
var v HttpValidationError
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
485
client.go
Normal file
485
client.go
Normal file
@@ -0,0 +1,485 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"mime/multipart"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
var (
|
||||
jsonCheck = regexp.MustCompile("(?i:[application|text]/json)")
|
||||
xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)")
|
||||
)
|
||||
|
||||
// APIClient manages communication with the ElevenLabs API Documentation API v1.0
|
||||
// In most cases there should be only one, shared, APIClient.
|
||||
type APIClient struct {
|
||||
cfg *Configuration
|
||||
common service // Reuse a single struct instead of allocating one for each service on the heap.
|
||||
|
||||
// API Services
|
||||
|
||||
HistoryApi *HistoryApiService
|
||||
|
||||
SamplesApi *SamplesApiService
|
||||
|
||||
TextToSpeechApi *TextToSpeechApiService
|
||||
|
||||
UserApi *UserApiService
|
||||
|
||||
VoicesApi *VoicesApiService
|
||||
}
|
||||
|
||||
type service struct {
|
||||
client *APIClient
|
||||
}
|
||||
|
||||
// NewAPIClient creates a new API client. Requires a userAgent string describing your application.
|
||||
// optionally a custom http.Client to allow for advanced features such as caching.
|
||||
func NewAPIClient(cfg *Configuration) *APIClient {
|
||||
if cfg.HTTPClient == nil {
|
||||
cfg.HTTPClient = http.DefaultClient
|
||||
}
|
||||
|
||||
c := &APIClient{}
|
||||
c.cfg = cfg
|
||||
c.common.client = c
|
||||
|
||||
// API Services
|
||||
c.HistoryApi = (*HistoryApiService)(&c.common)
|
||||
c.SamplesApi = (*SamplesApiService)(&c.common)
|
||||
c.TextToSpeechApi = (*TextToSpeechApiService)(&c.common)
|
||||
c.UserApi = (*UserApiService)(&c.common)
|
||||
c.VoicesApi = (*VoicesApiService)(&c.common)
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
func atoi(in string) (int, error) {
|
||||
return strconv.Atoi(in)
|
||||
}
|
||||
|
||||
// selectHeaderContentType select a content type from the available list.
|
||||
func selectHeaderContentType(contentTypes []string) string {
|
||||
if len(contentTypes) == 0 {
|
||||
return ""
|
||||
}
|
||||
if contains(contentTypes, "application/json") {
|
||||
return "application/json"
|
||||
}
|
||||
return contentTypes[0] // use the first content type specified in 'consumes'
|
||||
}
|
||||
|
||||
// selectHeaderAccept join all accept types and return
|
||||
func selectHeaderAccept(accepts []string) string {
|
||||
if len(accepts) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
if contains(accepts, "application/json") {
|
||||
return "application/json"
|
||||
}
|
||||
|
||||
return strings.Join(accepts, ",")
|
||||
}
|
||||
|
||||
// contains is a case insenstive match, finding needle in a haystack
|
||||
func contains(haystack []string, needle string) bool {
|
||||
for _, a := range haystack {
|
||||
if strings.ToLower(a) == strings.ToLower(needle) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Verify optional parameters are of the correct type.
|
||||
func typeCheckParameter(obj interface{}, expected string, name string) error {
|
||||
// Make sure there is an object.
|
||||
if obj == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Check the type is as expected.
|
||||
if reflect.TypeOf(obj).String() != expected {
|
||||
return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// parameterToString convert interface{} parameters to string, using a delimiter if format is provided.
|
||||
func parameterToString(obj interface{}, collectionFormat string) string {
|
||||
var delimiter string
|
||||
|
||||
switch collectionFormat {
|
||||
case "pipes":
|
||||
delimiter = "|"
|
||||
case "ssv":
|
||||
delimiter = " "
|
||||
case "tsv":
|
||||
delimiter = "\t"
|
||||
case "csv":
|
||||
delimiter = ","
|
||||
}
|
||||
|
||||
if reflect.TypeOf(obj).Kind() == reflect.Slice {
|
||||
return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]")
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%v", obj)
|
||||
}
|
||||
|
||||
// callAPI do the request.
|
||||
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
|
||||
return c.cfg.HTTPClient.Do(request)
|
||||
}
|
||||
|
||||
// Change base path to allow switching to mocks
|
||||
func (c *APIClient) ChangeBasePath(path string) {
|
||||
c.cfg.BasePath = path
|
||||
}
|
||||
|
||||
// prepareRequest build the request
|
||||
func (c *APIClient) prepareRequest(
|
||||
ctx context.Context,
|
||||
path string, method string,
|
||||
postBody interface{},
|
||||
headerParams map[string]string,
|
||||
queryParams url.Values,
|
||||
formParams url.Values,
|
||||
fileName string,
|
||||
fileBytes []byte) (localVarRequest *http.Request, err error) {
|
||||
|
||||
var body *bytes.Buffer
|
||||
|
||||
// Detect postBody type and post.
|
||||
if postBody != nil {
|
||||
contentType := headerParams["Content-Type"]
|
||||
if contentType == "" {
|
||||
contentType = detectContentType(postBody)
|
||||
headerParams["Content-Type"] = contentType
|
||||
}
|
||||
|
||||
body, err = setBody(postBody, contentType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// add form parameters and file if available.
|
||||
if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") {
|
||||
if body != nil {
|
||||
return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
|
||||
}
|
||||
body = &bytes.Buffer{}
|
||||
w := multipart.NewWriter(body)
|
||||
|
||||
for k, v := range formParams {
|
||||
for _, iv := range v {
|
||||
if strings.HasPrefix(k, "@") { // file
|
||||
err = addFile(w, k[1:], iv)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else { // form value
|
||||
w.WriteField(k, iv)
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(fileBytes) > 0 && fileName != "" {
|
||||
w.Boundary()
|
||||
//_, fileNm := filepath.Split(fileName)
|
||||
part, err := w.CreateFormFile("file", filepath.Base(fileName))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_, err = part.Write(fileBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// Set the Boundary in the Content-Type
|
||||
headerParams["Content-Type"] = w.FormDataContentType()
|
||||
}
|
||||
|
||||
// Set Content-Length
|
||||
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
|
||||
w.Close()
|
||||
}
|
||||
|
||||
if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 {
|
||||
if body != nil {
|
||||
return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.")
|
||||
}
|
||||
body = &bytes.Buffer{}
|
||||
body.WriteString(formParams.Encode())
|
||||
// Set Content-Length
|
||||
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
|
||||
}
|
||||
|
||||
// Setup path and query parameters
|
||||
url, err := url.Parse(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Adding Query Param
|
||||
query := url.Query()
|
||||
for k, v := range queryParams {
|
||||
for _, iv := range v {
|
||||
query.Add(k, iv)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode the parameters.
|
||||
url.RawQuery = query.Encode()
|
||||
|
||||
// Generate a new request
|
||||
if body != nil {
|
||||
localVarRequest, err = http.NewRequest(method, url.String(), body)
|
||||
} else {
|
||||
localVarRequest, err = http.NewRequest(method, url.String(), nil)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// add header parameters, if any
|
||||
if len(headerParams) > 0 {
|
||||
headers := http.Header{}
|
||||
for h, v := range headerParams {
|
||||
headers.Set(h, v)
|
||||
}
|
||||
localVarRequest.Header = headers
|
||||
}
|
||||
|
||||
// Override request host, if applicable
|
||||
if c.cfg.Host != "" {
|
||||
localVarRequest.Host = c.cfg.Host
|
||||
}
|
||||
|
||||
// Add the user agent to the request.
|
||||
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
|
||||
|
||||
if ctx != nil {
|
||||
// add context to the request
|
||||
localVarRequest = localVarRequest.WithContext(ctx)
|
||||
|
||||
// Walk through any authentication.
|
||||
|
||||
// OAuth2 authentication
|
||||
if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok {
|
||||
// We were able to grab an oauth2 token from the context
|
||||
var latestToken *oauth2.Token
|
||||
if latestToken, err = tok.Token(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
latestToken.SetAuthHeader(localVarRequest)
|
||||
}
|
||||
|
||||
// Basic HTTP Authentication
|
||||
if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok {
|
||||
localVarRequest.SetBasicAuth(auth.UserName, auth.Password)
|
||||
}
|
||||
|
||||
// AccessToken Authentication
|
||||
if auth, ok := ctx.Value(ContextAccessToken).(string); ok {
|
||||
localVarRequest.Header.Add("Authorization", "Bearer "+auth)
|
||||
}
|
||||
}
|
||||
|
||||
for header, value := range c.cfg.DefaultHeader {
|
||||
localVarRequest.Header.Add(header, value)
|
||||
}
|
||||
|
||||
return localVarRequest, nil
|
||||
}
|
||||
|
||||
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
|
||||
if strings.Contains(contentType, "application/xml") {
|
||||
if err = xml.Unmarshal(b, v); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
} else if strings.Contains(contentType, "application/json") {
|
||||
if err = json.Unmarshal(b, v); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return errors.New("undefined response type")
|
||||
}
|
||||
|
||||
// Add a file to the multipart request
|
||||
func addFile(w *multipart.Writer, fieldName, path string) error {
|
||||
file, err := os.Open(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
part, err := w.CreateFormFile(fieldName, filepath.Base(path))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = io.Copy(part, file)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// Prevent trying to import "fmt"
|
||||
func reportError(format string, a ...interface{}) error {
|
||||
return fmt.Errorf(format, a...)
|
||||
}
|
||||
|
||||
// Set request body from an interface{}
|
||||
func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) {
|
||||
if bodyBuf == nil {
|
||||
bodyBuf = &bytes.Buffer{}
|
||||
}
|
||||
|
||||
if reader, ok := body.(io.Reader); ok {
|
||||
_, err = bodyBuf.ReadFrom(reader)
|
||||
} else if b, ok := body.([]byte); ok {
|
||||
_, err = bodyBuf.Write(b)
|
||||
} else if s, ok := body.(string); ok {
|
||||
_, err = bodyBuf.WriteString(s)
|
||||
} else if s, ok := body.(*string); ok {
|
||||
_, err = bodyBuf.WriteString(*s)
|
||||
} else if jsonCheck.MatchString(contentType) {
|
||||
err = json.NewEncoder(bodyBuf).Encode(body)
|
||||
} else if xmlCheck.MatchString(contentType) {
|
||||
xml.NewEncoder(bodyBuf).Encode(body)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if bodyBuf.Len() == 0 {
|
||||
err = fmt.Errorf("Invalid body type %s\n", contentType)
|
||||
return nil, err
|
||||
}
|
||||
return bodyBuf, nil
|
||||
}
|
||||
|
||||
// detectContentType method is used to figure out `Request.Body` content type for request header
|
||||
func detectContentType(body interface{}) string {
|
||||
contentType := "text/plain; charset=utf-8"
|
||||
kind := reflect.TypeOf(body).Kind()
|
||||
|
||||
switch kind {
|
||||
case reflect.Struct, reflect.Map, reflect.Ptr:
|
||||
contentType = "application/json; charset=utf-8"
|
||||
case reflect.String:
|
||||
contentType = "text/plain; charset=utf-8"
|
||||
default:
|
||||
if b, ok := body.([]byte); ok {
|
||||
contentType = http.DetectContentType(b)
|
||||
} else if kind == reflect.Slice {
|
||||
contentType = "application/json; charset=utf-8"
|
||||
}
|
||||
}
|
||||
|
||||
return contentType
|
||||
}
|
||||
|
||||
// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
|
||||
type cacheControl map[string]string
|
||||
|
||||
func parseCacheControl(headers http.Header) cacheControl {
|
||||
cc := cacheControl{}
|
||||
ccHeader := headers.Get("Cache-Control")
|
||||
for _, part := range strings.Split(ccHeader, ",") {
|
||||
part = strings.Trim(part, " ")
|
||||
if part == "" {
|
||||
continue
|
||||
}
|
||||
if strings.ContainsRune(part, '=') {
|
||||
keyval := strings.Split(part, "=")
|
||||
cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",")
|
||||
} else {
|
||||
cc[part] = ""
|
||||
}
|
||||
}
|
||||
return cc
|
||||
}
|
||||
|
||||
// CacheExpires helper function to determine remaining time before repeating a request.
|
||||
func CacheExpires(r *http.Response) time.Time {
|
||||
// Figure out when the cache expires.
|
||||
var expires time.Time
|
||||
now, err := time.Parse(time.RFC1123, r.Header.Get("date"))
|
||||
if err != nil {
|
||||
return time.Now()
|
||||
}
|
||||
respCacheControl := parseCacheControl(r.Header)
|
||||
|
||||
if maxAge, ok := respCacheControl["max-age"]; ok {
|
||||
lifetime, err := time.ParseDuration(maxAge + "s")
|
||||
if err != nil {
|
||||
expires = now
|
||||
}
|
||||
expires = now.Add(lifetime)
|
||||
} else {
|
||||
expiresHeader := r.Header.Get("Expires")
|
||||
if expiresHeader != "" {
|
||||
expires, err = time.Parse(time.RFC1123, expiresHeader)
|
||||
if err != nil {
|
||||
expires = now
|
||||
}
|
||||
}
|
||||
}
|
||||
return expires
|
||||
}
|
||||
|
||||
func strlen(s string) int {
|
||||
return utf8.RuneCountInString(s)
|
||||
}
|
||||
|
||||
// GenericSwaggerError Provides access to the body, error and model on returned errors.
|
||||
type GenericSwaggerError struct {
|
||||
body []byte
|
||||
error string
|
||||
model interface{}
|
||||
}
|
||||
|
||||
// Error returns non-empty string if there was an error.
|
||||
func (e GenericSwaggerError) Error() string {
|
||||
return e.error
|
||||
}
|
||||
|
||||
// Body returns the raw bytes of the response
|
||||
func (e GenericSwaggerError) Body() []byte {
|
||||
return e.body
|
||||
}
|
||||
|
||||
// Model returns the unpacked model of the error
|
||||
func (e GenericSwaggerError) Model() interface{} {
|
||||
return e.model
|
||||
}
|
||||
71
configuration.go
Normal file
71
configuration.go
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// contextKeys are used to identify the type of value in the context.
|
||||
// Since these are string, it is possible to get a short description of the
|
||||
// context key for logging and debugging using key.String().
|
||||
|
||||
type contextKey string
|
||||
|
||||
func (c contextKey) String() string {
|
||||
return "auth " + string(c)
|
||||
}
|
||||
|
||||
var (
|
||||
// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
|
||||
ContextOAuth2 = contextKey("token")
|
||||
|
||||
// ContextBasicAuth takes BasicAuth as authentication for the request.
|
||||
ContextBasicAuth = contextKey("basic")
|
||||
|
||||
// ContextAccessToken takes a string oauth2 access token as authentication for the request.
|
||||
ContextAccessToken = contextKey("accesstoken")
|
||||
|
||||
// ContextAPIKey takes an APIKey as authentication for the request
|
||||
ContextAPIKey = contextKey("apikey")
|
||||
)
|
||||
|
||||
// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
|
||||
type BasicAuth struct {
|
||||
UserName string `json:"userName,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
}
|
||||
|
||||
// APIKey provides API key based authentication to a request passed via context using ContextAPIKey
|
||||
type APIKey struct {
|
||||
Key string
|
||||
Prefix string
|
||||
}
|
||||
|
||||
type Configuration struct {
|
||||
BasePath string `json:"basePath,omitempty"`
|
||||
Host string `json:"host,omitempty"`
|
||||
Scheme string `json:"scheme,omitempty"`
|
||||
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
|
||||
UserAgent string `json:"userAgent,omitempty"`
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
func NewConfiguration() *Configuration {
|
||||
cfg := &Configuration{
|
||||
BasePath: "/",
|
||||
DefaultHeader: make(map[string]string),
|
||||
UserAgent: "Swagger-Codegen/1.0.0/go",
|
||||
}
|
||||
return cfg
|
||||
}
|
||||
|
||||
func (c *Configuration) AddDefaultHeader(key string, value string) {
|
||||
c.DefaultHeader[key] = value
|
||||
}
|
||||
13
model_add_voice_response_model.go
Normal file
13
model_add_voice_response_model.go
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type AddVoiceResponseModel struct {
|
||||
VoiceId string `json:"voice_id"`
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
// Voice settings overriding stored setttings for the given voice. They are applied only on the given TTS request.
|
||||
type AllOfBodyTextToSpeechV1TextToSpeechVoiceIdPostVoiceSettings struct {
|
||||
Stability float64 `json:"stability"`
|
||||
SimilarityBoost float64 `json:"similarity_boost"`
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
// Voice settings overriding stored setttings for the given voice. They are applied only on the given TTS request.
|
||||
type AllOfBodyTextToSpeechV1TextToSpeechVoiceIdStreamPostVoiceSettings struct {
|
||||
Stability float64 `json:"stability"`
|
||||
SimilarityBoost float64 `json:"similarity_boost"`
|
||||
}
|
||||
12
model_any_of_validation_error_loc_items.go
Normal file
12
model_any_of_validation_error_loc_items.go
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type AnyOfValidationErrorLocItems struct {
|
||||
}
|
||||
20
model_body_add_voice_v1_voices_add_post.go
Normal file
20
model_body_add_voice_v1_voices_add_post.go
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type BodyAddVoiceV1VoicesAddPost struct {
|
||||
// The name that identifies this voice. This will be displayed in the dropdown of the website.
|
||||
Name string `json:"name"`
|
||||
// One or more audio files to clone the voice from
|
||||
Files []*os.File `json:"files"`
|
||||
// How would you describe the voice?
|
||||
Description string `json:"description,omitempty"`
|
||||
// Serialized labels dictionary for the voice.
|
||||
Labels string `json:"labels,omitempty"`
|
||||
}
|
||||
14
model_body_delete_history_items_v1_history_delete_post.go
Normal file
14
model_body_delete_history_items_v1_history_delete_post.go
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type BodyDeleteHistoryItemsV1HistoryDeletePost struct {
|
||||
// A list of history items to remove, you can get IDs of history items and other metadata using the GET https://api.elevenlabs.io/v1/history endpoint.
|
||||
HistoryItemIds []string `json:"history_item_ids"`
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type BodyDownloadHistoryItemsV1HistoryDownloadPost struct {
|
||||
// A list of history items to download, you can get IDs of history items and other metadata using the GET https://api.elevenlabs.io/v1/history endpoint.
|
||||
HistoryItemIds []string `json:"history_item_ids"`
|
||||
}
|
||||
20
model_body_edit_voice_v1_voices__voice_id__edit_post.go
Normal file
20
model_body_edit_voice_v1_voices__voice_id__edit_post.go
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type BodyEditVoiceV1VoicesVoiceIdEditPost struct {
|
||||
// The name that identifies this voice. This will be displayed in the dropdown of the website.
|
||||
Name string `json:"name"`
|
||||
// Audio files to add to the voice
|
||||
Files []*os.File `json:"files,omitempty"`
|
||||
// How would you describe the voice?
|
||||
Description string `json:"description,omitempty"`
|
||||
// Serialized labels dictionary for the voice.
|
||||
Labels string `json:"labels,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type BodyTextToSpeechV1TextToSpeechVoiceIdPost struct {
|
||||
// The text that will get converted into speech. Currently only English text is supported.
|
||||
Text string `json:"text"`
|
||||
// Voice settings overriding stored setttings for the given voice. They are applied only on the given TTS request.
|
||||
VoiceSettings *AllOfBodyTextToSpeechV1TextToSpeechVoiceIdPostVoiceSettings `json:"voice_settings,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type BodyTextToSpeechV1TextToSpeechVoiceIdStreamPost struct {
|
||||
// The text that will get converted into speech. Currently only English text is supported.
|
||||
Text string `json:"text"`
|
||||
// Voice settings overriding stored setttings for the given voice. They are applied only on the given TTS request.
|
||||
VoiceSettings *AllOfBodyTextToSpeechV1TextToSpeechVoiceIdStreamPostVoiceSettings `json:"voice_settings,omitempty"`
|
||||
}
|
||||
28
model_extended_subscription_response_model.go
Normal file
28
model_extended_subscription_response_model.go
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type ExtendedSubscriptionResponseModel struct {
|
||||
Tier string `json:"tier"`
|
||||
CharacterCount int32 `json:"character_count"`
|
||||
CharacterLimit int32 `json:"character_limit"`
|
||||
CanExtendCharacterLimit bool `json:"can_extend_character_limit"`
|
||||
AllowedToExtendCharacterLimit bool `json:"allowed_to_extend_character_limit"`
|
||||
NextCharacterCountResetUnix int32 `json:"next_character_count_reset_unix"`
|
||||
VoiceLimit int32 `json:"voice_limit"`
|
||||
ProfessionalVoiceLimit int32 `json:"professional_voice_limit"`
|
||||
CanExtendVoiceLimit bool `json:"can_extend_voice_limit"`
|
||||
CanUseInstantVoiceCloning bool `json:"can_use_instant_voice_cloning"`
|
||||
CanUseProfessionalVoiceCloning bool `json:"can_use_professional_voice_cloning"`
|
||||
AvailableModels []TtsModelResponseModel `json:"available_models"`
|
||||
CanUseDelayedPaymentMethods bool `json:"can_use_delayed_payment_methods"`
|
||||
Currency string `json:"currency"`
|
||||
Status string `json:"status"`
|
||||
NextInvoice *InvoiceResponseModel `json:"next_invoice"`
|
||||
}
|
||||
20
model_feedback_response_model.go
Normal file
20
model_feedback_response_model.go
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type FeedbackResponseModel struct {
|
||||
ThumbsUp bool `json:"thumbs_up"`
|
||||
Feedback string `json:"feedback"`
|
||||
Emotions bool `json:"emotions"`
|
||||
InaccurateClone bool `json:"inaccurate_clone"`
|
||||
Glitches bool `json:"glitches"`
|
||||
AudioQuality bool `json:"audio_quality"`
|
||||
Other bool `json:"other"`
|
||||
ReviewStatus string `json:"review_status,omitempty"`
|
||||
}
|
||||
20
model_fine_tuning_response_model.go
Normal file
20
model_fine_tuning_response_model.go
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type FineTuningResponseModel struct {
|
||||
ModelId string `json:"model_id"`
|
||||
IsAllowedToFineTune bool `json:"is_allowed_to_fine_tune"`
|
||||
FineTuningRequested bool `json:"fine_tuning_requested"`
|
||||
FinetuningState string `json:"finetuning_state"`
|
||||
VerificationAttempts []VerificationAttemptResponseModel `json:"verification_attempts"`
|
||||
VerificationFailures []string `json:"verification_failures"`
|
||||
VerificationAttemptsCount int32 `json:"verification_attempts_count"`
|
||||
SliceIds []string `json:"slice_ids"`
|
||||
}
|
||||
13
model_get_history_response_model.go
Normal file
13
model_get_history_response_model.go
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type GetHistoryResponseModel struct {
|
||||
History []HistoryItemResponseModel `json:"history"`
|
||||
}
|
||||
13
model_get_voices_response_model.go
Normal file
13
model_get_voices_response_model.go
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type GetVoicesResponseModel struct {
|
||||
Voices []VoiceResponseModel `json:"voices"`
|
||||
}
|
||||
24
model_history_item_response_model.go
Normal file
24
model_history_item_response_model.go
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type HistoryItemResponseModel struct {
|
||||
HistoryItemId string `json:"history_item_id"`
|
||||
RequestId string `json:"request_id"`
|
||||
VoiceId string `json:"voice_id"`
|
||||
VoiceName string `json:"voice_name"`
|
||||
Text string `json:"text"`
|
||||
DateUnix int32 `json:"date_unix"`
|
||||
CharacterCountChangeFrom int32 `json:"character_count_change_from"`
|
||||
CharacterCountChangeTo int32 `json:"character_count_change_to"`
|
||||
ContentType string `json:"content_type"`
|
||||
State string `json:"state"`
|
||||
Settings *interface{} `json:"settings"`
|
||||
Feedback *FeedbackResponseModel `json:"feedback"`
|
||||
}
|
||||
13
model_http_validation_error.go
Normal file
13
model_http_validation_error.go
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type HttpValidationError struct {
|
||||
Detail []ValidationError `json:"detail,omitempty"`
|
||||
}
|
||||
14
model_invoice_response_model.go
Normal file
14
model_invoice_response_model.go
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type InvoiceResponseModel struct {
|
||||
AmountDueCents int32 `json:"amount_due_cents"`
|
||||
NextPaymentAttemptUnix int32 `json:"next_payment_attempt_unix"`
|
||||
}
|
||||
14
model_language_response_model.go
Normal file
14
model_language_response_model.go
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type LanguageResponseModel struct {
|
||||
IsoCode string `json:"iso_code"`
|
||||
DisplayName string `json:"display_name"`
|
||||
}
|
||||
17
model_recording_response_model.go
Normal file
17
model_recording_response_model.go
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type RecordingResponseModel struct {
|
||||
RecordingId string `json:"recording_id"`
|
||||
MimeType string `json:"mime_type"`
|
||||
SizeBytes int32 `json:"size_bytes"`
|
||||
UploadDateUnix int32 `json:"upload_date_unix"`
|
||||
Transcription string `json:"transcription"`
|
||||
}
|
||||
17
model_sample_response_model.go
Normal file
17
model_sample_response_model.go
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type SampleResponseModel struct {
|
||||
SampleId string `json:"sample_id"`
|
||||
FileName string `json:"file_name"`
|
||||
MimeType string `json:"mime_type"`
|
||||
SizeBytes int32 `json:"size_bytes"`
|
||||
Hash string `json:"hash"`
|
||||
}
|
||||
15
model_settings.go
Normal file
15
model_settings.go
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
// The settings for a specific voice.
|
||||
type Settings struct {
|
||||
Stability float64 `json:"stability"`
|
||||
SimilarityBoost float64 `json:"similarity_boost"`
|
||||
}
|
||||
27
model_subscription_response_model.go
Normal file
27
model_subscription_response_model.go
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type SubscriptionResponseModel struct {
|
||||
Tier string `json:"tier"`
|
||||
CharacterCount int32 `json:"character_count"`
|
||||
CharacterLimit int32 `json:"character_limit"`
|
||||
CanExtendCharacterLimit bool `json:"can_extend_character_limit"`
|
||||
AllowedToExtendCharacterLimit bool `json:"allowed_to_extend_character_limit"`
|
||||
NextCharacterCountResetUnix int32 `json:"next_character_count_reset_unix"`
|
||||
VoiceLimit int32 `json:"voice_limit"`
|
||||
ProfessionalVoiceLimit int32 `json:"professional_voice_limit"`
|
||||
CanExtendVoiceLimit bool `json:"can_extend_voice_limit"`
|
||||
CanUseInstantVoiceCloning bool `json:"can_use_instant_voice_cloning"`
|
||||
CanUseProfessionalVoiceCloning bool `json:"can_use_professional_voice_cloning"`
|
||||
AvailableModels []TtsModelResponseModel `json:"available_models"`
|
||||
CanUseDelayedPaymentMethods bool `json:"can_use_delayed_payment_methods"`
|
||||
Currency string `json:"currency"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
15
model_tts_model_response_model.go
Normal file
15
model_tts_model_response_model.go
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type TtsModelResponseModel struct {
|
||||
ModelId string `json:"model_id"`
|
||||
DisplayName string `json:"display_name"`
|
||||
SupportedLanguage []LanguageResponseModel `json:"supported_language"`
|
||||
}
|
||||
15
model_user_response_model.go
Normal file
15
model_user_response_model.go
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type UserResponseModel struct {
|
||||
Subscription *SubscriptionResponseModel `json:"subscription"`
|
||||
IsNewUser bool `json:"is_new_user"`
|
||||
XiApiKey string `json:"xi_api_key"`
|
||||
}
|
||||
15
model_validation_error.go
Normal file
15
model_validation_error.go
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type ValidationError struct {
|
||||
Loc []AnyOfValidationErrorLocItems `json:"loc"`
|
||||
Msg string `json:"msg"`
|
||||
Type_ string `json:"type"`
|
||||
}
|
||||
18
model_verification_attempt_response_model.go
Normal file
18
model_verification_attempt_response_model.go
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type VerificationAttemptResponseModel struct {
|
||||
Text string `json:"text"`
|
||||
DateUnix int32 `json:"date_unix"`
|
||||
Accepted bool `json:"accepted"`
|
||||
Similarity float64 `json:"similarity"`
|
||||
LevenshteinDistance float64 `json:"levenshtein_distance"`
|
||||
Recording *RecordingResponseModel `json:"recording"`
|
||||
}
|
||||
22
model_voice_response_model.go
Normal file
22
model_voice_response_model.go
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type VoiceResponseModel struct {
|
||||
VoiceId string `json:"voice_id"`
|
||||
Name string `json:"name"`
|
||||
Samples []SampleResponseModel `json:"samples"`
|
||||
Category string `json:"category"`
|
||||
FineTuning *FineTuningResponseModel `json:"fine_tuning"`
|
||||
Labels map[string]string `json:"labels"`
|
||||
Description string `json:"description"`
|
||||
PreviewUrl string `json:"preview_url"`
|
||||
AvailableForTiers []string `json:"available_for_tiers"`
|
||||
Settings *VoiceSettingsResponseModel `json:"settings"`
|
||||
}
|
||||
14
model_voice_settings_response_model.go
Normal file
14
model_voice_settings_response_model.go
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
type VoiceSettingsResponseModel struct {
|
||||
Stability float64 `json:"stability"`
|
||||
SimilarityBoost float64 `json:"similarity_boost"`
|
||||
}
|
||||
42
response.go
Normal file
42
response.go
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* ElevenLabs API Documentation
|
||||
*
|
||||
* This is the documentation for the ElevenLabs API. You can use this API to use our service programmatically, this is done by using your xi-api-key. <br/> You can view your xi-api-key using the 'Profile' tab on https://beta.elevenlabs.io. Our API is experimental so all endpoints are subject to change.
|
||||
*
|
||||
* API version: 1.0
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package swagger
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type APIResponse struct {
|
||||
*http.Response `json:"-"`
|
||||
Message string `json:"message,omitempty"`
|
||||
// Operation is the name of the swagger operation.
|
||||
Operation string `json:"operation,omitempty"`
|
||||
// RequestURL is the request URL. This value is always available, even if the
|
||||
// embedded *http.Response is nil.
|
||||
RequestURL string `json:"url,omitempty"`
|
||||
// Method is the HTTP method used for the request. This value is always
|
||||
// available, even if the embedded *http.Response is nil.
|
||||
Method string `json:"method,omitempty"`
|
||||
// Payload holds the contents of the response body (which may be nil or empty).
|
||||
// This is provided here as the raw response.Body() reader will have already
|
||||
// been drained.
|
||||
Payload []byte `json:"-"`
|
||||
}
|
||||
|
||||
func NewAPIResponse(r *http.Response) *APIResponse {
|
||||
|
||||
response := &APIResponse{Response: r}
|
||||
return response
|
||||
}
|
||||
|
||||
func NewAPIResponseWithError(errorMessage string) *APIResponse {
|
||||
|
||||
response := &APIResponse{Message: errorMessage}
|
||||
return response
|
||||
}
|
||||
Reference in New Issue
Block a user