diff --git a/go/models/ai_gateway_token.go b/go/models/ai_gateway_token.go new file mode 100644 index 00000000..69b846a4 --- /dev/null +++ b/go/models/ai_gateway_token.go @@ -0,0 +1,49 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// AiGatewayToken ai gateway token +// +// swagger:model aiGatewayToken +type AiGatewayToken struct { + + // Unix timestamp when the token expires + ExpiresAt int64 `json:"expires_at,omitempty"` + + // The AI Gateway authentication token + Token string `json:"token,omitempty"` + + // AI gateway base url + URL string `json:"url,omitempty"` +} + +// Validate validates this ai gateway token +func (m *AiGatewayToken) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *AiGatewayToken) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AiGatewayToken) UnmarshalBinary(b []byte) error { + var res AiGatewayToken + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/go/models/get_a_i_gateway_providers_o_k_body.go b/go/models/get_a_i_gateway_providers_o_k_body.go new file mode 100644 index 00000000..6bf0e2fd --- /dev/null +++ b/go/models/get_a_i_gateway_providers_o_k_body.go @@ -0,0 +1,76 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// GetAIGatewayProvidersOKBody get a i gateway providers o k body +// +// swagger:model getAIGatewayProvidersOKBody +type GetAIGatewayProvidersOKBody struct { + + // providers + Providers map[string]ProviderDefinition `json:"providers,omitempty"` +} + +// Validate validates this get a i gateway providers o k body +func (m *GetAIGatewayProvidersOKBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateProviders(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetAIGatewayProvidersOKBody) validateProviders(formats strfmt.Registry) error { + + if swag.IsZero(m.Providers) { // not required + return nil + } + + for k := range m.Providers { + + if err := validate.Required("providers"+"."+k, "body", m.Providers[k]); err != nil { + return err + } + if val, ok := m.Providers[k]; ok { + if err := val.Validate(formats); err != nil { + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *GetAIGatewayProvidersOKBody) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *GetAIGatewayProvidersOKBody) UnmarshalBinary(b []byte) error { + var res GetAIGatewayProvidersOKBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/go/plumbing/operations/get_a_i_gateway_providers_parameters.go b/go/plumbing/operations/get_a_i_gateway_providers_parameters.go new file mode 100644 index 00000000..fee32f14 --- /dev/null +++ b/go/plumbing/operations/get_a_i_gateway_providers_parameters.go @@ -0,0 +1,113 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewGetAIGatewayProvidersParams creates a new GetAIGatewayProvidersParams object +// with the default values initialized. +func NewGetAIGatewayProvidersParams() *GetAIGatewayProvidersParams { + + return &GetAIGatewayProvidersParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetAIGatewayProvidersParamsWithTimeout creates a new GetAIGatewayProvidersParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetAIGatewayProvidersParamsWithTimeout(timeout time.Duration) *GetAIGatewayProvidersParams { + + return &GetAIGatewayProvidersParams{ + + timeout: timeout, + } +} + +// NewGetAIGatewayProvidersParamsWithContext creates a new GetAIGatewayProvidersParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetAIGatewayProvidersParamsWithContext(ctx context.Context) *GetAIGatewayProvidersParams { + + return &GetAIGatewayProvidersParams{ + + Context: ctx, + } +} + +// NewGetAIGatewayProvidersParamsWithHTTPClient creates a new GetAIGatewayProvidersParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetAIGatewayProvidersParamsWithHTTPClient(client *http.Client) *GetAIGatewayProvidersParams { + + return &GetAIGatewayProvidersParams{ + HTTPClient: client, + } +} + +/* +GetAIGatewayProvidersParams contains all the parameters to send to the API endpoint +for the get a i gateway providers operation typically these are written to a http.Request +*/ +type GetAIGatewayProvidersParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get a i gateway providers params +func (o *GetAIGatewayProvidersParams) WithTimeout(timeout time.Duration) *GetAIGatewayProvidersParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get a i gateway providers params +func (o *GetAIGatewayProvidersParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get a i gateway providers params +func (o *GetAIGatewayProvidersParams) WithContext(ctx context.Context) *GetAIGatewayProvidersParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get a i gateway providers params +func (o *GetAIGatewayProvidersParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get a i gateway providers params +func (o *GetAIGatewayProvidersParams) WithHTTPClient(client *http.Client) *GetAIGatewayProvidersParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get a i gateway providers params +func (o *GetAIGatewayProvidersParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAIGatewayProvidersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/go/plumbing/operations/get_a_i_gateway_providers_responses.go b/go/plumbing/operations/get_a_i_gateway_providers_responses.go new file mode 100644 index 00000000..c118dc03 --- /dev/null +++ b/go/plumbing/operations/get_a_i_gateway_providers_responses.go @@ -0,0 +1,119 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/netlify/open-api/v2/go/models" +) + +// GetAIGatewayProvidersReader is a Reader for the GetAIGatewayProviders structure. +type GetAIGatewayProvidersReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAIGatewayProvidersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAIGatewayProvidersOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetAIGatewayProvidersDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewGetAIGatewayProvidersOK creates a GetAIGatewayProvidersOK with default headers values +func NewGetAIGatewayProvidersOK() *GetAIGatewayProvidersOK { + return &GetAIGatewayProvidersOK{} +} + +/* +GetAIGatewayProvidersOK handles this case with default header values. + +The mapping of providers and supported models +*/ +type GetAIGatewayProvidersOK struct { + Payload *models.GetAIGatewayProvidersOKBody +} + +func (o *GetAIGatewayProvidersOK) Error() string { + return fmt.Sprintf("[GET /ai-gateway/providers][%d] getAIGatewayProvidersOK %+v", 200, o.Payload) +} + +func (o *GetAIGatewayProvidersOK) GetPayload() *models.GetAIGatewayProvidersOKBody { + return o.Payload +} + +func (o *GetAIGatewayProvidersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GetAIGatewayProvidersOKBody) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetAIGatewayProvidersDefault creates a GetAIGatewayProvidersDefault with default headers values +func NewGetAIGatewayProvidersDefault(code int) *GetAIGatewayProvidersDefault { + return &GetAIGatewayProvidersDefault{ + _statusCode: code, + } +} + +/* +GetAIGatewayProvidersDefault handles this case with default header values. + +error +*/ +type GetAIGatewayProvidersDefault struct { + _statusCode int + + Payload *models.Error +} + +// Code gets the status code for the get a i gateway providers default response +func (o *GetAIGatewayProvidersDefault) Code() int { + return o._statusCode +} + +func (o *GetAIGatewayProvidersDefault) Error() string { + return fmt.Sprintf("[GET /ai-gateway/providers][%d] getAIGatewayProviders default %+v", o._statusCode, o.Payload) +} + +func (o *GetAIGatewayProvidersDefault) GetPayload() *models.Error { + return o.Payload +} + +func (o *GetAIGatewayProvidersDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/go/plumbing/operations/get_a_i_gateway_token_parameters.go b/go/plumbing/operations/get_a_i_gateway_token_parameters.go new file mode 100644 index 00000000..c3199001 --- /dev/null +++ b/go/plumbing/operations/get_a_i_gateway_token_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewGetAIGatewayTokenParams creates a new GetAIGatewayTokenParams object +// with the default values initialized. +func NewGetAIGatewayTokenParams() *GetAIGatewayTokenParams { + var () + return &GetAIGatewayTokenParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetAIGatewayTokenParamsWithTimeout creates a new GetAIGatewayTokenParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetAIGatewayTokenParamsWithTimeout(timeout time.Duration) *GetAIGatewayTokenParams { + var () + return &GetAIGatewayTokenParams{ + + timeout: timeout, + } +} + +// NewGetAIGatewayTokenParamsWithContext creates a new GetAIGatewayTokenParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetAIGatewayTokenParamsWithContext(ctx context.Context) *GetAIGatewayTokenParams { + var () + return &GetAIGatewayTokenParams{ + + Context: ctx, + } +} + +// NewGetAIGatewayTokenParamsWithHTTPClient creates a new GetAIGatewayTokenParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetAIGatewayTokenParamsWithHTTPClient(client *http.Client) *GetAIGatewayTokenParams { + var () + return &GetAIGatewayTokenParams{ + HTTPClient: client, + } +} + +/* +GetAIGatewayTokenParams contains all the parameters to send to the API endpoint +for the get a i gateway token operation typically these are written to a http.Request +*/ +type GetAIGatewayTokenParams struct { + + /*SiteID + The site ID + + */ + SiteID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get a i gateway token params +func (o *GetAIGatewayTokenParams) WithTimeout(timeout time.Duration) *GetAIGatewayTokenParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get a i gateway token params +func (o *GetAIGatewayTokenParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get a i gateway token params +func (o *GetAIGatewayTokenParams) WithContext(ctx context.Context) *GetAIGatewayTokenParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get a i gateway token params +func (o *GetAIGatewayTokenParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get a i gateway token params +func (o *GetAIGatewayTokenParams) WithHTTPClient(client *http.Client) *GetAIGatewayTokenParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get a i gateway token params +func (o *GetAIGatewayTokenParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithSiteID adds the siteID to the get a i gateway token params +func (o *GetAIGatewayTokenParams) WithSiteID(siteID string) *GetAIGatewayTokenParams { + o.SetSiteID(siteID) + return o +} + +// SetSiteID adds the siteId to the get a i gateway token params +func (o *GetAIGatewayTokenParams) SetSiteID(siteID string) { + o.SiteID = siteID +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAIGatewayTokenParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param site_id + if err := r.SetPathParam("site_id", o.SiteID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/go/plumbing/operations/get_a_i_gateway_token_responses.go b/go/plumbing/operations/get_a_i_gateway_token_responses.go new file mode 100644 index 00000000..098855cd --- /dev/null +++ b/go/plumbing/operations/get_a_i_gateway_token_responses.go @@ -0,0 +1,147 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/netlify/open-api/v2/go/models" +) + +// GetAIGatewayTokenReader is a Reader for the GetAIGatewayToken structure. +type GetAIGatewayTokenReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAIGatewayTokenReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAIGatewayTokenOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 404: + result := NewGetAIGatewayTokenNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + result := NewGetAIGatewayTokenDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewGetAIGatewayTokenOK creates a GetAIGatewayTokenOK with default headers values +func NewGetAIGatewayTokenOK() *GetAIGatewayTokenOK { + return &GetAIGatewayTokenOK{} +} + +/* +GetAIGatewayTokenOK handles this case with default header values. + +AI Gateway token for the site +*/ +type GetAIGatewayTokenOK struct { + Payload *models.AiGatewayToken +} + +func (o *GetAIGatewayTokenOK) Error() string { + return fmt.Sprintf("[GET /api/v1/sites/{site_id}/ai-gateway/token][%d] getAIGatewayTokenOK %+v", 200, o.Payload) +} + +func (o *GetAIGatewayTokenOK) GetPayload() *models.AiGatewayToken { + return o.Payload +} + +func (o *GetAIGatewayTokenOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AiGatewayToken) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetAIGatewayTokenNotFound creates a GetAIGatewayTokenNotFound with default headers values +func NewGetAIGatewayTokenNotFound() *GetAIGatewayTokenNotFound { + return &GetAIGatewayTokenNotFound{} +} + +/* +GetAIGatewayTokenNotFound handles this case with default header values. + +AI Gateway not available for this site +*/ +type GetAIGatewayTokenNotFound struct { +} + +func (o *GetAIGatewayTokenNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/sites/{site_id}/ai-gateway/token][%d] getAIGatewayTokenNotFound ", 404) +} + +func (o *GetAIGatewayTokenNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetAIGatewayTokenDefault creates a GetAIGatewayTokenDefault with default headers values +func NewGetAIGatewayTokenDefault(code int) *GetAIGatewayTokenDefault { + return &GetAIGatewayTokenDefault{ + _statusCode: code, + } +} + +/* +GetAIGatewayTokenDefault handles this case with default header values. + +error +*/ +type GetAIGatewayTokenDefault struct { + _statusCode int + + Payload *models.Error +} + +// Code gets the status code for the get a i gateway token default response +func (o *GetAIGatewayTokenDefault) Code() int { + return o._statusCode +} + +func (o *GetAIGatewayTokenDefault) Error() string { + return fmt.Sprintf("[GET /api/v1/sites/{site_id}/ai-gateway/token][%d] getAIGatewayToken default %+v", o._statusCode, o.Payload) +} + +func (o *GetAIGatewayTokenDefault) GetPayload() *models.Error { + return o.Payload +} + +func (o *GetAIGatewayTokenDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/go/plumbing/operations/operations_client.go b/go/plumbing/operations/operations_client.go index fd208aab..1e2808cd 100644 --- a/go/plumbing/operations/operations_client.go +++ b/go/plumbing/operations/operations_client.go @@ -27,8 +27,6 @@ type Client struct { // ClientService is the interface for Client methods type ClientService interface { - GetAiGatewayProviders(params *GetAiGatewayProvidersParams, authInfo runtime.ClientAuthInfoWriter) (*GetAiGatewayProvidersOK, error) - AddMemberToAccount(params *AddMemberToAccountParams, authInfo runtime.ClientAuthInfoWriter) (*AddMemberToAccountOK, error) AgentRunnerCommitToBranch(params *AgentRunnerCommitToBranchParams, authInfo runtime.ClientAuthInfoWriter) (*AgentRunnerCommitToBranchOK, error) @@ -133,6 +131,10 @@ type ClientService interface { ExchangeTicket(params *ExchangeTicketParams, authInfo runtime.ClientAuthInfoWriter) (*ExchangeTicketCreated, error) + GetAIGatewayProviders(params *GetAIGatewayProvidersParams) (*GetAIGatewayProvidersOK, error) + + GetAIGatewayToken(params *GetAIGatewayTokenParams, authInfo runtime.ClientAuthInfoWriter) (*GetAIGatewayTokenOK, error) + GetAccount(params *GetAccountParams, authInfo runtime.ClientAuthInfoWriter) (*GetAccountOK, error) GetAccountBuildStatus(params *GetAccountBuildStatusParams, authInfo runtime.ClientAuthInfoWriter) (*GetAccountBuildStatusOK, error) @@ -330,41 +332,6 @@ type ClientService interface { SetTransport(transport runtime.ClientTransport) } -/* -GetAiGatewayProviders get ai gateway providers API -*/ -func (a *Client) GetAiGatewayProviders(params *GetAiGatewayProvidersParams, authInfo runtime.ClientAuthInfoWriter) (*GetAiGatewayProvidersOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetAiGatewayProvidersParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "GetAiGatewayProviders", - Method: "GET", - PathPattern: "/ai-gateway/providers", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"https"}, - Params: params, - Reader: &GetAiGatewayProvidersReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - success, ok := result.(*GetAiGatewayProvidersOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetAiGatewayProviders: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - /* AddMemberToAccount add member to account API */ @@ -2134,6 +2101,73 @@ func (a *Client) ExchangeTicket(params *ExchangeTicketParams, authInfo runtime.C return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +GetAIGatewayProviders get a i gateway providers API +*/ +func (a *Client) GetAIGatewayProviders(params *GetAIGatewayProvidersParams) (*GetAIGatewayProvidersOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAIGatewayProvidersParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "getAIGatewayProviders", + Method: "GET", + PathPattern: "/ai-gateway/providers", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &GetAIGatewayProvidersReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*GetAIGatewayProvidersOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetAIGatewayProvidersDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +GetAIGatewayToken Returns an AI Gateway token for a specific site +*/ +func (a *Client) GetAIGatewayToken(params *GetAIGatewayTokenParams, authInfo runtime.ClientAuthInfoWriter) (*GetAIGatewayTokenOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAIGatewayTokenParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "getAIGatewayToken", + Method: "GET", + PathPattern: "/api/v1/sites/{site_id}/ai-gateway/token", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &GetAIGatewayTokenReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*GetAIGatewayTokenOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetAIGatewayTokenDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* GetAccount get account API */ diff --git a/swagger.yml b/swagger.yml index 244c1d67..12de3c93 100644 --- a/swagger.yml +++ b/swagger.yml @@ -3080,6 +3080,9 @@ paths: $ref: '#/responses/error' /ai-gateway/providers: get: + operationId: getAIGatewayProviders + tags: [aiGateway] + security: [] responses: '200': description: The mapping of providers and supported models @@ -3090,6 +3093,28 @@ paths: additionalProperties: type: object $ref: '#/definitions/providerDefinition' + default: + $ref: '#/responses/error' + /api/v1/sites/{site_id}/ai-gateway/token: + parameters: + - name: site_id + type: string + in: path + required: true + description: The site ID + get: + operationId: getAIGatewayToken + tags: [aiGateway] + responses: + '200': + description: AI Gateway token for the site + schema: + $ref: '#/definitions/aiGatewayToken' + '404': + description: AI Gateway not available for this site + default: + $ref: '#/responses/error' + description: Returns an AI Gateway token for a specific site definitions: DeployValidationsReport: @@ -4606,6 +4631,19 @@ definitions: type: array items: type: string + aiGatewayToken: + type: object + properties: + token: + type: string + description: The AI Gateway authentication token + url: + type: string + description: AI gateway base url + expires_at: + type: integer + format: int64 + description: Unix timestamp when the token expires parameters: page: