text: /**
   * ORY Hydra - Cloud Native OAuth 2.0 and OpenID Connect Server
   * Welcome to the ORY Hydra HTTP API documentation. You will find documentation for all HTTP APIs here. Keep in mind that this document reflects the latest branch, always. Support for versioned documentation is coming in the future.
   *
   * OpenAPI spec version: Latest
   * Contact: hi@ory.am
   *
   * NOTE: This class is auto generated by the swagger code generator program.
   * https://github.com/swagger-api/swagger-codegen.git
   *
   * Swagger Codegen version: 2.2.3
   *
   * Do not edit the class manually.
   *
   */
  
  ;(function(root, factory) {
    if (typeof define === 'function' && define.amd) {
      // AMD. Register as an anonymous module.
      define([
        'ApiClient',
        'model/AcceptConsentRequest',
        'model/AcceptLoginRequest',
        'model/CompletedRequest',
        'model/ConsentRequest',
        'model/FlushInactiveOAuth2TokensRequest',
        'model/InlineResponse401',
        'model/JsonWebKeySet',
        'model/LoginRequest',
        'model/OAuth2Client',
        'model/OAuth2TokenIntrospection',
        'model/OauthTokenResponse',
        'model/RejectRequest',
        'model/UserinfoResponse',
        'model/WellKnown'
      ], factory)
    } else if (typeof module === 'object' && module.exports) {
      // CommonJS-like environments that support module.exports, like Node.
      module.exports = factory(
        require('../ApiClient'),
        require('../model/AcceptConsentRequest'),
        require('../model/AcceptLoginRequest'),
        require('../model/CompletedRequest'),
        require('../model/ConsentRequest'),
        require('../model/FlushInactiveOAuth2TokensRequest'),
        require('../model/InlineResponse401'),
        require('../model/JsonWebKeySet'),
        require('../model/LoginRequest'),
        require('../model/OAuth2Client'),
        require('../model/OAuth2TokenIntrospection'),
        require('../model/OauthTokenResponse'),
        require('../model/RejectRequest'),
        require('../model/UserinfoResponse'),
        require('../model/WellKnown')
      )
    } else {
      // Browser globals (root is window)
      if (!root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer) {
        root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer = {}
      }
      root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.OAuth2Api = factory(
        root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.ApiClient,
        root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer
          .AcceptConsentRequest,
        root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.AcceptLoginRequest,
        root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.CompletedRequest,
        root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.ConsentRequest,
        root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer
          .FlushInactiveOAuth2TokensRequest,
        root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.InlineResponse401,
        root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.JsonWebKeySet,
        root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.LoginRequest,
        root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.OAuth2Client,
        root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer
          .OAuth2TokenIntrospection,
        root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.OauthTokenResponse,
        root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.RejectRequest,
        root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.UserinfoResponse,
        root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.WellKnown
      )
    }
  })(this, function(
    ApiClient,
    AcceptConsentRequest,
    AcceptLoginRequest,
    CompletedRequest,
    ConsentRequest,
    FlushInactiveOAuth2TokensRequest,
    InlineResponse401,
    JsonWebKeySet,
    LoginRequest,
    OAuth2Client,
    OAuth2TokenIntrospection,
    OauthTokenResponse,
    RejectRequest,
    UserinfoResponse,
    WellKnown
  ) {
    'use strict'
  
    /**
     * OAuth2 service.
     * @module api/OAuth2Api
     * @version Latest
     */
  
    /**
     * Constructs a new OAuth2Api.
     * @alias module:api/OAuth2Api
     * @class
     * @param {module:ApiClient} apiClient Optional API client implementation to use,
     * default to {@link module:ApiClient#instance} if unspecified.
     */
    var exports = function(apiClient) {
      this.apiClient = apiClient || ApiClient.instance
  
      /**
       * Callback function to receive the result of the acceptConsentRequest operation.
       * @callback module:api/OAuth2Api~acceptConsentRequestCallback
       * @param {String} error Error message, if any.
       * @param {module:model/CompletedRequest} data The data returned by the service call.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Accept an consent request
       * When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the login provider to authenticate the user and then tell ORY Hydra now about it. If the user authenticated, he/she must now be asked if the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the user&#39;s behalf.  The consent provider which handles this request and is a web app implemented and hosted by you. It shows a user interface which asks the user to grant or deny the client access to the requested scope (\&quot;Application my-dropbox-app wants write access to all your private files\&quot;).  The consent challenge is appended to the consent provider&#39;s URL to which the user&#39;s user-agent (browser) is redirected to. The consent provider uses that challenge to fetch information on the OAuth2 request and then tells ORY Hydra if the user accepted or rejected the request.  This endpoint tells ORY Hydra that the user has authorized the OAuth 2.0 client to access resources on his/her behalf. The consent provider includes additional information, such as session data for access and ID tokens, and if the consent request should be used as basis for future requests.  The response contains a redirect URL which the consent provider should redirect the user-agent to.
       * @param {String} challenge
       * @param {Object} opts Optional parameters
       * @param {module:model/AcceptConsentRequest} opts.body
       * @param {module:api/OAuth2Api~acceptConsentRequestCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link module:model/CompletedRequest}
       */
      this.acceptConsentRequest = function(challenge, opts, callback) {
        opts = opts || {}
        var postBody = opts['body']
  
        // verify the required parameter 'challenge' is set
        if (challenge === undefined || challenge === null) {
          throw new Error(
            "Missing the required parameter 'challenge' when calling acceptConsentRequest"
          )
        }
  
        var pathParams = {
          challenge: challenge
        }
        var queryParams = {}
        var headerParams = {}
        var formParams = {}
  
        var authNames = []
        var contentTypes = ['application/json']
        var accepts = ['application/json']
        var returnType = CompletedRequest
  
        return this.apiClient.callApi(
          '/oauth2/auth/requests/consent/{challenge}/accept',
          'PUT',
          pathParams,
          queryParams,
          headerParams,
          formParams,
          postBody,
          authNames,
          contentTypes,
          accepts,
          returnType,
          callback
        )
      }
  
      /**
       * Callback function to receive the result of the acceptLoginRequest operation.
       * @callback module:api/OAuth2Api~acceptLoginRequestCallback
       * @param {String} error Error message, if any.
       * @param {module:model/CompletedRequest} data The data returned by the service call.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Accept an login request
       * When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the login provider (sometimes called \&quot;identity provider\&quot;) to authenticate the user and then tell ORY Hydra now about it. The login provider is an web-app you write and host, and it must be able to authenticate (\&quot;show the user a login screen\&quot;) a user (in OAuth2 the proper name for user is \&quot;resource owner\&quot;).  The authentication challenge is appended to the login provider URL to which the user&#39;s user-agent (browser) is redirected to. The login provider uses that challenge to fetch information on the OAuth2 request and then accept or reject the requested authentication process.  This endpoint tells ORY Hydra that the user has successfully authenticated and includes additional information such as the user&#39;s ID and if ORY Hydra should remember the user&#39;s user agent for future authentication attempts by setting a cookie.  The response contains a redirect URL which the login provider should redirect the user-agent to.
       * @param {String} challenge
       * @param {Object} opts Optional parameters
       * @param {module:model/AcceptLoginRequest} opts.body
       * @param {module:api/OAuth2Api~acceptLoginRequestCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link module:model/CompletedRequest}
       */
      this.acceptLoginRequest = function(challenge, opts, callback) {
        opts = opts || {}
        var postBody = opts['body']
  
        // verify the required parameter 'challenge' is set
        if (challenge === undefined || challenge === null) {
          throw new Error(
            "Missing the required parameter 'challenge' when calling acceptLoginRequest"
          )
        }
  
        var pathParams = {
          challenge: challenge
        }
        var queryParams = {}
        var headerParams = {}
        var formParams = {}
  
        var authNames = []
        var contentTypes = ['application/json']
        var accepts = ['application/json']
        var returnType = CompletedRequest
  
        return this.apiClient.callApi(
          '/oauth2/auth/requests/login/{challenge}/accept',
          'PUT',
          pathParams,
          queryParams,
          headerParams,
          formParams,
          postBody,
          authNames,
          contentTypes,
          accepts,
          returnType,
          callback
        )
      }
  
      /**
       * Callback function to receive the result of the createOAuth2Client operation.
       * @callback module:api/OAuth2Api~createOAuth2ClientCallback
       * @param {String} error Error message, if any.
       * @param {module:model/OAuth2Client} data The data returned by the service call.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Create an OAuth 2.0 client
       * Create a new OAuth 2.0 client If you pass &#x60;client_secret&#x60; the secret will be used, otherwise a random secret will be generated. The secret will be returned in the response and you will not be able to retrieve it later on. Write the secret down and keep it somwhere safe.  OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities. To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well protected and only callable by first-party components.
       * @param {module:model/OAuth2Client} body
       * @param {module:api/OAuth2Api~createOAuth2ClientCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link module:model/OAuth2Client}
       */
      this.createOAuth2Client = function(body, callback) {
        var postBody = body
  
        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
          throw new Error(
            "Missing the required parameter 'body' when calling createOAuth2Client"
          )
        }
  
        var pathParams = {}
        var queryParams = {}
        var headerParams = {}
        var formParams = {}
  
        var authNames = []
        var contentTypes = ['application/json']
        var accepts = ['application/json']
        var returnType = OAuth2Client
  
        return this.apiClient.callApi(
          '/clients',
          'POST',
          pathParams,
          queryParams,
          headerParams,
          formParams,
          postBody,
          authNames,
          contentTypes,
          accepts,
          returnType,
          callback
        )
      }
  
      /**
       * Callback function to receive the result of the deleteOAuth2Client operation.
       * @callback module:api/OAuth2Api~deleteOAuth2ClientCallback
       * @param {String} error Error message, if any.
       * @param data This operation does not return a value.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Deletes an OAuth 2.0 Client
       * Delete an existing OAuth 2.0 Client by its ID.  OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities. To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well protected and only callable by first-party components.
       * @param {String} id The id of the OAuth 2.0 Client.
       * @param {module:api/OAuth2Api~deleteOAuth2ClientCallback} callback The callback function, accepting three arguments: error, data, response
       */
      this.deleteOAuth2Client = function(id, callback) {
        var postBody = null
  
        // verify the required parameter 'id' is set
        if (id === undefined || id === null) {
          throw new Error(
            "Missing the required parameter 'id' when calling deleteOAuth2Client"
          )
        }
  
        var pathParams = {
          id: id
        }
        var queryParams = {}
        var headerParams = {}
        var formParams = {}
  
        var authNames = []
        var contentTypes = ['application/json']
        var accepts = ['application/json']
        var returnType = null
  
        return this.apiClient.callApi(
          '/clients/{id}',
          'DELETE',
          pathParams,
          queryParams,
          headerParams,
          formParams,
          postBody,
          authNames,
          contentTypes,
          accepts,
          returnType,
          callback
        )
      }
  
      /**
       * Callback function to receive the result of the flushInactiveOAuth2Tokens operation.
       * @callback module:api/OAuth2Api~flushInactiveOAuth2TokensCallback
       * @param {String} error Error message, if any.
       * @param data This operation does not return a value.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Flush Expired OAuth2 Access Tokens
       * This endpoint flushes expired OAuth2 access tokens from the database. You can set a time after which no tokens will be not be touched, in case you want to keep recent tokens for auditing. Refresh tokens can not be flushed as they are deleted automatically when performing the refresh flow.
       * @param {Object} opts Optional parameters
       * @param {module:model/FlushInactiveOAuth2TokensRequest} opts.body
       * @param {module:api/OAuth2Api~flushInactiveOAuth2TokensCallback} callback The callback function, accepting three arguments: error, data, response
       */
      this.flushInactiveOAuth2Tokens = function(opts, callback) {
        opts = opts || {}
        var postBody = opts['body']
  
        var pathParams = {}
        var queryParams = {}
        var headerParams = {}
        var formParams = {}
  
        var authNames = []
        var contentTypes = ['application/json']
        var accepts = ['application/json']
        var returnType = null
  
        return this.apiClient.callApi(
          '/oauth2/flush',
          'POST',
          pathParams,
          queryParams,
          headerParams,
          formParams,
          postBody,
          authNames,
          contentTypes,
          accepts,
          returnType,
          callback
        )
      }
  
      /**
       * Callback function to receive the result of the getConsentRequest operation.
       * @callback module:api/OAuth2Api~getConsentRequestCallback
       * @param {String} error Error message, if any.
       * @param {module:model/ConsentRequest} data The data returned by the service call.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Get consent request information
       * When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the login provider to authenticate the user and then tell ORY Hydra now about it. If the user authenticated, he/she must now be asked if the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the user&#39;s behalf.  The consent provider which handles this request and is a web app implemented and hosted by you. It shows a user interface which asks the user to grant or deny the client access to the requested scope (\&quot;Application my-dropbox-app wants write access to all your private files\&quot;).  The consent challenge is appended to the consent provider&#39;s URL to which the user&#39;s user-agent (browser) is redirected to. The consent provider uses that challenge to fetch information on the OAuth2 request and then tells ORY Hydra if the user accepted or rejected the request.
       * @param {String} challenge
       * @param {module:api/OAuth2Api~getConsentRequestCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link module:model/ConsentRequest}
       */
      this.getConsentRequest = function(challenge, callback) {
        var postBody = null
  
        // verify the required parameter 'challenge' is set
        if (challenge === undefined || challenge === null) {
          throw new Error(
            "Missing the required parameter 'challenge' when calling getConsentRequest"
          )
        }
  
        var pathParams = {
          challenge: challenge
        }
        var queryParams = {}
        var headerParams = {}
        var formParams = {}
  
        var authNames = []
        var contentTypes = ['application/json']
        var accepts = ['application/json']
        var returnType = ConsentRequest
  
        return this.apiClient.callApi(
          '/oauth2/auth/requests/consent/{challenge}',
          'GET',
          pathParams,
          queryParams,
          headerParams,
          formParams,
          postBody,
          authNames,
          contentTypes,
          accepts,
          returnType,
          callback
        )
      }
  
      /**
       * Callback function to receive the result of the getLoginRequest operation.
       * @callback module:api/OAuth2Api~getLoginRequestCallback
       * @param {String} error Error message, if any.
       * @param {module:model/LoginRequest} data The data returned by the service call.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Get an login request
       * When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the login provider (sometimes called \&quot;identity provider\&quot;) to authenticate the user and then tell ORY Hydra now about it. The login provider is an web-app you write and host, and it must be able to authenticate (\&quot;show the user a login screen\&quot;) a user (in OAuth2 the proper name for user is \&quot;resource owner\&quot;).  The authentication challenge is appended to the login provider URL to which the user&#39;s user-agent (browser) is redirected to. The login provider uses that challenge to fetch information on the OAuth2 request and then accept or reject the requested authentication process.
       * @param {String} challenge
       * @param {module:api/OAuth2Api~getLoginRequestCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link module:model/LoginRequest}
       */
      this.getLoginRequest = function(challenge, callback) {
        var postBody = null
  
        // verify the required parameter 'challenge' is set
        if (challenge === undefined || challenge === null) {
          throw new Error(
            "Missing the required parameter 'challenge' when calling getLoginRequest"
          )
        }
  
        var pathParams = {
          challenge: challenge
        }
        var queryParams = {}
        var headerParams = {}
        var formParams = {}
  
        var authNames = []
        var contentTypes = ['application/json']
        var accepts = ['application/json']
        var returnType = LoginRequest
  
        return this.apiClient.callApi(
          '/oauth2/auth/requests/login/{challenge}',
          'GET',
          pathParams,
          queryParams,
          headerParams,
          formParams,
          postBody,
          authNames,
          contentTypes,
          accepts,
          returnType,
          callback
        )
      }
  
      /**
       * Callback function to receive the result of the getOAuth2Client operation.
       * @callback module:api/OAuth2Api~getOAuth2ClientCallback
       * @param {String} error Error message, if any.
       * @param {module:model/OAuth2Client} data The data returned by the service call.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Get an OAuth 2.0 Client.
       * Get an OAUth 2.0 client by its ID. This endpoint never returns passwords.  OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities. To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well protected and only callable by first-party components.
       * @param {String} id The id of the OAuth 2.0 Client.
       * @param {module:api/OAuth2Api~getOAuth2ClientCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link module:model/OAuth2Client}
       */
      this.getOAuth2Client = function(id, callback) {
        var postBody = null
  
        // verify the required parameter 'id' is set
        if (id === undefined || id === null) {
          throw new Error(
            "Missing the required parameter 'id' when calling getOAuth2Client"
          )
        }
  
        var pathParams = {
          id: id
        }
        var queryParams = {}
        var headerParams = {}
        var formParams = {}
  
        var authNames = []
        var contentTypes = ['application/json']
        var accepts = ['application/json']
        var returnType = OAuth2Client
  
        return this.apiClient.callApi(
          '/clients/{id}',
          'GET',
          pathParams,
          queryParams,
          headerParams,
          formParams,
          postBody,
          authNames,
          contentTypes,
          accepts,
          returnType,
          callback
        )
      }
  
      /**
       * Callback function to receive the result of the getWellKnown operation.
       * @callback module:api/OAuth2Api~getWellKnownCallback
       * @param {String} error Error message, if any.
       * @param {module:model/WellKnown} data The data returned by the service call.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Server well known configuration
       * The well known endpoint an be used to retrieve information for OpenID Connect clients. We encourage you to not roll your own OpenID Connect client but to use an OpenID Connect client library instead. You can learn more on this flow at https://openid.net/specs/openid-connect-discovery-1_0.html
       * @param {module:api/OAuth2Api~getWellKnownCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link module:model/WellKnown}
       */
      this.getWellKnown = function(callback) {
        var postBody = null
  
        var pathParams = {}
        var queryParams = {}
        var headerParams = {}
        var formParams = {}
  
        var authNames = []
        var contentTypes = [
          'application/json',
          'application/x-www-form-urlencoded'
        ]
        var accepts = ['application/json']
        var returnType = WellKnown
  
        return this.apiClient.callApi(
          '/.well-known/openid-configuration',
          'GET',
          pathParams,
          queryParams,
          headerParams,
          formParams,
          postBody,
          authNames,
          contentTypes,
          accepts,
          returnType,
          callback
        )
      }
  
      /**
       * Callback function to receive the result of the introspectOAuth2Token operation.
       * @callback module:api/OAuth2Api~introspectOAuth2TokenCallback
       * @param {String} error Error message, if any.
       * @param {module:model/OAuth2TokenIntrospection} data The data returned by the service call.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Introspect OAuth2 tokens
       * The introspection endpoint allows to check if a token (both refresh and access) is active or not. An active token is neither expired nor revoked. If a token is active, additional information on the token will be included. You can set additional data for a token by setting &#x60;accessTokenExtra&#x60; during the consent flow.
       * @param {String} token The string value of the token. For access tokens, this is the \&quot;access_token\&quot; value returned from the token endpoint defined in OAuth 2.0 [RFC6749], Section 5.1. This endpoint DOES NOT accept refresh tokens for validation.
       * @param {Object} opts Optional parameters
       * @param {String} opts.scope An optional, space separated list of required scopes. If the access token was not granted one of the scopes, the result of active will be false.
       * @param {module:api/OAuth2Api~introspectOAuth2TokenCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link module:model/OAuth2TokenIntrospection}
       */
      this.introspectOAuth2Token = function(token, opts, callback) {
        opts = opts || {}
        var postBody = null
  
        // verify the required parameter 'token' is set
        if (token === undefined || token === null) {
          throw new Error(
            "Missing the required parameter 'token' when calling introspectOAuth2Token"
          )
        }
  
        var pathParams = {}
        var queryParams = {}
        var headerParams = {}
        var formParams = {
          token: token,
          scope: opts['scope']
        }
  
        var authNames = ['basic', 'oauth2']
        var contentTypes = ['application/x-www-form-urlencoded']
        var accepts = ['application/json']
        var returnType = OAuth2TokenIntrospection
  
        return this.apiClient.callApi(
          '/oauth2/introspect',
          'POST',
          pathParams,
          queryParams,
          headerParams,
          formParams,
          postBody,
          authNames,
          contentTypes,
          accepts,
          returnType,
          callback
        )
      }
  
      /**
       * Callback function to receive the result of the listOAuth2Clients operation.
       * @callback module:api/OAuth2Api~listOAuth2ClientsCallback
       * @param {String} error Error message, if any.
       * @param {Array.<module:model/OAuth2Client>} data The data returned by the service call.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * List OAuth 2.0 Clients
       * This endpoint lists all clients in the database, and never returns client secrets.  OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities. To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well protected and only callable by first-party components.
       * @param {Object} opts Optional parameters
       * @param {Number} opts.limit The maximum amount of policies returned.
       * @param {Number} opts.offset The offset from where to start looking.
       * @param {module:api/OAuth2Api~listOAuth2ClientsCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link Array.<module:model/OAuth2Client>}
       */
      this.listOAuth2Clients = function(opts, callback) {
        opts = opts || {}
        var postBody = null
  
        var pathParams = {}
        var queryParams = {
          limit: opts['limit'],
          offset: opts['offset']
        }
        var headerParams = {}
        var formParams = {}
  
        var authNames = []
        var contentTypes = ['application/json']
        var accepts = ['application/json']
        var returnType = [OAuth2Client]
  
        return this.apiClient.callApi(
          '/clients',
          'GET',
          pathParams,
          queryParams,
          headerParams,
          formParams,
          postBody,
          authNames,
          contentTypes,
          accepts,
          returnType,
          callback
        )
      }
  
      /**
       * Callback function to receive the result of the oauthAuth operation.
       * @callback module:api/OAuth2Api~oauthAuthCallback
       * @param {String} error Error message, if any.
       * @param data This operation does not return a value.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * The OAuth 2.0 authorize endpoint
       * This endpoint is not documented here because you should never use your own implementation to perform OAuth2 flows. OAuth2 is a very popular protocol and a library for your programming language will exists.  To learn more about this flow please refer to the specification: https://tools.ietf.org/html/rfc6749
       * @param {module:api/OAuth2Api~oauthAuthCallback} callback The callback function, accepting three arguments: error, data, response
       */
      this.oauthAuth = function(callback) {
        var postBody = null
  
        var pathParams = {}
        var queryParams = {}
        var headerParams = {}
        var formParams = {}
  
        var authNames = []
        var contentTypes = ['application/x-www-form-urlencoded']
        var accepts = ['application/json']
        var returnType = null
  
        return this.apiClient.callApi(
          '/oauth2/auth',
          'GET',
          pathParams,
          queryParams,
          headerParams,
          formParams,
          postBody,
          authNames,
          contentTypes,
          accepts,
          returnType,
          callback
        )
      }
  
      /**
       * Callback function to receive the result of the oauthToken operation.
       * @callback module:api/OAuth2Api~oauthTokenCallback
       * @param {String} error Error message, if any.
       * @param {module:model/OauthTokenResponse} data The data returned by the service call.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * The OAuth 2.0 token endpoint
       * This endpoint is not documented here because you should never use your own implementation to perform OAuth2 flows. OAuth2 is a very popular protocol and a library for your programming language will exists.  To learn more about this flow please refer to the specification: https://tools.ietf.org/html/rfc6749
       * @param {module:api/OAuth2Api~oauthTokenCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link module:model/OauthTokenResponse}
       */
      this.oauthToken = function(callback) {
        var postBody = null
  
        var pathParams = {}
        var queryParams = {}
        var headerParams = {}
        var formParams = {}
  
        var authNames = ['basic', 'oauth2']
        var contentTypes = ['application/x-www-form-urlencoded']
        var accepts = ['application/json']
        var returnType = OauthTokenResponse
  
        return this.apiClient.callApi(
          '/oauth2/token',
          'POST',
          pathParams,
          queryParams,
          headerParams,
          formParams,
          postBody,
          authNames,
          contentTypes,
          accepts,
          returnType,
          callback
        )
      }
  
      /**
       * Callback function to receive the result of the rejectConsentRequest operation.
       * @callback module:api/OAuth2Api~rejectConsentRequestCallback
       * @param {String} error Error message, if any.
       * @param {module:model/CompletedRequest} data The data returned by the service call.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Reject an consent request
       * When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the login provider to authenticate the user and then tell ORY Hydra now about it. If the user authenticated, he/she must now be asked if the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the user&#39;s behalf.  The consent provider which handles this request and is a web app implemented and hosted by you. It shows a user interface which asks the user to grant or deny the client access to the requested scope (\&quot;Application my-dropbox-app wants write access to all your private files\&quot;).  The consent challenge is appended to the consent provider&#39;s URL to which the user&#39;s user-agent (browser) is redirected to. The consent provider uses that challenge to fetch information on the OAuth2 request and then tells ORY Hydra if the user accepted or rejected the request.  This endpoint tells ORY Hydra that the user has not authorized the OAuth 2.0 client to access resources on his/her behalf. The consent provider must include a reason why the consent was not granted.  The response contains a redirect URL which the consent provider should redirect the user-agent to.
       * @param {String} challenge
       * @param {Object} opts Optional parameters
       * @param {module:model/RejectRequest} opts.body
       * @param {module:api/OAuth2Api~rejectConsentRequestCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link module:model/CompletedRequest}
       */
      this.rejectConsentRequest = function(challenge, opts, callback) {
        opts = opts || {}
        var postBody = opts['body']
  
        // verify the required parameter 'challenge' is set
        if (challenge === undefined || challenge === null) {
          throw new Error(
            "Missing the required parameter 'challenge' when calling rejectConsentRequest"
          )
        }
  
        var pathParams = {
          challenge: challenge
        }
        var queryParams = {}
        var headerParams = {}
        var formParams = {}
  
        var authNames = []
        var contentTypes = ['application/json']
        var accepts = ['application/json']
        var returnType = CompletedRequest
  
        return this.apiClient.callApi(
          '/oauth2/auth/requests/consent/{challenge}/reject',
          'PUT',
          pathParams,
          queryParams,
          headerParams,
          formParams,
          postBody,
          authNames,
          contentTypes,
          accepts,
          returnType,
          callback
        )
      }
  
      /**
       * Callback function to receive the result of the rejectLoginRequest operation.
       * @callback module:api/OAuth2Api~rejectLoginRequestCallback
       * @param {String} error Error message, if any.
       * @param {module:model/CompletedRequest} data The data returned by the service call.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Reject a login request
       * When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the login provider (sometimes called \&quot;identity provider\&quot;) to authenticate the user and then tell ORY Hydra now about it. The login provider is an web-app you write and host, and it must be able to authenticate (\&quot;show the user a login screen\&quot;) a user (in OAuth2 the proper name for user is \&quot;resource owner\&quot;).  The authentication challenge is appended to the login provider URL to which the user&#39;s user-agent (browser) is redirected to. The login provider uses that challenge to fetch information on the OAuth2 request and then accept or reject the requested authentication process.  This endpoint tells ORY Hydra that the user has not authenticated and includes a reason why the authentication was be denied.  The response contains a redirect URL which the login provider should redirect the user-agent to.
       * @param {String} challenge
       * @param {Object} opts Optional parameters
       * @param {module:model/RejectRequest} opts.body
       * @param {module:api/OAuth2Api~rejectLoginRequestCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link module:model/CompletedRequest}
       */
      this.rejectLoginRequest = function(challenge, opts, callback) {
        opts = opts || {}
        var postBody = opts['body']
  
        // verify the required parameter 'challenge' is set
        if (challenge === undefined || challenge === null) {
          throw new Error(
            "Missing the required parameter 'challenge' when calling rejectLoginRequest"
          )
        }
  
        var pathParams = {
          challenge: challenge
        }
        var queryParams = {}
        var headerParams = {}
        var formParams = {}
  
        var authNames = []
        var contentTypes = ['application/json']
        var accepts = ['application/json']
        var returnType = CompletedRequest
  
        return this.apiClient.callApi(
          '/oauth2/auth/requests/login/{challenge}/reject',
          'PUT',
          pathParams,
          queryParams,
          headerParams,
          formParams,
          postBody,
          authNames,
          contentTypes,
          accepts,
          returnType,
          callback
        )
      }
  
      /**
       * Callback function to receive the result of the revokeAllUserConsentSessions operation.
       * @callback module:api/OAuth2Api~revokeAllUserConsentSessionsCallback
       * @param {String} error Error message, if any.
       * @param data This operation does not return a value.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Revokes all previous consent sessions of a user
       * This endpoint revokes a user&#39;s granted consent sessions and invalidates all associated OAuth 2.0 Access Tokens.
       * @param {String} user
       * @param {module:api/OAuth2Api~revokeAllUserConsentSessionsCallback} callback The callback function, accepting three arguments: error, data, response
       */
      this.revokeAllUserConsentSessions = function(user, callback) {
        var postBody = null
  
        // verify the required parameter 'user' is set
        if (user === undefined || user === null) {
          throw new Error(
            "Missing the required parameter 'user' when calling revokeAllUserConsentSessions"
          )
        }
  
        var pathParams = {
          user: user
        }
        var queryParams = {}
        var headerParams = {}
        var formParams = {}
  
        var authNames = []
        var contentTypes = ['application/json']
        var accepts = ['application/json']
        var returnType = null
  
        return this.apiClient.callApi(
          '/oauth2/auth/sessions/consent/{user}',
          'DELETE',
          pathParams,
          queryParams,
          headerParams,
          formParams,
          postBody,
          authNames,
          contentTypes,
          accepts,
          returnType,
          callback
        )
      }
  
      /**
       * Callback function to receive the result of the revokeAuthenticationSession operation.
       * @callback module:api/OAuth2Api~revokeAuthenticationSessionCallback
       * @param {String} error Error message, if any.
       * @param data This operation does not return a value.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Invalidates a user&#39;s authentication session
       * This endpoint invalidates a user&#39;s authentication session. After revoking the authentication session, the user has to re-authenticate at ORY Hydra. This endpoint does not invalidate any tokens.
       * @param {String} user
       * @param {module:api/OAuth2Api~revokeAuthenticationSessionCallback} callback The callback function, accepting three arguments: error, data, response
       */
      this.revokeAuthenticationSession = function(user, callback) {
        var postBody = null
  
        // verify the required parameter 'user' is set
        if (user === undefined || user === null) {
          throw new Error(
            "Missing the required parameter 'user' when calling revokeAuthenticationSession"
          )
        }
  
        var pathParams = {
          user: user
        }
        var queryParams = {}
        var headerParams = {}
        var formParams = {}
  
        var authNames = []
        var contentTypes = ['application/json']
        var accepts = ['application/json']
        var returnType = null
  
        return this.apiClient.callApi(
          '/oauth2/auth/sessions/login/{user}',
          'DELETE',
          pathParams,
          queryParams,
          headerParams,
          formParams,
          postBody,
          authNames,
          contentTypes,
          accepts,
          returnType,
          callback
        )
      }
  
      /**
       * Callback function to receive the result of the revokeOAuth2Token operation.
       * @callback module:api/OAuth2Api~revokeOAuth2TokenCallback
       * @param {String} error Error message, if any.
       * @param data This operation does not return a value.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Revoke OAuth2 tokens
       * Revoking a token (both access and refresh) means that the tokens will be invalid. A revoked access token can no longer be used to make access requests, and a revoked refresh token can no longer be used to refresh an access token. Revoking a refresh token also invalidates the access token that was created with it.
       * @param {String} token
       * @param {module:api/OAuth2Api~revokeOAuth2TokenCallback} callback The callback function, accepting three arguments: error, data, response
       */
      this.revokeOAuth2Token = function(token, callback) {
        var postBody = null
  
        // verify the required parameter 'token' is set
        if (token === undefined || token === null) {
          throw new Error(
            "Missing the required parameter 'token' when calling revokeOAuth2Token"
          )
        }
  
        var pathParams = {}
        var queryParams = {}
        var headerParams = {}
        var formParams = {
          token: token
        }
  
        var authNames = ['basic', 'oauth2']
        var contentTypes = ['application/x-www-form-urlencoded']
        var accepts = ['application/json']
        var returnType = null
  
        return this.apiClient.callApi(
          '/oauth2/revoke',
          'POST',
          pathParams,
          queryParams,
          headerParams,
          formParams,
          postBody,
          authNames,
          contentTypes,
          accepts,
          returnType,
          callback
        )
      }
  
      /**
       * Callback function to receive the result of the revokeUserClientConsentSessions operation.
       * @callback module:api/OAuth2Api~revokeUserClientConsentSessionsCallback
       * @param {String} error Error message, if any.
       * @param data This operation does not return a value.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Revokes consent sessions of a user for a specific OAuth 2.0 Client
       * This endpoint revokes a user&#39;s granted consent sessions for a specific OAuth 2.0 Client and invalidates all associated OAuth 2.0 Access Tokens.
       * @param {String} user
       * @param {String} client
       * @param {module:api/OAuth2Api~revokeUserClientConsentSessionsCallback} callback The callback function, accepting three arguments: error, data, response
       */
      this.revokeUserClientConsentSessions = function(user, client, callback) {
        var postBody = null
  
        // verify the required parameter 'user' is set
        if (user === undefined || user === null) {
          throw new Error(
            "Missing the required parameter 'user' when calling revokeUserClientConsentSessions"
          )
        }
  
        // verify the required parameter 'client' is set
        if (client === undefined || client === null) {
          throw new Error(
            "Missing the required parameter 'client' when calling revokeUserClientConsentSessions"
          )
        }
  
        var pathParams = {
          user: user,
          client: client
        }
        var queryParams = {}
        var headerParams = {}
        var formParams = {}
  
        var authNames = []
        var contentTypes = ['application/json']
        var accepts = ['application/json']
        var returnType = null
  
        return this.apiClient.callApi(
          '/oauth2/auth/sessions/consent/{user}/{client}',
          'DELETE',
          pathParams,
          queryParams,
          headerParams,
          formParams,
          postBody,
          authNames,
          contentTypes,
          accepts,
          returnType,
          callback
        )
      }
  
      /**
       * Callback function to receive the result of the updateOAuth2Client operation.
       * @callback module:api/OAuth2Api~updateOAuth2ClientCallback
       * @param {String} error Error message, if any.
       * @param {module:model/OAuth2Client} data The data returned by the service call.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Update an OAuth 2.0 Client
       * Update an existing OAuth 2.0 Client. If you pass &#x60;client_secret&#x60; the secret will be updated and returned via the API. This is the only time you will be able to retrieve the client secret, so write it down and keep it safe.  OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities. To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well protected and only callable by first-party components.
       * @param {String} id
       * @param {module:model/OAuth2Client} body
       * @param {module:api/OAuth2Api~updateOAuth2ClientCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link module:model/OAuth2Client}
       */
      this.updateOAuth2Client = function(id, body, callback) {
        var postBody = body
  
        // verify the required parameter 'id' is set
        if (id === undefined || id === null) {
          throw new Error(
            "Missing the required parameter 'id' when calling updateOAuth2Client"
          )
        }
  
        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
          throw new Error(
            "Missing the required parameter 'body' when calling updateOAuth2Client"
          )
        }
  
        var pathParams = {
          id: id
        }
        var queryParams = {}
        var headerParams = {}
        var formParams = {}
  
        var authNames = []
        var contentTypes = ['application/json']
        var accepts = ['application/json']
        var returnType = OAuth2Client
  
        return this.apiClient.callApi(
          '/clients/{id}',
          'PUT',
          pathParams,
          queryParams,
          headerParams,
          formParams,
          postBody,
          authNames,
          contentTypes,
          accepts,
          returnType,
          callback
        )
      }
  
      /**
       * Callback function to receive the result of the userinfo operation.
       * @callback module:api/OAuth2Api~userinfoCallback
       * @param {String} error Error message, if any.
       * @param {module:model/UserinfoResponse} data The data returned by the service call.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * OpenID Connect Userinfo
       * This endpoint returns the payload of the ID Token, including the idTokenExtra values, of the provided OAuth 2.0 access token. The endpoint implements http://openid.net/specs/openid-connect-core-1_0.html#UserInfo .
       * @param {module:api/OAuth2Api~userinfoCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link module:model/UserinfoResponse}
       */
      this.userinfo = function(callback) {
        var postBody = null
  
        var pathParams = {}
        var queryParams = {}
        var headerParams = {}
        var formParams = {}
  
        var authNames = ['oauth2']
        var contentTypes = [
          'application/json',
          'application/x-www-form-urlencoded'
        ]
        var accepts = ['application/json']
        var returnType = UserinfoResponse
  
        return this.apiClient.callApi(
          '/userinfo',
          'POST',
          pathParams,
          queryParams,
          headerParams,
          formParams,
          postBody,
          authNames,
          contentTypes,
          accepts,
          returnType,
          callback
        )
      }
  
      /**
       * Callback function to receive the result of the wellKnown operation.
       * @callback module:api/OAuth2Api~wellKnownCallback
       * @param {String} error Error message, if any.
       * @param {module:model/JsonWebKeySet} data The data returned by the service call.
       * @param {String} response The complete HTTP response.
       */
  
      /**
       * Get Well-Known JSON Web Keys
       * Returns metadata for discovering important JSON Web Keys. Currently, this endpoint returns the public key for verifying OpenID Connect ID Tokens.  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 {module:api/OAuth2Api~wellKnownCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link module:model/JsonWebKeySet}
       */
      this.wellKnown = function(callback) {
        var postBody = null
  
        var pathParams = {}
        var queryParams = {}
        var headerParams = {}
        var formParams = {}
  
        var authNames = []
        var contentTypes = ['application/json']
        var accepts = ['application/json']
        var returnType = JsonWebKeySet
  
        return this.apiClient.callApi(
          '/.well-known/jwks.json',
          'GET',
          pathParams,
          queryParams,
          headerParams,
          formParams,
          postBody,
          authNames,
          contentTypes,
          accepts,
          returnType,
          callback
        )
      }
    }
  
    return exports
  })
  