Skip to main content
Skip to main content

upsert - API Key Module Reference

This documentation provides a reference to the upsert method. This belongs to the API Key Module.

upsert(data, sharedContext?): Promise<ApiKeyDTO[]>

This method updates or creates API keys if they don't exist.

Example

const apiKey = await apiKeyModuleService.upsert([
{
id: "apk_123",
title: "My development key",
},
{
title: "New development key",
type: "secret",
created_by: "user_123",
},
])

Parameters

dataUpsertApiKeyDTO[]Required
The attributes in the API keys that are created or updated.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ApiKeyDTO[]>Required
The created or updated API keys.

upsert(data, sharedContext?): Promise<ApiKeyDTO>

This method updates or creates an API key if it doesn't exist.

Example

const apiKey = await apiKeyModuleService.upsert({
id: "apk_123",
title: "My development key"
})

Parameters

dataUpsertApiKeyDTORequired
The attributes in the API key that's created or updated.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ApiKeyDTO>Required
The created or updated API key.
Was this section helpful?