apisuite-be (master) doxdox documentation

APISuite backend core API

# exchangeCode(code, ssoClient, discoveryData, redirectURL)

Exchanges the authorization code for the access/ID tokens.

Parameters

Name Types Description
code string
ssoClient object
discoveryData object - Object with the data returned from OIDC discovery endpoint
redirectURL string

# tokenVerifier(token, clientID, discoveryData)

Verifies the validity of an ID token.

Parameters

Name Types Description
token string - ID token
clientID string
discoveryData object - Object with the data returned from OIDC discovery endpoint

# cleanInternalConfig(settings, settings.provider, settings.configuration)

Parameters

Name Types Description
settings object
settings.provider string
settings.configuration object

# accessControl(action, possession, resource, options, options.idCarrier, options.idField, options.adminOverride)

Parameters

Name Types Description
action String - Access control action (create, read, update, delete)
possession String - Access control possession (any, own)
resource String - Access control resource name
options Object
options.idCarrier String - Express request field that carries the resource ID (params, body, etc)
options.idField String - Field name that corresponds to the resource ID in the idCarrier (ex.: /:userId)
options.adminOverride Boolean - If true, 'admin' role gets access to the resource, independently of grants. Default false

# checkOwnPossessionAndIdField(possession, idCarrier, idField)

Checks if configured access control possession is OWN and if id field is present in the configured carrier.

Parameters

Name Types Description
possession String
idCarrier String
idField String

# Organization.getWithAppCount(page, pageSize)

Parameters

Name Types Description
page number
pageSize number

# UserOrganization.getUserOrgsWithUsersCount(userID, transaction)

Returns a list of organizations belonging to a user, along with the count of admins/organizationOwners in those organizations

Parameters

Name Types Description
userID number
transaction object

# router.deleteAsync()

# router.deleteAsync()

# router.getAsync()

# router.getAsync()

# router.getAsync()

# router.patchAsync()

# router.patchAsync()

# router.postAsync()

# router.postAsync()

# router.postAsync()

# router.postAsync()

# router.getAsync()

# router.getAsync()

# router.getAsync()

# router.getAsync()

# router.postAsync()

# router.postAsync()

# router.postAsync()

# router.getAsync()

# router.getAsync()

# router.postAsync()

# router.postAsync()

# router.postAsync()

# router.postAsync()

# router.getAsync()

# router.getAsync()

# router.postAsync()

# router.postAsync()

# router.postAsync()

# router.deleteAsync()

# router.postAsync()

# router.deleteAsync()

# router.getAsync()

# router.getAsync()

# router.patchAsync()

# router.postAsync()

# router.postAsync()

# router.postAsync()

# router.putAsync()

# router.putAsync()

# router.deleteAsync()

# router.putAsync()

# router.deleteAsync()

# router.deleteAsync()

# router.getAsync()

# router.getAsync()

# router.getAsync()

# router.getAsync()

# router.getAsync()

# router.getAsync()

# router.postAsync()

# router.postAsync()

# router.putAsync()

# router.putAsync()

# router.getAsync()

# router.postAsync()

# router.deleteAsync()

# router.getAsync()

# router.getAsync()

# router.postAsync()

# router.putAsync()

# router.postAsync()

# router.postAsync()

# router.postAsync()

# router.get()

# router.postAsync()

# router.getAsync()

# router.postAsync()

# router.getAsync()

# router.getAsync()

# router.getAsync()

# router.getAsync()

# router.getAsync()

# router.postAsync()

# router.postAsync()

# router.putAsync()

# router.putAsync()

# router.putAsync()

# router.putAsync()

# router.getAsync()

# router.putAsync()

# router.postAsync()

# router.getAsync()

# router.getAsync()

# router.putAsync()

# router.deleteAsync()

# router.getAsync()

# router.postAsync()

# router.deleteAsync()

# router.deleteAsync()

# router.getAsync()

# router.getAsync()

# router.postAsync()

# router.postAsync()

# router.postAsync()

# router.postAsync()

# router.postAsync()

# router.postAsync()

# router.putAsync()

# router.putAsync()

# validatePassword(password)

Password validation.

Parameters

Name Types Description
password string

# module.exports(schema, payloadPath, extraValidation)

Returns a validator middleware for the provided schema.

Parameters

Name Types Description
schema object - Joi validation schema (or any object with a similar 'validate' function).
payloadPath string - Path to the payload to be validated, within Express's req object. Defaults to 'body'. Dot separated names are accepted. Accepts paths to nested properties, such as 'formdata.fields', which will trigger validation in 'req.formdata.fields'. If the req object does not contain the specified path, the request will be considered invalid and 400 will be sent.
extraValidation function - Additional validation to be executed after the basic schema validation. This function be passed the selected payload and should return an object containing an 'errors' property.

# sendInviteNewUserToOrg(message, message.email, message.token, options, options.logo, options.noReject)

Send an invitation to add new user into the organization

Parameters

Name Types Description
message Object Object with the message options
message.email String Destination email address
message.token String Invitation token
options Object Options object
options.logo String Organization logo URL
options.noReject Boolean Show/hide reject option on UI (default to false)

# sendInviteToOrg(message, message.email, message.token, options, options.logo)

Send an invitation to add to the organization

Parameters

Name Types Description
message Object Object with the message options
message.email String Destination email address
message.token String Invitation token
options Object Options object
options.logo String Organization logo URL

# sendRecoverPassword(message, message.email, message.token, options, options.logo)

Sends a password recovery email

Parameters

Name Types Description
message Object Object with the message options
message.email String Destination email address
message.token String Password recovery token
options Object Options object
options.logo String Organization logo URL

