repo_description: Internet-scale OpenID Certified™ OpenID Connect and OAuth2.1 provider that integrates with your user management through headless APIs. Solve OIDC/OAuth2 user cases over night. Consume as a service on Ory Network or self-host. Trusted by OpenAI and many others for scale and security. Written in Go.
repo_topics: authorization cloud docker federation hacktoberfest hydra identity oauth oauth-provider oauth2 oauth2-provider oauth2-server oidc openid openid-connect openid-connect-provider openid-provider security server sso
code: /*
  Ory Hydra API
  
  Documentation for all of Ory Hydra's APIs.
  
  API version:
  Contact: [REDACTED_EMAIL]
  */
  
  // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
  
  package openapi
  
  import (
  	"bytes"
  	"context"
  	"io"
  	"net/http"
  	"net/url"
  	"strings"
  )
  
  // JwkAPIService JwkAPI service
  type JwkAPIService service
  
  type ApiCreateJsonWebKeySetRequest struct {
  	ctx                 context.Context
  	ApiService          *JwkAPIService
  	set                 string
  	createJsonWebKeySet *CreateJsonWebKeySet
  }
  
  func (r ApiCreateJsonWebKeySetRequest) CreateJsonWebKeySet(createJsonWebKeySet CreateJsonWebKeySet) ApiCreateJsonWebKeySetRequest {
  	r.createJsonWebKeySet = &createJsonWebKeySet
  	return r
  }
  
  func (r ApiCreateJsonWebKeySetRequest) Execute() (*JsonWebKeySet, *http.Response, error) {
  	return r.ApiService.CreateJsonWebKeySetExecute(r)
  }
  
  /*
  CreateJsonWebKeySet Create JSON Web Key
  
  This endpoint is capable of generating JSON Web Key Sets for you. There are different strategies available, such as symmetric cryptographic keys (HS256, HS512) and asymmetric cryptographic keys (RS256, ECDSA). If the specified JSON Web Key Set does not exist, it will be created.
  
  A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
  
  	@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  	@param set The JSON Web Key Set ID
  	@return ApiCreateJsonWebKeySetRequest
  */
  func (a *JwkAPIService) CreateJsonWebKeySet(ctx context.Context, set string) ApiCreateJsonWebKeySetRequest {
  	return ApiCreateJsonWebKeySetRequest{
  		ApiService: a,
  		ctx:        ctx,
  		set:        set,
  	}
  }
  
  // Execute executes the request
  //
  //	@return JsonWebKeySet
  func (a *JwkAPIService) CreateJsonWebKeySetExecute(r ApiCreateJsonWebKeySetRequest) (*JsonWebKeySet, *http.Response, error) {
  	var (
  		localVarHTTPMethod  = http.MethodPost
  		localVarPostBody    interface{}
  		formFiles           []formFile
  		localVarReturnValue *JsonWebKeySet
  	)
  
  	localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "JwkAPIService.CreateJsonWebKeySet")
  	if err != nil {
  		return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
  	}
  
  	localVarPath := localBasePath + "/admin/keys/{set}"
  	localVarPath = strings.Replace(localVarPath, "{"+"set"+"}", url.PathEscape(parameterValueToString(r.set, "set")), -1)
  
  	localVarHeaderParams := make(map[string]string)
  	localVarQueryParams := url.Values{}
  	localVarFormParams := url.Values{}
  	if r.createJsonWebKeySet == nil {
  		return localVarReturnValue, nil, reportError("createJsonWebKeySet is required and must be specified")
  	}
  
  	// 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
  	}
  	// body params
  	localVarPostBody = r.createJsonWebKeySet
  	req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
  	if err != nil {
  		return localVarReturnValue, nil, err
  	}
  
  	localVarHTTPResponse, err := a.client.callAPI(req)
  	if err != nil || localVarHTTPResponse == nil {
  		return localVarReturnValue, localVarHTTPResponse, err
  	}
  
  	localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
  	localVarHTTPResponse.Body.Close()
  	localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
  	if err != nil {
  		return localVarReturnValue, localVarHTTPResponse, err
  	}
  
  	if localVarHTTPResponse.StatusCode >= 300 {
  		newErr := &GenericOpenAPIError{
  			body:  localVarBody,
  			error: localVarHTTPResponse.Status,
  		}
  		var v ErrorOAuth2
  		err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
  		if err != nil {
  			newErr.error = err.Error()
  			return localVarReturnValue, localVarHTTPResponse, newErr
  		}
  		newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
  		newErr.model = v
  		return localVarReturnValue, localVarHTTPResponse, newErr
  	}
  
  	err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
  	if err != nil {
  		newErr := &GenericOpenAPIError{
  			body:  localVarBody,
  			error: err.Error(),
  		}
  		return localVarReturnValue, localVarHTTPResponse, newErr
  	}
  
  	return localVarReturnValue, localVarHTTPResponse, nil
  }
  
  type ApiDeleteJsonWebKeyRequest struct {
  	ctx        context.Context
  	ApiService *JwkAPIService
  	set        string
  	kid        string
  }
  
  func (r ApiDeleteJsonWebKeyRequest) Execute() (*http.Response, error) {
  	return r.ApiService.DeleteJsonWebKeyExecute(r)
  }
  
  /*
  DeleteJsonWebKey Delete JSON Web Key
  
  Use this endpoint to delete a single JSON Web Key.
  
  A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A
  JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses
  this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens),
  and allows storing user-defined keys as well.
  
  	@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  	@param set The JSON Web Key Set
  	@param kid The JSON Web Key ID (kid)
  	@return ApiDeleteJsonWebKeyRequest
  */
  func (a *JwkAPIService) DeleteJsonWebKey(ctx context.Context, set string, kid string) ApiDeleteJsonWebKeyRequest {
  	return ApiDeleteJsonWebKeyRequest{
  		ApiService: a,
  		ctx:        ctx,
  		set:        set,
  		kid:        kid,
  	}
  }
  
  // Execute executes the request
  func (a *JwkAPIService) DeleteJsonWebKeyExecute(r ApiDeleteJsonWebKeyRequest) (*http.Response, error) {
  	var (
  		localVarHTTPMethod = http.MethodDelete
  		localVarPostBody   interface{}
  		formFiles          []formFile
  	)
  
  	localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "JwkAPIService.DeleteJsonWebKey")
  	if err != nil {
  		return nil, &GenericOpenAPIError{error: err.Error()}
  	}
  
  	localVarPath := localBasePath + "/admin/keys/{set}/{kid}"
  	localVarPath = strings.Replace(localVarPath, "{"+"set"+"}", url.PathEscape(parameterValueToString(r.set, "set")), -1)
  	localVarPath = strings.Replace(localVarPath, "{"+"kid"+"}", url.PathEscape(parameterValueToString(r.kid, "kid")), -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
  	}
  	req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
  	if err != nil {
  		return nil, err
  	}
  
  	localVarHTTPResponse, err := a.client.callAPI(req)
  	if err != nil || localVarHTTPResponse == nil {
  		return localVarHTTPResponse, err
  	}
  
  	localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
  	localVarHTTPResponse.Body.Close()
  	localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
  	if err != nil {
  		return localVarHTTPResponse, err
  	}
  
  	if localVarHTTPResponse.StatusCode >= 300 {
  		newErr := &GenericOpenAPIError{
  			body:  localVarBody,
  			error: localVarHTTPResponse.Status,
  		}
  		var v ErrorOAuth2
  		err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
  		if err != nil {
  			newErr.error = err.Error()
  			return localVarHTTPResponse, newErr
  		}
  		newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
  		newErr.model = v
  		return localVarHTTPResponse, newErr
  	}
  
  	return localVarHTTPResponse, nil
  }
  
  type ApiDeleteJsonWebKeySetRequest struct {
  	ctx        context.Context
  	ApiService *JwkAPIService
  	set        string
  }
  
  func (r ApiDeleteJsonWebKeySetRequest) Execute() (*http.Response, error) {
  	return r.ApiService.DeleteJsonWebKeySetExecute(r)
  }
  
  /*
  DeleteJsonWebKeySet Delete JSON Web Key Set
  
  Use this endpoint to delete a complete JSON Web Key Set and all the keys in that set.
  
  A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
  
  	@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  	@param set The JSON Web Key Set
  	@return ApiDeleteJsonWebKeySetRequest
  */
  func (a *JwkAPIService) DeleteJsonWebKeySet(ctx context.Context, set string) ApiDeleteJsonWebKeySetRequest {
  	return ApiDeleteJsonWebKeySetRequest{
  		ApiService: a,
  		ctx:        ctx,
  		set:        set,
  	}
  }
  
  // Execute executes the request
  func (a *JwkAPIService) DeleteJsonWebKeySetExecute(r ApiDeleteJsonWebKeySetRequest) (*http.Response, error) {
  	var (
  		localVarHTTPMethod = http.MethodDelete
  		localVarPostBody   interface{}
  		formFiles          []formFile
  	)
  
  	localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "JwkAPIService.DeleteJsonWebKeySet")
  	if err != nil {
  		return nil, &GenericOpenAPIError{error: err.Error()}
  	}
  
  	localVarPath := localBasePath + "/admin/keys/{set}"
  	localVarPath = strings.Replace(localVarPath, "{"+"set"+"}", url.PathEscape(parameterValueToString(r.set, "set")), -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
  	}
  	req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
  	if err != nil {
  		return nil, err
  	}
  
  	localVarHTTPResponse, err := a.client.callAPI(req)
  	if err != nil || localVarHTTPResponse == nil {
  		return localVarHTTPResponse, err
  	}
  
  	localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
  	localVarHTTPResponse.Body.Close()
  	localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
  	if err != nil {
  		return localVarHTTPResponse, err
  	}
  
  	if localVarHTTPResponse.StatusCode >= 300 {
  		newErr := &GenericOpenAPIError{
  			body:  localVarBody,
  			error: localVarHTTPResponse.Status,
  		}
  		var v ErrorOAuth2
  		err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
  		if err != nil {
  			newErr.error = err.Error()
  			return localVarHTTPResponse, newErr
  		}
  		newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
  		newErr.model = v
  		return localVarHTTPResponse, newErr
  	}
  
  	return localVarHTTPResponse, nil
  }
  
  type ApiGetJsonWebKeyRequest struct {
  	ctx        context.Context
  	ApiService *JwkAPIService
  	set        string
  	kid        string
  }
  
  func (r ApiGetJsonWebKeyRequest) Execute() (*JsonWebKeySet, *http.Response, error) {
  	return r.ApiService.GetJsonWebKeyExecute(r)
  }
  
  /*
  GetJsonWebKey Get JSON Web Key
  
  This endpoint returns a singular JSON Web Key contained in a set. It is identified by the set and the specific key ID (kid).
  
  	@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  	@param set JSON Web Key Set ID
  	@param kid JSON Web Key ID
  	@return ApiGetJsonWebKeyRequest
  */
  func (a *JwkAPIService) GetJsonWebKey(ctx context.Context, set string, kid string) ApiGetJsonWebKeyRequest {
  	return ApiGetJsonWebKeyRequest{
  		ApiService: a,
  		ctx:        ctx,
  		set:        set,
  		kid:        kid,
  	}
  }
  
  // Execute executes the request
  //
  //	@return JsonWebKeySet
  func (a *JwkAPIService) GetJsonWebKeyExecute(r ApiGetJsonWebKeyRequest) (*JsonWebKeySet, *http.Response, error) {
  	var (
  		localVarHTTPMethod  = http.MethodGet
  		localVarPostBody    interface{}
  		formFiles           []formFile
  		localVarReturnValue *JsonWebKeySet
  	)
  
  	localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "JwkAPIService.GetJsonWebKey")
  	if err != nil {
  		return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
  	}
  
  	localVarPath := localBasePath + "/admin/keys/{set}/{kid}"
  	localVarPath = strings.Replace(localVarPath, "{"+"set"+"}", url.PathEscape(parameterValueToString(r.set, "set")), -1)
  	localVarPath = strings.Replace(localVarPath, "{"+"kid"+"}", url.PathEscape(parameterValueToString(r.kid, "kid")), -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
  	}
  	req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
  	if err != nil {
  		return localVarReturnValue, nil, err
  	}
  
  	localVarHTTPResponse, err := a.client.callAPI(req)
  	if err != nil || localVarHTTPResponse == nil {
  		return localVarReturnValue, localVarHTTPResponse, err
  	}
  
  	localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
  	localVarHTTPResponse.Body.Close()
  	localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
  	if err != nil {
  		return localVarReturnValue, localVarHTTPResponse, err
  	}
  
  	if localVarHTTPResponse.StatusCode >= 300 {
  		newErr := &GenericOpenAPIError{
  			body:  localVarBody,
  			error: localVarHTTPResponse.Status,
  		}
  		var v ErrorOAuth2
  		err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
  		if err != nil {
  			newErr.error = err.Error()
  			return localVarReturnValue, localVarHTTPResponse, newErr
  		}
  		newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
  		newErr.model = v
  		return localVarReturnValue, localVarHTTPResponse, newErr
  	}
  
  	err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
  	if err != nil {
  		newErr := &GenericOpenAPIError{
  			body:  localVarBody,
  			error: err.Error(),
  		}
  		return localVarReturnValue, localVarHTTPResponse, newErr
  	}
  
  	return localVarReturnValue, localVarHTTPResponse, nil
  }
  
  type ApiGetJsonWebKeySetRequest struct {
  	ctx        context.Context
  	ApiService *JwkAPIService
  	set        string
  }
  
  func (r ApiGetJsonWebKeySetRequest) Execute() (*JsonWebKeySet, *http.Response, error) {
  	return r.ApiService.GetJsonWebKeySetExecute(r)
  }
  
  /*
  GetJsonWebKeySet Retrieve a JSON Web Key Set
  
  This endpoint can be used to retrieve JWK Sets stored in ORY Hydra.
  
  A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
  
  	@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  	@param set JSON Web Key Set ID
  	@return ApiGetJsonWebKeySetRequest
  */
  func (a *JwkAPIService) GetJsonWebKeySet(ctx context.Context, set string) ApiGetJsonWebKeySetRequest {
  	return ApiGetJsonWebKeySetRequest{
  		ApiService: a,
  		ctx:        ctx,
  		set:        set,
  	}
  }
  
  // Execute executes the request
  //
  //	@return JsonWebKeySet
  func (a *JwkAPIService) GetJsonWebKeySetExecute(r ApiGetJsonWebKeySetRequest) (*JsonWebKeySet, *http.Response, error) {
  	var (
  		localVarHTTPMethod  = http.MethodGet
  		localVarPostBody    interface{}
  		formFiles           []formFile
  		localVarReturnValue *JsonWebKeySet
  	)
  
  	localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "JwkAPIService.GetJsonWebKeySet")
  	if err != nil {
  		return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
  	}
  
  	localVarPath := localBasePath + "/admin/keys/{set}"
  	localVarPath = strings.Replace(localVarPath, "{"+"set"+"}", url.PathEscape(parameterValueToString(r.set, "set")), -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
  	}
  	req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
  	if err != nil {
  		return localVarReturnValue, nil, err
  	}
  
  	localVarHTTPResponse, err := a.client.callAPI(req)
  	if err != nil || localVarHTTPResponse == nil {
  		return localVarReturnValue, localVarHTTPResponse, err
  	}
  
  	localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
  	localVarHTTPResponse.Body.Close()
  	localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
  	if err != nil {
  		return localVarReturnValue, localVarHTTPResponse, err
  	}
  
  	if localVarHTTPResponse.StatusCode >= 300 {
  		newErr := &GenericOpenAPIError{
  			body:  localVarBody,
  			error: localVarHTTPResponse.Status,
  		}
  		var v ErrorOAuth2
  		err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
  		if err != nil {
  			newErr.error = err.Error()
  			return localVarReturnValue, localVarHTTPResponse, newErr
  		}
  		newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
  		newErr.model = v
  		return localVarReturnValue, localVarHTTPResponse, newErr
  	}
  
  	err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
  	if err != nil {
  		newErr := &GenericOpenAPIError{
  			body:  localVarBody,
  			error: err.Error(),
  		}
  		return localVarReturnValue, localVarHTTPResponse, newErr
  	}
  
  	return localVarReturnValue, localVarHTTPResponse, nil
  }
  
  type ApiSetJsonWebKeyRequest struct {
  	ctx        context.Context
  	ApiService *JwkAPIService
  	set        string
  	kid        string
  	jsonWebKey *JsonWebKey
  }
  
  func (r ApiSetJsonWebKeyRequest) JsonWebKey(jsonWebKey JsonWebKey) ApiSetJsonWebKeyRequest {
  	r.jsonWebKey = &jsonWebKey
  	return r
  }
  
  func (r ApiSetJsonWebKeyRequest) Execute() (*JsonWebKey, *http.Response, error) {
  	return r.ApiService.SetJsonWebKeyExecute(r)
  }
  
  /*
  SetJsonWebKey Set JSON Web Key
  
  Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your own.
  
  A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
  
  	@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  	@param set The JSON Web Key Set ID
  	@param kid JSON Web Key ID
  	@return ApiSetJsonWebKeyRequest
  */
  func (a *JwkAPIService) SetJsonWebKey(ctx context.Context, set string, kid string) ApiSetJsonWebKeyRequest {
  	return ApiSetJsonWebKeyRequest{
  		ApiService: a,
  		ctx:        ctx,
  		set:        set,
  		kid:        kid,
  	}
  }
  
  // Execute executes the request
  //
  //	@return JsonWebKey
  func (a *JwkAPIService) SetJsonWebKeyExecute(r ApiSetJsonWebKeyRequest) (*JsonWebKey, *http.Response, error) {
  	var (
  		localVarHTTPMethod  = http.MethodPut
  		localVarPostBody    interface{}
  		formFiles           []formFile
  		localVarReturnValue *JsonWebKey
  	)
  
  	localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "JwkAPIService.SetJsonWebKey")
  	if err != nil {
  		return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
  	}
  
  	localVarPath := localBasePath + "/admin/keys/{set}/{kid}"
  	localVarPath = strings.Replace(localVarPath, "{"+"set"+"}", url.PathEscape(parameterValueToString(r.set, "set")), -1)
  	localVarPath = strings.Replace(localVarPath, "{"+"kid"+"}", url.PathEscape(parameterValueToString(r.kid, "kid")), -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
  	}
  	// body params
  	localVarPostBody = r.jsonWebKey
  	req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
  	if err != nil {
  		return localVarReturnValue, nil, err
  	}
  
  	localVarHTTPResponse, err := a.client.callAPI(req)
  	if err != nil || localVarHTTPResponse == nil {
  		return localVarReturnValue, localVarHTTPResponse, err
  	}
  
  	localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
  	localVarHTTPResponse.Body.Close()
  	localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
  	if err != nil {
  		return localVarReturnValue, localVarHTTPResponse, err
  	}
  
  	if localVarHTTPResponse.StatusCode >= 300 {
  		newErr := &GenericOpenAPIError{
  			body:  localVarBody,
  			error: localVarHTTPResponse.Status,
  		}
  		var v ErrorOAuth2
  		err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
  		if err != nil {
  			newErr.error = err.Error()
  			return localVarReturnValue, localVarHTTPResponse, newErr
  		}
  		newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
  		newErr.model = v
  		return localVarReturnValue, localVarHTTPResponse, newErr
  	}
  
  	err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
  	if err != nil {
  		newErr := &GenericOpenAPIError{
  			body:  localVarBody,
  			error: err.Error(),
  		}
  		return localVarReturnValue, localVarHTTPResponse, newErr
  	}
  
  	return localVarReturnValue, localVarHTTPResponse, nil
  }
  
  type ApiSetJsonWebKeySetRequest struct {
  	ctx           context.Context
  	ApiService    *JwkAPIService
  	set           string
  	jsonWebKeySet *JsonWebKeySet
  }
  
  func (r ApiSetJsonWebKeySetRequest) JsonWebKeySet(jsonWebKeySet JsonWebKeySet) ApiSetJsonWebKeySetRequest {
  	r.jsonWebKeySet = &jsonWebKeySet
  	return r
  }
  
  func (r ApiSetJsonWebKeySetRequest) Execute() (*JsonWebKeySet, *http.Response, error) {
  	return r.ApiService.SetJsonWebKeySetExecute(r)
  }
  
  /*
  SetJsonWebKeySet Update a JSON Web Key Set
  
  Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your own.
  
  A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
  
  	@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  	@param set The JSON Web Key Set ID
  	@return ApiSetJsonWebKeySetRequest
  */
  func (a *JwkAPIService) SetJsonWebKeySet(ctx context.Context, set string) ApiSetJsonWebKeySetRequest {
  	return ApiSetJsonWebKeySetRequest{
  		ApiService: a,
  		ctx:        ctx,
  		set:        set,
  	}
  }
  
  // Execute executes the request
  //
  //	@return JsonWebKeySet
  func (a *JwkAPIService) SetJsonWebKeySetExecute(r ApiSetJsonWebKeySetRequest) (*JsonWebKeySet, *http.Response, error) {
  	var (
  		localVarHTTPMethod  = http.MethodPut
  		localVarPostBody    interface{}
  		formFiles           []formFile
  		localVarReturnValue *JsonWebKeySet
  	)
  
  	localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "JwkAPIService.SetJsonWebKeySet")
  	if err != nil {
  		return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
  	}
  
  	localVarPath := localBasePath + "/admin/keys/{set}"
  	localVarPath = strings.Replace(localVarPath, "{"+"set"+"}", url.PathEscape(parameterValueToString(r.set, "set")), -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
  	}
  	// body params
  	localVarPostBody = r.jsonWebKeySet
  	req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
  	if err != nil {
  		return localVarReturnValue, nil, err
  	}
  
  	localVarHTTPResponse, err := a.client.callAPI(req)
  	if err != nil || localVarHTTPResponse == nil {
  		return localVarReturnValue, localVarHTTPResponse, err
  	}
  
  	localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
  	localVarHTTPResponse.Body.Close()
  	localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
  	if err != nil {
  		return localVarReturnValue, localVarHTTPResponse, err
  	}
  
  	if localVarHTTPResponse.StatusCode >= 300 {
  		newErr := &GenericOpenAPIError{
  			body:  localVarBody,
  			error: localVarHTTPResponse.Status,
  		}
  		var v ErrorOAuth2
  		err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
  		if err != nil {
  			newErr.error = err.Error()
  			return localVarReturnValue, localVarHTTPResponse, newErr
  		}
  		newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
  		newErr.model = v
  		return localVarReturnValue, localVarHTTPResponse, newErr
  	}
  
  	err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
  	if err != nil {
  		newErr := &GenericOpenAPIError{
  			body:  localVarBody,
  			error: err.Error(),
  		}
  		return localVarReturnValue, localVarHTTPResponse, newErr
  	}
  
  	return localVarReturnValue, localVarHTTPResponse, nil
  }
  