# sendRegisterConfirmation(message, message.email, message.token, options, options.logo)

Sends a registration confirmation email

Parameters

Name Types Description
message Object Object with the message options
message.email String Destination email address
message.token String Registration token
options Object Options object
options.logo String Organization logo URL

# module.exports.send(message, message.from, message.to, message.subject, message.text, message.html)

Send the email

Parameters

Name Types Description
message Object Object with the message options
message.from String The sender email address
message.to String The email of the receiver
message.subject String The subject line
message.text String The plain text email body
message.html String The html email body

# _consumerExists(consumerName, clientId)

Check if the consumer exists and has the authentication setup in the gateway.

Parameters

Name Types Description
consumerName String The consumer name.
clientId String The app client id.

# _createConsumer(consumerName)

Create a consumer in the gateway.

Parameters

Name Types Description
consumerName String Number

# _createConsumerAuth(consumerName, clientId)

Create a consumer authentication in the gateway.

Parameters

Name Types Description
consumerName String The consumer name.
clientId String The app client id.

# _createConsumerSubscription(consumerName, subscription)

Create a consumer subscription in the gateway.

Parameters

Name Types Description
consumerName String The consumer name.
subscription String Number

# _filterPublicAPIs(service)

Filter the service by tags with public value.

Parameters

Name Types Description
service Object Kong service list.

# _getConsumerSubscriptionId(consumerName, subscriptionName)

Get the subscription id in the gateway.

Parameters

Name Types Description
consumerName String The consumer name.
subscriptionName String The subscription/api name.

# _handleServicesNext(next, apiKey, services)

Recursive function to handle service list pagination and filter them.

Parameters

Name Types Description
next String URL to fetch the next services list.
apiKey String API key to authorize the request.
services Array<Object> Array with the current list of services.

# _removeConsumer(consumerName)

Removes a consumer in the gateway.

Parameters

Name Types Description
consumerName String The consumer name.

# _removeConsumerSubscription(consumerName, subscriptionId)

Remove a consumer subscription in the gateway.

Parameters

Name Types Description
consumerName String The consumer name.
subscriptionId String The subcription id in the gateway.

# _unsubscribeAPI(consumerName, subscriptionName)

Remove subscription to an API in the gateway

Parameters

Name Types Description
consumerName String The consumer name.
subscriptionName String The subscription/api name.

# configureGatewaySubscription(service, subscription)

Configures a Kong service to support subscription in the form of ACL with api key.

Parameters

Name Types Description
service String The remote service name or id.
subscription Promise<String Number>

# getServicesData()

Get the list of Kong services.

# removeApp(consumerName)

Removes an app from the gateway

Parameters

Name Types Description
consumerName String The consumer name (app id).

# setupApisFromServices(services)

Takes a list of Kong services, creates the respective APISuite core APIs and configures the services in the gateway for subscription support.

Parameters

Name Types Description
services Object[] List of public apis in the gateway.

# subscribeAll(consumerName, clientId)

Subscribes to all APIs by subscribing to the global subscription tag.

Parameters

Name Types Description
consumerName String The consumer name, can be the app name.
clientId Promise<String> The app client id.

# subscribeAPIs(consumerName, clientId, subscriptions)

Subscribe to an API in the gateway

Parameters

Name Types Description
consumerName String The consumer name, can be the app name.
clientId String The app client id.
subscriptions String[] The subscriptions name/tag that the app will subscribe to.

# unsubscribeAll(consumerName, clientId)

Unsubscribes to all APIs by subscribing to the global subscription tag.

Parameters

Name Types Description
consumerName String The consumer name, can be the app name.
clientId Promise<String> The app client id.

# unsubscribeAPIs(consumerName, subscriptions)

Remove subscription to a set of APIs in the gateway

Parameters

Name Types Description
consumerName String The consumer name.
subscriptions String[] The subscription/api names.

# createClient(clientConfig)

Parameters

Name Types Description
clientConfig IdPClientConfig

# deleteClient(clientID, clientData)

Parameters

Name Types Description
clientID string
clientData object

# getUserProfileURL(userID)

Parameters

Name Types Description
userID string

# generateRefreshToken()

Generates a refresh token composed of a randomly generated string

# generateTokenSet(userID)

Generates set of access/refresh tokens for a user.

Parameters

Name Types Description
userID string number

# signAccessToken(userID, data)

Generates a signed access token

Parameters

Name Types Description
userID string number
data object - Extra claims to include in the token (defaults to empty object)

# validateAccessToken(token)

Validates and decodes an access token

Parameters

Name Types Description
token string - Access token to verify

# publishEvent(routingKey, event)

Asynchronously publishes an APISuite event in the Message Broker.

Parameters

Name Types Description
routingKey String
event object

# keys()

These are the routing keys for the message broker. As a rule, they must contain at least 3 parts: [component].[domain].[action] In the context of this api: - the component part will almost always be 'api' - domain corresponds to a certain domain model or service in which some action took place - action is the actual event, such as 'created', 'deleted', and so on

# deleteFile(objectURL)

Parameters

Name Types Description
objectURL String

# saveFile(filePath, name)

Parameters

Name Types Description
filePath String - file to save on the cloud
name String - name for the file on the cloud

# checkIfOpenAPI(swagger)

Check if the swagger object is a Open API 3.0 file

Parameters

Name Types Description
swagger Object - The swagger object

# getRegexRoutes(apiSpec)

Parameters

Name Types Description
apiSpec Object - Parsed OpenAPI contract object

# validateSwagger(swagger)

Validate the swagger object

Parameters

Name Types Description
swagger Object - The swagger object