From 2a2667fae1af59474eab6a28120a32c5e4b40bd5 Mon Sep 17 00:00:00 2001 From: Jaume Alavedra Date: Thu, 25 Jan 2024 19:59:43 +0100 Subject: [PATCH] update controller --- .../notificationSubscriptionsApiWrapper.ts | 6 +- src/apis/notificationTriggersApiWrapper.ts | 6 +- .../apis/NotificationSubscriptionsApi.ts | 349 +++++++++ src/generated/apis/NotificationTriggersApi.ts | 349 +++++++++ src/generated/apis/NotificationsApi.ts | 690 +----------------- src/generated/index.ts | 2 +- src/generated/types/ObjectParamAPI.ts | 310 ++++---- src/generated/types/ObservableAPI.ts | 188 +++-- src/generated/types/PromiseAPI.ts | 160 ++-- 9 files changed, 1103 insertions(+), 957 deletions(-) create mode 100644 src/generated/apis/NotificationSubscriptionsApi.ts create mode 100644 src/generated/apis/NotificationTriggersApi.ts diff --git a/src/apis/notificationSubscriptionsApiWrapper.ts b/src/apis/notificationSubscriptionsApiWrapper.ts index 09177212..d0780022 100644 --- a/src/apis/notificationSubscriptionsApiWrapper.ts +++ b/src/apis/notificationSubscriptionsApiWrapper.ts @@ -5,15 +5,15 @@ import { NotificationSubscriptionDeleteResponse, NotificationSubscriptionListQueries, NotificationSubscriptionListResponse, + NotificationSubscriptionsApi, } from "../generated"; import { httpErrorHandler } from "../utilities/httpErrorHandler"; -import { NotificationsApi } from "../generated"; import { GetNotificationSubscriptionRequest } from "../models/getNotificationSubscriptionRequest"; @httpErrorHandler -export class NotificationSubscriptionsApiWrapper extends BaseApiWrapper { +export class NotificationSubscriptionsApiWrapper extends BaseApiWrapper { constructor(accessToken: string, basePath?: string) { - super(NotificationsApi, accessToken, basePath); + super(NotificationSubscriptionsApi, accessToken, basePath); } /** diff --git a/src/apis/notificationTriggersApiWrapper.ts b/src/apis/notificationTriggersApiWrapper.ts index e14f3ed4..2defec33 100644 --- a/src/apis/notificationTriggersApiWrapper.ts +++ b/src/apis/notificationTriggersApiWrapper.ts @@ -5,15 +5,15 @@ import { NotificationTriggerListQueries, NotificationTriggerListResponse, NotificationTriggerResponse, + NotificationTriggersApi, } from "../generated"; import { httpErrorHandler } from "../utilities/httpErrorHandler"; -import { NotificationsApi } from "../generated"; import { GetNotificationTriggerRequest } from "../models/getNotificationTriggerRequest"; @httpErrorHandler -export class NotificationTriggersApiWrapper extends BaseApiWrapper { +export class NotificationTriggersApiWrapper extends BaseApiWrapper { constructor(accessToken: string, basePath?: string) { - super(NotificationsApi, accessToken, basePath); + super(NotificationTriggersApi, accessToken, basePath); } /** diff --git a/src/generated/apis/NotificationSubscriptionsApi.ts b/src/generated/apis/NotificationSubscriptionsApi.ts new file mode 100644 index 00000000..f5ff0503 --- /dev/null +++ b/src/generated/apis/NotificationSubscriptionsApi.ts @@ -0,0 +1,349 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; +import {Configuration} from '../configuration'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import * as FormData from "form-data"; +import { URLSearchParams } from 'url'; +import {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { CreateSubscriptionRequest } from '../models/CreateSubscriptionRequest'; +import { NotificationSubscription } from '../models/NotificationSubscription'; +import { NotificationSubscriptionDeleteResponse } from '../models/NotificationSubscriptionDeleteResponse'; +import { NotificationSubscriptionListResponse } from '../models/NotificationSubscriptionListResponse'; +import { SortOrder } from '../models/SortOrder'; + +/** + * no description + */ +export class NotificationSubscriptionsApiRequestFactory extends BaseAPIRequestFactory { + + /** + * Create a subscription for the provided notification. + * Create a notification subscription object. + * @param createSubscriptionRequest + */ + public async createNotificationSubscription(createSubscriptionRequest: CreateSubscriptionRequest, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'createSubscriptionRequest' is not null or undefined + if (createSubscriptionRequest === null || createSubscriptionRequest === undefined) { + throw new RequiredError("NotificationSubscriptionsApi", "createNotificationSubscription", "createSubscriptionRequest"); + } + + + // Path Params + const localVarPath = '/v1/notification_subscriptions'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(createSubscriptionRequest, "CreateSubscriptionRequest", ""), + contentType + ); + requestContext.setBody(serializedBody); + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["sk"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Delete a notification subscription by providing its notification subscription id. + * Deletes a notification subscription object. + * @param id Specifies the unique notification subscription ID (starts with ntr_). + */ + public async deleteNotificationSubscription(id: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError("NotificationSubscriptionsApi", "deleteNotificationSubscription", "id"); + } + + + // Path Params + const localVarPath = '/v1/notification_subscriptions/{id}' + .replace('{' + 'id' + '}', encodeURIComponent(String(id))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["sk"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Retrieves the details of an existing notification subscription. Supply the unique notification subscription ID. + * Get existing notification subscription. + * @param id Specifies the unique notification subscription ID (starts with not_). + */ + public async getNotificationSubscription(id: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError("NotificationSubscriptionsApi", "getNotificationSubscription", "id"); + } + + + // Path Params + const localVarPath = '/v1/notification_subscriptions/{id}' + .replace('{' + 'id' + '}', encodeURIComponent(String(id))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["sk"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Returns a list of subscriptions of a notification. Subscriptions define the the way you will get notified and the target of the notification. Subscriptions are returned sorted by creation date, with the most recently created accounts appearing first. By default, a maximum of 10 notification subscriptions are shown per page. + * List notification subscriptions of a notification. + * @param notification Specifies the unique notification ID (starts with not_). + * @param limit Specifies the maximum number of records to return. + * @param skip Specifies the offset for the first records to return. + * @param order Specifies the order in which to sort the results. + */ + public async getNotificationSubscriptions(notification: string, limit?: number, skip?: number, order?: SortOrder, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'notification' is not null or undefined + if (notification === null || notification === undefined) { + throw new RequiredError("NotificationSubscriptionsApi", "getNotificationSubscriptions", "notification"); + } + + + + + + // Path Params + const localVarPath = '/v1/notification_subscriptions'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (limit !== undefined) { + requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); + } + + // Query Params + if (skip !== undefined) { + requestContext.setQueryParam("skip", ObjectSerializer.serialize(skip, "number", "int32")); + } + + // Query Params + if (order !== undefined) { + requestContext.setQueryParam("order", ObjectSerializer.serialize(order, "SortOrder", "")); + } + + // Query Params + if (notification !== undefined) { + requestContext.setQueryParam("notification", ObjectSerializer.serialize(notification, "string", "")); + } + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["sk"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + +} + +export class NotificationSubscriptionsApiResponseProcessor { + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createNotificationSubscription + * @throws ApiException if the response code was not in [200, 299] + */ + public async createNotificationSubscription(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: NotificationSubscription = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotificationSubscription", "" + ) as NotificationSubscription; + return body; + } + if (isCodeInRange("401", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Error response.", undefined, response.headers); + } + if (isCodeInRange("409", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Error response.", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: NotificationSubscription = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotificationSubscription", "" + ) as NotificationSubscription; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to deleteNotificationSubscription + * @throws ApiException if the response code was not in [200, 299] + */ + public async deleteNotificationSubscription(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: NotificationSubscriptionDeleteResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotificationSubscriptionDeleteResponse", "" + ) as NotificationSubscriptionDeleteResponse; + return body; + } + if (isCodeInRange("401", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Error response.", undefined, response.headers); + } + if (isCodeInRange("409", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Error response.", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: NotificationSubscriptionDeleteResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotificationSubscriptionDeleteResponse", "" + ) as NotificationSubscriptionDeleteResponse; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getNotificationSubscription + * @throws ApiException if the response code was not in [200, 299] + */ + public async getNotificationSubscription(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: NotificationSubscription = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotificationSubscription", "" + ) as NotificationSubscription; + return body; + } + if (isCodeInRange("401", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Error response.", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: NotificationSubscription = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotificationSubscription", "" + ) as NotificationSubscription; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getNotificationSubscriptions + * @throws ApiException if the response code was not in [200, 299] + */ + public async getNotificationSubscriptions(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: NotificationSubscriptionListResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotificationSubscriptionListResponse", "" + ) as NotificationSubscriptionListResponse; + return body; + } + if (isCodeInRange("401", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Error response.", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: NotificationSubscriptionListResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotificationSubscriptionListResponse", "" + ) as NotificationSubscriptionListResponse; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + +} diff --git a/src/generated/apis/NotificationTriggersApi.ts b/src/generated/apis/NotificationTriggersApi.ts new file mode 100644 index 00000000..6ab68943 --- /dev/null +++ b/src/generated/apis/NotificationTriggersApi.ts @@ -0,0 +1,349 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; +import {Configuration} from '../configuration'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import * as FormData from "form-data"; +import { URLSearchParams } from 'url'; +import {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { CreateTriggerRequest } from '../models/CreateTriggerRequest'; +import { NotificationTriggerDeleteResponse } from '../models/NotificationTriggerDeleteResponse'; +import { NotificationTriggerListResponse } from '../models/NotificationTriggerListResponse'; +import { NotificationTriggerResponse } from '../models/NotificationTriggerResponse'; +import { SortOrder } from '../models/SortOrder'; + +/** + * no description + */ +export class NotificationTriggersApiRequestFactory extends BaseAPIRequestFactory { + + /** + * Create a trigger for the provided notification. + * Create a notification trigger object. + * @param createTriggerRequest + */ + public async createNotificationTrigger(createTriggerRequest: CreateTriggerRequest, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'createTriggerRequest' is not null or undefined + if (createTriggerRequest === null || createTriggerRequest === undefined) { + throw new RequiredError("NotificationTriggersApi", "createNotificationTrigger", "createTriggerRequest"); + } + + + // Path Params + const localVarPath = '/v1/notification_triggers'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(createTriggerRequest, "CreateTriggerRequest", ""), + contentType + ); + requestContext.setBody(serializedBody); + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["sk"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Delete a notification trigger by providing its notification trigger id. + * Deletes a notification trigger object. + * @param id Specifies the unique notification trigger ID (starts with ntr_). + */ + public async deleteNotificationTrigger(id: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError("NotificationTriggersApi", "deleteNotificationTrigger", "id"); + } + + + // Path Params + const localVarPath = '/v1/notification_triggers/{id}' + .replace('{' + 'id' + '}', encodeURIComponent(String(id))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["sk"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Retrieves the details of an existing notification trigger. Supply the unique notification trigger ID. + * Get existing notification trigger. + * @param id Specifies the unique notification trigger ID (starts with ntr_). + */ + public async getNotificationTrigger(id: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError("NotificationTriggersApi", "getNotificationTrigger", "id"); + } + + + // Path Params + const localVarPath = '/v1/notification_triggers/{id}' + .replace('{' + 'id' + '}', encodeURIComponent(String(id))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["sk"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Returns a list of triggers of a notification. Triggers define the conditions that will trigger a notification. Triggers are returned sorted by creation date, with the most recently created accounts appearing first. By default, a maximum of 10 notification triggers are shown per page. + * List notification triggers of a notification. + * @param notification Specifies the unique notification ID (starts with not_). + * @param limit Specifies the maximum number of records to return. + * @param skip Specifies the offset for the first records to return. + * @param order Specifies the order in which to sort the results. + */ + public async getNotificationTriggers(notification: string, limit?: number, skip?: number, order?: SortOrder, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'notification' is not null or undefined + if (notification === null || notification === undefined) { + throw new RequiredError("NotificationTriggersApi", "getNotificationTriggers", "notification"); + } + + + + + + // Path Params + const localVarPath = '/v1/notification_triggers'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (limit !== undefined) { + requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); + } + + // Query Params + if (skip !== undefined) { + requestContext.setQueryParam("skip", ObjectSerializer.serialize(skip, "number", "int32")); + } + + // Query Params + if (order !== undefined) { + requestContext.setQueryParam("order", ObjectSerializer.serialize(order, "SortOrder", "")); + } + + // Query Params + if (notification !== undefined) { + requestContext.setQueryParam("notification", ObjectSerializer.serialize(notification, "string", "")); + } + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["sk"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + +} + +export class NotificationTriggersApiResponseProcessor { + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createNotificationTrigger + * @throws ApiException if the response code was not in [200, 299] + */ + public async createNotificationTrigger(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: NotificationTriggerResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotificationTriggerResponse", "" + ) as NotificationTriggerResponse; + return body; + } + if (isCodeInRange("401", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Error response.", undefined, response.headers); + } + if (isCodeInRange("409", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Error response.", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: NotificationTriggerResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotificationTriggerResponse", "" + ) as NotificationTriggerResponse; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to deleteNotificationTrigger + * @throws ApiException if the response code was not in [200, 299] + */ + public async deleteNotificationTrigger(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: NotificationTriggerDeleteResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotificationTriggerDeleteResponse", "" + ) as NotificationTriggerDeleteResponse; + return body; + } + if (isCodeInRange("401", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Error response.", undefined, response.headers); + } + if (isCodeInRange("409", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Error response.", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: NotificationTriggerDeleteResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotificationTriggerDeleteResponse", "" + ) as NotificationTriggerDeleteResponse; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getNotificationTrigger + * @throws ApiException if the response code was not in [200, 299] + */ + public async getNotificationTrigger(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: NotificationTriggerResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotificationTriggerResponse", "" + ) as NotificationTriggerResponse; + return body; + } + if (isCodeInRange("401", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Error response.", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: NotificationTriggerResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotificationTriggerResponse", "" + ) as NotificationTriggerResponse; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getNotificationTriggers + * @throws ApiException if the response code was not in [200, 299] + */ + public async getNotificationTriggers(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: NotificationTriggerListResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotificationTriggerListResponse", "" + ) as NotificationTriggerListResponse; + return body; + } + if (isCodeInRange("401", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Error response.", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: NotificationTriggerListResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotificationTriggerListResponse", "" + ) as NotificationTriggerListResponse; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + +} diff --git a/src/generated/apis/NotificationsApi.ts b/src/generated/apis/NotificationsApi.ts index bd54b9ff..a2fbb016 100644 --- a/src/generated/apis/NotificationsApi.ts +++ b/src/generated/apis/NotificationsApi.ts @@ -11,18 +11,10 @@ import {SecurityAuthentication} from '../auth/auth'; import { CreateNotificationRequest } from '../models/CreateNotificationRequest'; -import { CreateSubscriptionRequest } from '../models/CreateSubscriptionRequest'; -import { CreateTriggerRequest } from '../models/CreateTriggerRequest'; import { NotificationDeleteResponse } from '../models/NotificationDeleteResponse'; import { NotificationListResponse } from '../models/NotificationListResponse'; import { NotificationResponse } from '../models/NotificationResponse'; import { NotificationResponseExpandable } from '../models/NotificationResponseExpandable'; -import { NotificationSubscription } from '../models/NotificationSubscription'; -import { NotificationSubscriptionDeleteResponse } from '../models/NotificationSubscriptionDeleteResponse'; -import { NotificationSubscriptionListResponse } from '../models/NotificationSubscriptionListResponse'; -import { NotificationTriggerDeleteResponse } from '../models/NotificationTriggerDeleteResponse'; -import { NotificationTriggerListResponse } from '../models/NotificationTriggerListResponse'; -import { NotificationTriggerResponse } from '../models/NotificationTriggerResponse'; import { SortOrder } from '../models/SortOrder'; /** @@ -79,381 +71,25 @@ export class NotificationsApiRequestFactory extends BaseAPIRequestFactory { } /** - * Create a subscription for the provided notification. - * Create a notification subscription object. - * @param createSubscriptionRequest - */ - public async createNotificationSubscription(createSubscriptionRequest: CreateSubscriptionRequest, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'createSubscriptionRequest' is not null or undefined - if (createSubscriptionRequest === null || createSubscriptionRequest === undefined) { - throw new RequiredError("NotificationsApi", "createNotificationSubscription", "createSubscriptionRequest"); - } - - - // Path Params - const localVarPath = '/v1/notification_subscriptions'; - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - - // Body Params - const contentType = ObjectSerializer.getPreferredMediaType([ - "application/json" - ]); - requestContext.setHeaderParam("Content-Type", contentType); - const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(createSubscriptionRequest, "CreateSubscriptionRequest", ""), - contentType - ); - requestContext.setBody(serializedBody); - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["sk"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Create a trigger for the provided notification. - * Create a notification trigger object. - * @param createTriggerRequest - */ - public async createNotificationTrigger(createTriggerRequest: CreateTriggerRequest, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'createTriggerRequest' is not null or undefined - if (createTriggerRequest === null || createTriggerRequest === undefined) { - throw new RequiredError("NotificationsApi", "createNotificationTrigger", "createTriggerRequest"); - } - - - // Path Params - const localVarPath = '/v1/notification_triggers'; - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - - // Body Params - const contentType = ObjectSerializer.getPreferredMediaType([ - "application/json" - ]); - requestContext.setHeaderParam("Content-Type", contentType); - const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(createTriggerRequest, "CreateTriggerRequest", ""), - contentType - ); - requestContext.setBody(serializedBody); - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["sk"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Delete a notification by providing its notification id. - * Deletes a notification object. - * @param id Specifies the unique notification ID (starts with not_). - */ - public async deleteNotification(id: string, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError("NotificationsApi", "deleteNotification", "id"); - } - - - // Path Params - const localVarPath = '/v1/notifications/{id}' - .replace('{' + 'id' + '}', encodeURIComponent(String(id))); - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["sk"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Delete a notification subscription by providing its notification subscription id. - * Deletes a notification subscription object. - * @param id Specifies the unique notification subscription ID (starts with ntr_). - */ - public async deleteNotificationSubscription(id: string, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError("NotificationsApi", "deleteNotificationSubscription", "id"); - } - - - // Path Params - const localVarPath = '/v1/notification_subscriptions/{id}' - .replace('{' + 'id' + '}', encodeURIComponent(String(id))); - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["sk"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Delete a notification trigger by providing its notification trigger id. - * Deletes a notification trigger object. - * @param id Specifies the unique notification trigger ID (starts with ntr_). - */ - public async deleteNotificationTrigger(id: string, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError("NotificationsApi", "deleteNotificationTrigger", "id"); - } - - - // Path Params - const localVarPath = '/v1/notification_triggers/{id}' - .replace('{' + 'id' + '}', encodeURIComponent(String(id))); - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["sk"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Retrieves the details of an existing account. Supply the unique notification ID. - * Get existing account. - * @param id Specifies the unique account ID (starts with not_). - * @param expand - */ - public async getNotification(id: string, expand?: Array, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError("NotificationsApi", "getNotification", "id"); - } - - - - // Path Params - const localVarPath = '/v1/notifications/{id}' - .replace('{' + 'id' + '}', encodeURIComponent(String(id))); - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - // Query Params - if (expand !== undefined) { - requestContext.setQueryParam("expand", ObjectSerializer.serialize(expand, "Array", "")); - } - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["sk"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Retrieves the details of an existing notification subscription. Supply the unique notification subscription ID. - * Get existing notification subscription. - * @param id Specifies the unique notification subscription ID (starts with not_). - */ - public async getNotificationSubscription(id: string, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError("NotificationsApi", "getNotificationSubscription", "id"); - } - - - // Path Params - const localVarPath = '/v1/notification_subscriptions/{id}' - .replace('{' + 'id' + '}', encodeURIComponent(String(id))); - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["sk"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Returns a list of subscriptions of a notification. The subscriptions are returned sorted by creation date, with the most recently created accounts appearing first. By default, a maximum of 10 notification subscriptions are shown per page. - * List notification subscriptions of a notification. - * @param notification Specifies the unique notification ID (starts with not_). - * @param limit Specifies the maximum number of records to return. - * @param skip Specifies the offset for the first records to return. - * @param order Specifies the order in which to sort the results. - */ - public async getNotificationSubscriptions(notification: string, limit?: number, skip?: number, order?: SortOrder, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'notification' is not null or undefined - if (notification === null || notification === undefined) { - throw new RequiredError("NotificationsApi", "getNotificationSubscriptions", "notification"); - } - - - - - - // Path Params - const localVarPath = '/v1/notification_subscriptions'; - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - // Query Params - if (limit !== undefined) { - requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); - } - - // Query Params - if (skip !== undefined) { - requestContext.setQueryParam("skip", ObjectSerializer.serialize(skip, "number", "int32")); - } - - // Query Params - if (order !== undefined) { - requestContext.setQueryParam("order", ObjectSerializer.serialize(order, "SortOrder", "")); - } - - // Query Params - if (notification !== undefined) { - requestContext.setQueryParam("notification", ObjectSerializer.serialize(notification, "string", "")); - } - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["sk"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Retrieves the details of an existing notification trigger. Supply the unique notification trigger ID. - * Get existing notification trigger. - * @param id Specifies the unique notification trigger ID (starts with ntr_). + * Delete a notification by providing its notification id. + * Deletes a notification object. + * @param id Specifies the unique notification ID (starts with not_). */ - public async getNotificationTrigger(id: string, _options?: Configuration): Promise { + public async deleteNotification(id: string, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { - throw new RequiredError("NotificationsApi", "getNotificationTrigger", "id"); + throw new RequiredError("NotificationsApi", "deleteNotification", "id"); } // Path Params - const localVarPath = '/v1/notification_triggers/{id}' + const localVarPath = '/v1/notifications/{id}' .replace('{' + 'id' + '}', encodeURIComponent(String(id))); // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") @@ -473,50 +109,32 @@ export class NotificationsApiRequestFactory extends BaseAPIRequestFactory { } /** - * Returns a list of triggers of a notification. The triggers are returned sorted by creation date, with the most recently created accounts appearing first. By default, a maximum of 10 notification triggers are shown per page. - * List notification triggers of a notification. - * @param notification Specifies the unique notification ID (starts with not_). - * @param limit Specifies the maximum number of records to return. - * @param skip Specifies the offset for the first records to return. - * @param order Specifies the order in which to sort the results. + * Retrieves the details of an existing notification. Supply the unique notification ID. + * Get existing notification. + * @param id Specifies the unique notification ID (starts with not_). + * @param expand */ - public async getNotificationTriggers(notification: string, limit?: number, skip?: number, order?: SortOrder, _options?: Configuration): Promise { + public async getNotification(id: string, expand?: Array, _options?: Configuration): Promise { let _config = _options || this.configuration; - // verify required parameter 'notification' is not null or undefined - if (notification === null || notification === undefined) { - throw new RequiredError("NotificationsApi", "getNotificationTriggers", "notification"); + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError("NotificationsApi", "getNotification", "id"); } - - // Path Params - const localVarPath = '/v1/notification_triggers'; + const localVarPath = '/v1/notifications/{id}' + .replace('{' + 'id' + '}', encodeURIComponent(String(id))); // Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") // Query Params - if (limit !== undefined) { - requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); - } - - // Query Params - if (skip !== undefined) { - requestContext.setQueryParam("skip", ObjectSerializer.serialize(skip, "number", "int32")); - } - - // Query Params - if (order !== undefined) { - requestContext.setQueryParam("order", ObjectSerializer.serialize(order, "SortOrder", "")); - } - - // Query Params - if (notification !== undefined) { - requestContext.setQueryParam("notification", ObjectSerializer.serialize(notification, "string", "")); + if (expand !== undefined) { + requestContext.setQueryParam("expand", ObjectSerializer.serialize(expand, "Array", "")); } @@ -536,7 +154,7 @@ export class NotificationsApiRequestFactory extends BaseAPIRequestFactory { } /** - * Returns a list of notifications. The notifications are returned sorted by creation date, with the most recently created notifications appearing first. By default, a maximum of 10 notifications are shown per page. + * Returns a list of notifications. Notifications are useful to get notified about events that happen on-chain or in your Openfort account. Notifications are returned sorted by creation date, with the most recently created notifications appearing first. By default, a maximum of 10 notifications are shown per page. * List notifications. * @param limit Specifies the maximum number of records to return. * @param skip Specifies the offset for the first records to return. @@ -646,76 +264,6 @@ export class NotificationsApiResponseProcessor { throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to createNotificationSubscription - * @throws ApiException if the response code was not in [200, 299] - */ - public async createNotificationSubscription(response: ResponseContext): Promise { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: NotificationSubscription = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotificationSubscription", "" - ) as NotificationSubscription; - return body; - } - if (isCodeInRange("401", response.httpStatusCode)) { - throw new ApiException(response.httpStatusCode, "Error response.", undefined, response.headers); - } - if (isCodeInRange("409", response.httpStatusCode)) { - throw new ApiException(response.httpStatusCode, "Error response.", undefined, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: NotificationSubscription = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotificationSubscription", "" - ) as NotificationSubscription; - return body; - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to createNotificationTrigger - * @throws ApiException if the response code was not in [200, 299] - */ - public async createNotificationTrigger(response: ResponseContext): Promise { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: NotificationTriggerResponse = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotificationTriggerResponse", "" - ) as NotificationTriggerResponse; - return body; - } - if (isCodeInRange("401", response.httpStatusCode)) { - throw new ApiException(response.httpStatusCode, "Error response.", undefined, response.headers); - } - if (isCodeInRange("409", response.httpStatusCode)) { - throw new ApiException(response.httpStatusCode, "Error response.", undefined, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: NotificationTriggerResponse = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotificationTriggerResponse", "" - ) as NotificationTriggerResponse; - return body; - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -751,76 +299,6 @@ export class NotificationsApiResponseProcessor { throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to deleteNotificationSubscription - * @throws ApiException if the response code was not in [200, 299] - */ - public async deleteNotificationSubscription(response: ResponseContext): Promise { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: NotificationSubscriptionDeleteResponse = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotificationSubscriptionDeleteResponse", "" - ) as NotificationSubscriptionDeleteResponse; - return body; - } - if (isCodeInRange("401", response.httpStatusCode)) { - throw new ApiException(response.httpStatusCode, "Error response.", undefined, response.headers); - } - if (isCodeInRange("409", response.httpStatusCode)) { - throw new ApiException(response.httpStatusCode, "Error response.", undefined, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: NotificationSubscriptionDeleteResponse = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotificationSubscriptionDeleteResponse", "" - ) as NotificationSubscriptionDeleteResponse; - return body; - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to deleteNotificationTrigger - * @throws ApiException if the response code was not in [200, 299] - */ - public async deleteNotificationTrigger(response: ResponseContext): Promise { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: NotificationTriggerDeleteResponse = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotificationTriggerDeleteResponse", "" - ) as NotificationTriggerDeleteResponse; - return body; - } - if (isCodeInRange("401", response.httpStatusCode)) { - throw new ApiException(response.httpStatusCode, "Error response.", undefined, response.headers); - } - if (isCodeInRange("409", response.httpStatusCode)) { - throw new ApiException(response.httpStatusCode, "Error response.", undefined, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: NotificationTriggerDeleteResponse = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotificationTriggerDeleteResponse", "" - ) as NotificationTriggerDeleteResponse; - return body; - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -853,134 +331,6 @@ export class NotificationsApiResponseProcessor { throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getNotificationSubscription - * @throws ApiException if the response code was not in [200, 299] - */ - public async getNotificationSubscription(response: ResponseContext): Promise { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: NotificationSubscription = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotificationSubscription", "" - ) as NotificationSubscription; - return body; - } - if (isCodeInRange("401", response.httpStatusCode)) { - throw new ApiException(response.httpStatusCode, "Error response.", undefined, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: NotificationSubscription = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotificationSubscription", "" - ) as NotificationSubscription; - return body; - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getNotificationSubscriptions - * @throws ApiException if the response code was not in [200, 299] - */ - public async getNotificationSubscriptions(response: ResponseContext): Promise { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: NotificationSubscriptionListResponse = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotificationSubscriptionListResponse", "" - ) as NotificationSubscriptionListResponse; - return body; - } - if (isCodeInRange("401", response.httpStatusCode)) { - throw new ApiException(response.httpStatusCode, "Error response.", undefined, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: NotificationSubscriptionListResponse = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotificationSubscriptionListResponse", "" - ) as NotificationSubscriptionListResponse; - return body; - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getNotificationTrigger - * @throws ApiException if the response code was not in [200, 299] - */ - public async getNotificationTrigger(response: ResponseContext): Promise { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: NotificationTriggerResponse = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotificationTriggerResponse", "" - ) as NotificationTriggerResponse; - return body; - } - if (isCodeInRange("401", response.httpStatusCode)) { - throw new ApiException(response.httpStatusCode, "Error response.", undefined, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: NotificationTriggerResponse = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotificationTriggerResponse", "" - ) as NotificationTriggerResponse; - return body; - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getNotificationTriggers - * @throws ApiException if the response code was not in [200, 299] - */ - public async getNotificationTriggers(response: ResponseContext): Promise { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: NotificationTriggerListResponse = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotificationTriggerListResponse", "" - ) as NotificationTriggerListResponse; - return body; - } - if (isCodeInRange("401", response.httpStatusCode)) { - throw new ApiException(response.httpStatusCode, "Error response.", undefined, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: NotificationTriggerListResponse = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotificationTriggerListResponse", "" - ) as NotificationTriggerListResponse; - return body; - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects diff --git a/src/generated/index.ts b/src/generated/index.ts index 8cdf059e..54f85583 100644 --- a/src/generated/index.ts +++ b/src/generated/index.ts @@ -8,5 +8,5 @@ export * from "./servers"; export { RequiredError } from "./apis/baseapi"; export { PromiseMiddleware as Middleware } from './middleware'; -export { PromiseNotificationsApi as NotificationsApi,PromiseAccountsApi as AccountsApi, PromiseAuthenticationApi as AuthenticationApi, PromiseContractsApi as ContractsApi, PromiseGoogleAuthenticationApi as GoogleAuthenticationApi, PromiseInventoriesApi as InventoriesApi, PromiseOAuthApi as OAuthApi, PromisePlayersApi as PlayersApi, PromisePlayersAuthenticationApi as PlayersAuthenticationApi, PromisePoliciesApi as PoliciesApi, PromisePolicyRulesApi as PolicyRulesApi, PromiseSessionsApi as SessionsApi, PromiseSettingsApi as SettingsApi, PromiseTransactionIntentsApi as TransactionIntentsApi, PromiseWeb3ConnectionsApi as Web3ConnectionsApi } from './types/PromiseAPI'; +export { PromiseNotificationTriggersApi as NotificationTriggersApi, PromiseNotificationSubscriptionsApi as NotificationSubscriptionsApi, PromiseNotificationsApi as NotificationsApi, PromiseAccountsApi as AccountsApi, PromiseAuthenticationApi as AuthenticationApi, PromiseContractsApi as ContractsApi, PromiseGoogleAuthenticationApi as GoogleAuthenticationApi, PromiseInventoriesApi as InventoriesApi, PromiseOAuthApi as OAuthApi, PromisePlayersApi as PlayersApi, PromisePlayersAuthenticationApi as PlayersAuthenticationApi, PromisePoliciesApi as PoliciesApi, PromisePolicyRulesApi as PolicyRulesApi, PromiseSessionsApi as SessionsApi, PromiseSettingsApi as SettingsApi, PromiseTransactionIntentsApi as TransactionIntentsApi, PromiseWeb3ConnectionsApi as Web3ConnectionsApi } from './types/PromiseAPI'; diff --git a/src/generated/types/ObjectParamAPI.ts b/src/generated/types/ObjectParamAPI.ts index eee9df62..f77cbc3f 100644 --- a/src/generated/types/ObjectParamAPI.ts +++ b/src/generated/types/ObjectParamAPI.ts @@ -1010,148 +1010,244 @@ export class ObjectInventoriesApi { } -import { ObservableNotificationsApi } from "./ObservableAPI"; -import { NotificationsApiRequestFactory, NotificationsApiResponseProcessor} from "../apis/NotificationsApi"; +import { ObservableNotificationSubscriptionsApi } from "./ObservableAPI"; +import { NotificationSubscriptionsApiRequestFactory, NotificationSubscriptionsApiResponseProcessor} from "../apis/NotificationSubscriptionsApi"; -export interface NotificationsApiCreateNotificationRequest { +export interface NotificationSubscriptionsApiCreateNotificationSubscriptionRequest { /** * - * @type CreateNotificationRequest - * @memberof NotificationsApicreateNotification + * @type CreateSubscriptionRequest + * @memberof NotificationSubscriptionsApicreateNotificationSubscription */ - createNotificationRequest: CreateNotificationRequest + createSubscriptionRequest: CreateSubscriptionRequest } -export interface NotificationsApiCreateNotificationSubscriptionRequest { +export interface NotificationSubscriptionsApiDeleteNotificationSubscriptionRequest { /** - * - * @type CreateSubscriptionRequest - * @memberof NotificationsApicreateNotificationSubscription + * Specifies the unique notification subscription ID (starts with ntr_). + * @type string + * @memberof NotificationSubscriptionsApideleteNotificationSubscription */ - createSubscriptionRequest: CreateSubscriptionRequest + id: string } -export interface NotificationsApiCreateNotificationTriggerRequest { +export interface NotificationSubscriptionsApiGetNotificationSubscriptionRequest { /** - * - * @type CreateTriggerRequest - * @memberof NotificationsApicreateNotificationTrigger + * Specifies the unique notification subscription ID (starts with not_). + * @type string + * @memberof NotificationSubscriptionsApigetNotificationSubscription */ - createTriggerRequest: CreateTriggerRequest + id: string } -export interface NotificationsApiDeleteNotificationRequest { +export interface NotificationSubscriptionsApiGetNotificationSubscriptionsRequest { /** * Specifies the unique notification ID (starts with not_). * @type string - * @memberof NotificationsApideleteNotification + * @memberof NotificationSubscriptionsApigetNotificationSubscriptions */ - id: string + notification: string + /** + * Specifies the maximum number of records to return. + * @type number + * @memberof NotificationSubscriptionsApigetNotificationSubscriptions + */ + limit?: number + /** + * Specifies the offset for the first records to return. + * @type number + * @memberof NotificationSubscriptionsApigetNotificationSubscriptions + */ + skip?: number + /** + * Specifies the order in which to sort the results. + * @type SortOrder + * @memberof NotificationSubscriptionsApigetNotificationSubscriptions + */ + order?: SortOrder } -export interface NotificationsApiDeleteNotificationSubscriptionRequest { +export class ObjectNotificationSubscriptionsApi { + private api: ObservableNotificationSubscriptionsApi + + public constructor(configuration: Configuration, requestFactory?: NotificationSubscriptionsApiRequestFactory, responseProcessor?: NotificationSubscriptionsApiResponseProcessor) { + this.api = new ObservableNotificationSubscriptionsApi(configuration, requestFactory, responseProcessor); + } + /** - * Specifies the unique notification subscription ID (starts with ntr_). - * @type string - * @memberof NotificationsApideleteNotificationSubscription + * Create a subscription for the provided notification. + * Create a notification subscription object. + * @param param the request object */ - id: string + public createNotificationSubscription(param: NotificationSubscriptionsApiCreateNotificationSubscriptionRequest, options?: Configuration): Promise { + return this.api.createNotificationSubscription(param.createSubscriptionRequest, options).toPromise(); + } + + /** + * Delete a notification subscription by providing its notification subscription id. + * Deletes a notification subscription object. + * @param param the request object + */ + public deleteNotificationSubscription(param: NotificationSubscriptionsApiDeleteNotificationSubscriptionRequest, options?: Configuration): Promise { + return this.api.deleteNotificationSubscription(param.id, options).toPromise(); + } + + /** + * Retrieves the details of an existing notification subscription. Supply the unique notification subscription ID. + * Get existing notification subscription. + * @param param the request object + */ + public getNotificationSubscription(param: NotificationSubscriptionsApiGetNotificationSubscriptionRequest, options?: Configuration): Promise { + return this.api.getNotificationSubscription(param.id, options).toPromise(); + } + + /** + * Returns a list of subscriptions of a notification. Subscriptions define the the way you will get notified and the target of the notification. Subscriptions are returned sorted by creation date, with the most recently created accounts appearing first. By default, a maximum of 10 notification subscriptions are shown per page. + * List notification subscriptions of a notification. + * @param param the request object + */ + public getNotificationSubscriptions(param: NotificationSubscriptionsApiGetNotificationSubscriptionsRequest, options?: Configuration): Promise { + return this.api.getNotificationSubscriptions(param.notification, param.limit, param.skip, param.order, options).toPromise(); + } + } -export interface NotificationsApiDeleteNotificationTriggerRequest { +import { ObservableNotificationTriggersApi } from "./ObservableAPI"; +import { NotificationTriggersApiRequestFactory, NotificationTriggersApiResponseProcessor} from "../apis/NotificationTriggersApi"; + +export interface NotificationTriggersApiCreateNotificationTriggerRequest { /** - * Specifies the unique notification trigger ID (starts with ntr_). - * @type string - * @memberof NotificationsApideleteNotificationTrigger + * + * @type CreateTriggerRequest + * @memberof NotificationTriggersApicreateNotificationTrigger */ - id: string + createTriggerRequest: CreateTriggerRequest } -export interface NotificationsApiGetNotificationRequest { +export interface NotificationTriggersApiDeleteNotificationTriggerRequest { /** - * Specifies the unique account ID (starts with not_). + * Specifies the unique notification trigger ID (starts with ntr_). * @type string - * @memberof NotificationsApigetNotification + * @memberof NotificationTriggersApideleteNotificationTrigger */ id: string - /** - * - * @type Array<NotificationResponseExpandable> - * @memberof NotificationsApigetNotification - */ - expand?: Array } -export interface NotificationsApiGetNotificationSubscriptionRequest { +export interface NotificationTriggersApiGetNotificationTriggerRequest { /** - * Specifies the unique notification subscription ID (starts with not_). + * Specifies the unique notification trigger ID (starts with ntr_). * @type string - * @memberof NotificationsApigetNotificationSubscription + * @memberof NotificationTriggersApigetNotificationTrigger */ id: string } -export interface NotificationsApiGetNotificationSubscriptionsRequest { +export interface NotificationTriggersApiGetNotificationTriggersRequest { /** * Specifies the unique notification ID (starts with not_). * @type string - * @memberof NotificationsApigetNotificationSubscriptions + * @memberof NotificationTriggersApigetNotificationTriggers */ notification: string /** * Specifies the maximum number of records to return. * @type number - * @memberof NotificationsApigetNotificationSubscriptions + * @memberof NotificationTriggersApigetNotificationTriggers */ limit?: number /** * Specifies the offset for the first records to return. * @type number - * @memberof NotificationsApigetNotificationSubscriptions + * @memberof NotificationTriggersApigetNotificationTriggers */ skip?: number /** * Specifies the order in which to sort the results. * @type SortOrder - * @memberof NotificationsApigetNotificationSubscriptions + * @memberof NotificationTriggersApigetNotificationTriggers */ order?: SortOrder } -export interface NotificationsApiGetNotificationTriggerRequest { +export class ObjectNotificationTriggersApi { + private api: ObservableNotificationTriggersApi + + public constructor(configuration: Configuration, requestFactory?: NotificationTriggersApiRequestFactory, responseProcessor?: NotificationTriggersApiResponseProcessor) { + this.api = new ObservableNotificationTriggersApi(configuration, requestFactory, responseProcessor); + } + /** - * Specifies the unique notification trigger ID (starts with ntr_). - * @type string - * @memberof NotificationsApigetNotificationTrigger + * Create a trigger for the provided notification. + * Create a notification trigger object. + * @param param the request object */ - id: string + public createNotificationTrigger(param: NotificationTriggersApiCreateNotificationTriggerRequest, options?: Configuration): Promise { + return this.api.createNotificationTrigger(param.createTriggerRequest, options).toPromise(); + } + + /** + * Delete a notification trigger by providing its notification trigger id. + * Deletes a notification trigger object. + * @param param the request object + */ + public deleteNotificationTrigger(param: NotificationTriggersApiDeleteNotificationTriggerRequest, options?: Configuration): Promise { + return this.api.deleteNotificationTrigger(param.id, options).toPromise(); + } + + /** + * Retrieves the details of an existing notification trigger. Supply the unique notification trigger ID. + * Get existing notification trigger. + * @param param the request object + */ + public getNotificationTrigger(param: NotificationTriggersApiGetNotificationTriggerRequest, options?: Configuration): Promise { + return this.api.getNotificationTrigger(param.id, options).toPromise(); + } + + /** + * Returns a list of triggers of a notification. Triggers define the conditions that will trigger a notification. Triggers are returned sorted by creation date, with the most recently created accounts appearing first. By default, a maximum of 10 notification triggers are shown per page. + * List notification triggers of a notification. + * @param param the request object + */ + public getNotificationTriggers(param: NotificationTriggersApiGetNotificationTriggersRequest, options?: Configuration): Promise { + return this.api.getNotificationTriggers(param.notification, param.limit, param.skip, param.order, options).toPromise(); + } + } -export interface NotificationsApiGetNotificationTriggersRequest { +import { ObservableNotificationsApi } from "./ObservableAPI"; +import { NotificationsApiRequestFactory, NotificationsApiResponseProcessor} from "../apis/NotificationsApi"; + +export interface NotificationsApiCreateNotificationRequest { /** - * Specifies the unique notification ID (starts with not_). - * @type string - * @memberof NotificationsApigetNotificationTriggers + * + * @type CreateNotificationRequest + * @memberof NotificationsApicreateNotification */ - notification: string + createNotificationRequest: CreateNotificationRequest +} + +export interface NotificationsApiDeleteNotificationRequest { /** - * Specifies the maximum number of records to return. - * @type number - * @memberof NotificationsApigetNotificationTriggers + * Specifies the unique notification ID (starts with not_). + * @type string + * @memberof NotificationsApideleteNotification */ - limit?: number + id: string +} + +export interface NotificationsApiGetNotificationRequest { /** - * Specifies the offset for the first records to return. - * @type number - * @memberof NotificationsApigetNotificationTriggers + * Specifies the unique notification ID (starts with not_). + * @type string + * @memberof NotificationsApigetNotification */ - skip?: number + id: string /** - * Specifies the order in which to sort the results. - * @type SortOrder - * @memberof NotificationsApigetNotificationTriggers + * + * @type Array<NotificationResponseExpandable> + * @memberof NotificationsApigetNotification */ - order?: SortOrder + expand?: Array } export interface NotificationsApiGetNotificationsRequest { @@ -1209,24 +1305,6 @@ export class ObjectNotificationsApi { return this.api.createNotification(param.createNotificationRequest, options).toPromise(); } - /** - * Create a subscription for the provided notification. - * Create a notification subscription object. - * @param param the request object - */ - public createNotificationSubscription(param: NotificationsApiCreateNotificationSubscriptionRequest, options?: Configuration): Promise { - return this.api.createNotificationSubscription(param.createSubscriptionRequest, options).toPromise(); - } - - /** - * Create a trigger for the provided notification. - * Create a notification trigger object. - * @param param the request object - */ - public createNotificationTrigger(param: NotificationsApiCreateNotificationTriggerRequest, options?: Configuration): Promise { - return this.api.createNotificationTrigger(param.createTriggerRequest, options).toPromise(); - } - /** * Delete a notification by providing its notification id. * Deletes a notification object. @@ -1237,26 +1315,8 @@ export class ObjectNotificationsApi { } /** - * Delete a notification subscription by providing its notification subscription id. - * Deletes a notification subscription object. - * @param param the request object - */ - public deleteNotificationSubscription(param: NotificationsApiDeleteNotificationSubscriptionRequest, options?: Configuration): Promise { - return this.api.deleteNotificationSubscription(param.id, options).toPromise(); - } - - /** - * Delete a notification trigger by providing its notification trigger id. - * Deletes a notification trigger object. - * @param param the request object - */ - public deleteNotificationTrigger(param: NotificationsApiDeleteNotificationTriggerRequest, options?: Configuration): Promise { - return this.api.deleteNotificationTrigger(param.id, options).toPromise(); - } - - /** - * Retrieves the details of an existing account. Supply the unique notification ID. - * Get existing account. + * Retrieves the details of an existing notification. Supply the unique notification ID. + * Get existing notification. * @param param the request object */ public getNotification(param: NotificationsApiGetNotificationRequest, options?: Configuration): Promise { @@ -1264,43 +1324,7 @@ export class ObjectNotificationsApi { } /** - * Retrieves the details of an existing notification subscription. Supply the unique notification subscription ID. - * Get existing notification subscription. - * @param param the request object - */ - public getNotificationSubscription(param: NotificationsApiGetNotificationSubscriptionRequest, options?: Configuration): Promise { - return this.api.getNotificationSubscription(param.id, options).toPromise(); - } - - /** - * Returns a list of subscriptions of a notification. The subscriptions are returned sorted by creation date, with the most recently created accounts appearing first. By default, a maximum of 10 notification subscriptions are shown per page. - * List notification subscriptions of a notification. - * @param param the request object - */ - public getNotificationSubscriptions(param: NotificationsApiGetNotificationSubscriptionsRequest, options?: Configuration): Promise { - return this.api.getNotificationSubscriptions(param.notification, param.limit, param.skip, param.order, options).toPromise(); - } - - /** - * Retrieves the details of an existing notification trigger. Supply the unique notification trigger ID. - * Get existing notification trigger. - * @param param the request object - */ - public getNotificationTrigger(param: NotificationsApiGetNotificationTriggerRequest, options?: Configuration): Promise { - return this.api.getNotificationTrigger(param.id, options).toPromise(); - } - - /** - * Returns a list of triggers of a notification. The triggers are returned sorted by creation date, with the most recently created accounts appearing first. By default, a maximum of 10 notification triggers are shown per page. - * List notification triggers of a notification. - * @param param the request object - */ - public getNotificationTriggers(param: NotificationsApiGetNotificationTriggersRequest, options?: Configuration): Promise { - return this.api.getNotificationTriggers(param.notification, param.limit, param.skip, param.order, options).toPromise(); - } - - /** - * Returns a list of notifications. The notifications are returned sorted by creation date, with the most recently created notifications appearing first. By default, a maximum of 10 notifications are shown per page. + * Returns a list of notifications. Notifications are useful to get notified about events that happen on-chain or in your Openfort account. Notifications are returned sorted by creation date, with the most recently created notifications appearing first. By default, a maximum of 10 notifications are shown per page. * List notifications. * @param param the request object */ diff --git a/src/generated/types/ObservableAPI.ts b/src/generated/types/ObservableAPI.ts index ea3e8993..1824329f 100644 --- a/src/generated/types/ObservableAPI.ts +++ b/src/generated/types/ObservableAPI.ts @@ -1013,29 +1013,29 @@ export class ObservableInventoriesApi { } -import { NotificationsApiRequestFactory, NotificationsApiResponseProcessor} from "../apis/NotificationsApi"; -export class ObservableNotificationsApi { - private requestFactory: NotificationsApiRequestFactory; - private responseProcessor: NotificationsApiResponseProcessor; +import { NotificationSubscriptionsApiRequestFactory, NotificationSubscriptionsApiResponseProcessor} from "../apis/NotificationSubscriptionsApi"; +export class ObservableNotificationSubscriptionsApi { + private requestFactory: NotificationSubscriptionsApiRequestFactory; + private responseProcessor: NotificationSubscriptionsApiResponseProcessor; private configuration: Configuration; public constructor( configuration: Configuration, - requestFactory?: NotificationsApiRequestFactory, - responseProcessor?: NotificationsApiResponseProcessor + requestFactory?: NotificationSubscriptionsApiRequestFactory, + responseProcessor?: NotificationSubscriptionsApiResponseProcessor ) { this.configuration = configuration; - this.requestFactory = requestFactory || new NotificationsApiRequestFactory(configuration); - this.responseProcessor = responseProcessor || new NotificationsApiResponseProcessor(); + this.requestFactory = requestFactory || new NotificationSubscriptionsApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new NotificationSubscriptionsApiResponseProcessor(); } /** - * Create a notification object. - * Create a notification object. - * @param createNotificationRequest + * Create a subscription for the provided notification. + * Create a notification subscription object. + * @param createSubscriptionRequest */ - public createNotification(createNotificationRequest: CreateNotificationRequest, _options?: Configuration): Observable { - const requestContextPromise = this.requestFactory.createNotification(createNotificationRequest, _options); + public createNotificationSubscription(createSubscriptionRequest: CreateSubscriptionRequest, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.createNotificationSubscription(createSubscriptionRequest, _options); // build promise chain let middlewarePreObservable = from(requestContextPromise); @@ -1049,17 +1049,17 @@ export class ObservableNotificationsApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createNotification(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createNotificationSubscription(rsp))); })); } /** - * Create a subscription for the provided notification. - * Create a notification subscription object. - * @param createSubscriptionRequest + * Delete a notification subscription by providing its notification subscription id. + * Deletes a notification subscription object. + * @param id Specifies the unique notification subscription ID (starts with ntr_). */ - public createNotificationSubscription(createSubscriptionRequest: CreateSubscriptionRequest, _options?: Configuration): Observable { - const requestContextPromise = this.requestFactory.createNotificationSubscription(createSubscriptionRequest, _options); + public deleteNotificationSubscription(id: string, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.deleteNotificationSubscription(id, _options); // build promise chain let middlewarePreObservable = from(requestContextPromise); @@ -1073,17 +1073,17 @@ export class ObservableNotificationsApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createNotificationSubscription(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteNotificationSubscription(rsp))); })); } /** - * Create a trigger for the provided notification. - * Create a notification trigger object. - * @param createTriggerRequest + * Retrieves the details of an existing notification subscription. Supply the unique notification subscription ID. + * Get existing notification subscription. + * @param id Specifies the unique notification subscription ID (starts with not_). */ - public createNotificationTrigger(createTriggerRequest: CreateTriggerRequest, _options?: Configuration): Observable { - const requestContextPromise = this.requestFactory.createNotificationTrigger(createTriggerRequest, _options); + public getNotificationSubscription(id: string, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.getNotificationSubscription(id, _options); // build promise chain let middlewarePreObservable = from(requestContextPromise); @@ -1097,17 +1097,20 @@ export class ObservableNotificationsApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createNotificationTrigger(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getNotificationSubscription(rsp))); })); } /** - * Delete a notification by providing its notification id. - * Deletes a notification object. - * @param id Specifies the unique notification ID (starts with not_). + * Returns a list of subscriptions of a notification. Subscriptions define the the way you will get notified and the target of the notification. Subscriptions are returned sorted by creation date, with the most recently created accounts appearing first. By default, a maximum of 10 notification subscriptions are shown per page. + * List notification subscriptions of a notification. + * @param notification Specifies the unique notification ID (starts with not_). + * @param limit Specifies the maximum number of records to return. + * @param skip Specifies the offset for the first records to return. + * @param order Specifies the order in which to sort the results. */ - public deleteNotification(id: string, _options?: Configuration): Observable { - const requestContextPromise = this.requestFactory.deleteNotification(id, _options); + public getNotificationSubscriptions(notification: string, limit?: number, skip?: number, order?: SortOrder, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.getNotificationSubscriptions(notification, limit, skip, order, _options); // build promise chain let middlewarePreObservable = from(requestContextPromise); @@ -1121,17 +1124,35 @@ export class ObservableNotificationsApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteNotification(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getNotificationSubscriptions(rsp))); })); } +} + +import { NotificationTriggersApiRequestFactory, NotificationTriggersApiResponseProcessor} from "../apis/NotificationTriggersApi"; +export class ObservableNotificationTriggersApi { + private requestFactory: NotificationTriggersApiRequestFactory; + private responseProcessor: NotificationTriggersApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: NotificationTriggersApiRequestFactory, + responseProcessor?: NotificationTriggersApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new NotificationTriggersApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new NotificationTriggersApiResponseProcessor(); + } + /** - * Delete a notification subscription by providing its notification subscription id. - * Deletes a notification subscription object. - * @param id Specifies the unique notification subscription ID (starts with ntr_). + * Create a trigger for the provided notification. + * Create a notification trigger object. + * @param createTriggerRequest */ - public deleteNotificationSubscription(id: string, _options?: Configuration): Observable { - const requestContextPromise = this.requestFactory.deleteNotificationSubscription(id, _options); + public createNotificationTrigger(createTriggerRequest: CreateTriggerRequest, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.createNotificationTrigger(createTriggerRequest, _options); // build promise chain let middlewarePreObservable = from(requestContextPromise); @@ -1145,7 +1166,7 @@ export class ObservableNotificationsApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteNotificationSubscription(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createNotificationTrigger(rsp))); })); } @@ -1174,13 +1195,12 @@ export class ObservableNotificationsApi { } /** - * Retrieves the details of an existing account. Supply the unique notification ID. - * Get existing account. - * @param id Specifies the unique account ID (starts with not_). - * @param expand + * Retrieves the details of an existing notification trigger. Supply the unique notification trigger ID. + * Get existing notification trigger. + * @param id Specifies the unique notification trigger ID (starts with ntr_). */ - public getNotification(id: string, expand?: Array, _options?: Configuration): Observable { - const requestContextPromise = this.requestFactory.getNotification(id, expand, _options); + public getNotificationTrigger(id: string, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.getNotificationTrigger(id, _options); // build promise chain let middlewarePreObservable = from(requestContextPromise); @@ -1194,17 +1214,20 @@ export class ObservableNotificationsApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getNotification(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getNotificationTrigger(rsp))); })); } /** - * Retrieves the details of an existing notification subscription. Supply the unique notification subscription ID. - * Get existing notification subscription. - * @param id Specifies the unique notification subscription ID (starts with not_). + * Returns a list of triggers of a notification. Triggers define the conditions that will trigger a notification. Triggers are returned sorted by creation date, with the most recently created accounts appearing first. By default, a maximum of 10 notification triggers are shown per page. + * List notification triggers of a notification. + * @param notification Specifies the unique notification ID (starts with not_). + * @param limit Specifies the maximum number of records to return. + * @param skip Specifies the offset for the first records to return. + * @param order Specifies the order in which to sort the results. */ - public getNotificationSubscription(id: string, _options?: Configuration): Observable { - const requestContextPromise = this.requestFactory.getNotificationSubscription(id, _options); + public getNotificationTriggers(notification: string, limit?: number, skip?: number, order?: SortOrder, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.getNotificationTriggers(notification, limit, skip, order, _options); // build promise chain let middlewarePreObservable = from(requestContextPromise); @@ -1218,20 +1241,35 @@ export class ObservableNotificationsApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getNotificationSubscription(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getNotificationTriggers(rsp))); })); } +} + +import { NotificationsApiRequestFactory, NotificationsApiResponseProcessor} from "../apis/NotificationsApi"; +export class ObservableNotificationsApi { + private requestFactory: NotificationsApiRequestFactory; + private responseProcessor: NotificationsApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: NotificationsApiRequestFactory, + responseProcessor?: NotificationsApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new NotificationsApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new NotificationsApiResponseProcessor(); + } + /** - * Returns a list of subscriptions of a notification. The subscriptions are returned sorted by creation date, with the most recently created accounts appearing first. By default, a maximum of 10 notification subscriptions are shown per page. - * List notification subscriptions of a notification. - * @param notification Specifies the unique notification ID (starts with not_). - * @param limit Specifies the maximum number of records to return. - * @param skip Specifies the offset for the first records to return. - * @param order Specifies the order in which to sort the results. + * Create a notification object. + * Create a notification object. + * @param createNotificationRequest */ - public getNotificationSubscriptions(notification: string, limit?: number, skip?: number, order?: SortOrder, _options?: Configuration): Observable { - const requestContextPromise = this.requestFactory.getNotificationSubscriptions(notification, limit, skip, order, _options); + public createNotification(createNotificationRequest: CreateNotificationRequest, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.createNotification(createNotificationRequest, _options); // build promise chain let middlewarePreObservable = from(requestContextPromise); @@ -1245,17 +1283,17 @@ export class ObservableNotificationsApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getNotificationSubscriptions(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createNotification(rsp))); })); } /** - * Retrieves the details of an existing notification trigger. Supply the unique notification trigger ID. - * Get existing notification trigger. - * @param id Specifies the unique notification trigger ID (starts with ntr_). + * Delete a notification by providing its notification id. + * Deletes a notification object. + * @param id Specifies the unique notification ID (starts with not_). */ - public getNotificationTrigger(id: string, _options?: Configuration): Observable { - const requestContextPromise = this.requestFactory.getNotificationTrigger(id, _options); + public deleteNotification(id: string, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.deleteNotification(id, _options); // build promise chain let middlewarePreObservable = from(requestContextPromise); @@ -1269,20 +1307,18 @@ export class ObservableNotificationsApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getNotificationTrigger(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteNotification(rsp))); })); } /** - * Returns a list of triggers of a notification. The triggers are returned sorted by creation date, with the most recently created accounts appearing first. By default, a maximum of 10 notification triggers are shown per page. - * List notification triggers of a notification. - * @param notification Specifies the unique notification ID (starts with not_). - * @param limit Specifies the maximum number of records to return. - * @param skip Specifies the offset for the first records to return. - * @param order Specifies the order in which to sort the results. + * Retrieves the details of an existing notification. Supply the unique notification ID. + * Get existing notification. + * @param id Specifies the unique notification ID (starts with not_). + * @param expand */ - public getNotificationTriggers(notification: string, limit?: number, skip?: number, order?: SortOrder, _options?: Configuration): Observable { - const requestContextPromise = this.requestFactory.getNotificationTriggers(notification, limit, skip, order, _options); + public getNotification(id: string, expand?: Array, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.getNotification(id, expand, _options); // build promise chain let middlewarePreObservable = from(requestContextPromise); @@ -1296,12 +1332,12 @@ export class ObservableNotificationsApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getNotificationTriggers(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getNotification(rsp))); })); } /** - * Returns a list of notifications. The notifications are returned sorted by creation date, with the most recently created notifications appearing first. By default, a maximum of 10 notifications are shown per page. + * Returns a list of notifications. Notifications are useful to get notified about events that happen on-chain or in your Openfort account. Notifications are returned sorted by creation date, with the most recently created notifications appearing first. By default, a maximum of 10 notifications are shown per page. * List notifications. * @param limit Specifies the maximum number of records to return. * @param skip Specifies the offset for the first records to return. diff --git a/src/generated/types/PromiseAPI.ts b/src/generated/types/PromiseAPI.ts index 93c4e436..0c2c0755 100644 --- a/src/generated/types/PromiseAPI.ts +++ b/src/generated/types/PromiseAPI.ts @@ -638,28 +638,18 @@ export class PromiseInventoriesApi { -import { ObservableNotificationsApi } from './ObservableAPI'; +import { ObservableNotificationSubscriptionsApi } from './ObservableAPI'; -import { NotificationsApiRequestFactory, NotificationsApiResponseProcessor} from "../apis/NotificationsApi"; -export class PromiseNotificationsApi { - private api: ObservableNotificationsApi +import { NotificationSubscriptionsApiRequestFactory, NotificationSubscriptionsApiResponseProcessor} from "../apis/NotificationSubscriptionsApi"; +export class PromiseNotificationSubscriptionsApi { + private api: ObservableNotificationSubscriptionsApi public constructor( configuration: Configuration, - requestFactory?: NotificationsApiRequestFactory, - responseProcessor?: NotificationsApiResponseProcessor + requestFactory?: NotificationSubscriptionsApiRequestFactory, + responseProcessor?: NotificationSubscriptionsApiResponseProcessor ) { - this.api = new ObservableNotificationsApi(configuration, requestFactory, responseProcessor); - } - - /** - * Create a notification object. - * Create a notification object. - * @param createNotificationRequest - */ - public createNotification(createNotificationRequest: CreateNotificationRequest, _options?: Configuration): Promise { - const result = this.api.createNotification(createNotificationRequest, _options); - return result.toPromise(); + this.api = new ObservableNotificationSubscriptionsApi(configuration, requestFactory, responseProcessor); } /** @@ -672,26 +662,6 @@ export class PromiseNotificationsApi { return result.toPromise(); } - /** - * Create a trigger for the provided notification. - * Create a notification trigger object. - * @param createTriggerRequest - */ - public createNotificationTrigger(createTriggerRequest: CreateTriggerRequest, _options?: Configuration): Promise { - const result = this.api.createNotificationTrigger(createTriggerRequest, _options); - return result.toPromise(); - } - - /** - * Delete a notification by providing its notification id. - * Deletes a notification object. - * @param id Specifies the unique notification ID (starts with not_). - */ - public deleteNotification(id: string, _options?: Configuration): Promise { - const result = this.api.deleteNotification(id, _options); - return result.toPromise(); - } - /** * Delete a notification subscription by providing its notification subscription id. * Deletes a notification subscription object. @@ -702,27 +672,6 @@ export class PromiseNotificationsApi { return result.toPromise(); } - /** - * Delete a notification trigger by providing its notification trigger id. - * Deletes a notification trigger object. - * @param id Specifies the unique notification trigger ID (starts with ntr_). - */ - public deleteNotificationTrigger(id: string, _options?: Configuration): Promise { - const result = this.api.deleteNotificationTrigger(id, _options); - return result.toPromise(); - } - - /** - * Retrieves the details of an existing account. Supply the unique notification ID. - * Get existing account. - * @param id Specifies the unique account ID (starts with not_). - * @param expand - */ - public getNotification(id: string, expand?: Array, _options?: Configuration): Promise { - const result = this.api.getNotification(id, expand, _options); - return result.toPromise(); - } - /** * Retrieves the details of an existing notification subscription. Supply the unique notification subscription ID. * Get existing notification subscription. @@ -734,7 +683,7 @@ export class PromiseNotificationsApi { } /** - * Returns a list of subscriptions of a notification. The subscriptions are returned sorted by creation date, with the most recently created accounts appearing first. By default, a maximum of 10 notification subscriptions are shown per page. + * Returns a list of subscriptions of a notification. Subscriptions define the the way you will get notified and the target of the notification. Subscriptions are returned sorted by creation date, with the most recently created accounts appearing first. By default, a maximum of 10 notification subscriptions are shown per page. * List notification subscriptions of a notification. * @param notification Specifies the unique notification ID (starts with not_). * @param limit Specifies the maximum number of records to return. @@ -746,6 +695,45 @@ export class PromiseNotificationsApi { return result.toPromise(); } + +} + + + +import { ObservableNotificationTriggersApi } from './ObservableAPI'; + +import { NotificationTriggersApiRequestFactory, NotificationTriggersApiResponseProcessor} from "../apis/NotificationTriggersApi"; +export class PromiseNotificationTriggersApi { + private api: ObservableNotificationTriggersApi + + public constructor( + configuration: Configuration, + requestFactory?: NotificationTriggersApiRequestFactory, + responseProcessor?: NotificationTriggersApiResponseProcessor + ) { + this.api = new ObservableNotificationTriggersApi(configuration, requestFactory, responseProcessor); + } + + /** + * Create a trigger for the provided notification. + * Create a notification trigger object. + * @param createTriggerRequest + */ + public createNotificationTrigger(createTriggerRequest: CreateTriggerRequest, _options?: Configuration): Promise { + const result = this.api.createNotificationTrigger(createTriggerRequest, _options); + return result.toPromise(); + } + + /** + * Delete a notification trigger by providing its notification trigger id. + * Deletes a notification trigger object. + * @param id Specifies the unique notification trigger ID (starts with ntr_). + */ + public deleteNotificationTrigger(id: string, _options?: Configuration): Promise { + const result = this.api.deleteNotificationTrigger(id, _options); + return result.toPromise(); + } + /** * Retrieves the details of an existing notification trigger. Supply the unique notification trigger ID. * Get existing notification trigger. @@ -757,7 +745,7 @@ export class PromiseNotificationsApi { } /** - * Returns a list of triggers of a notification. The triggers are returned sorted by creation date, with the most recently created accounts appearing first. By default, a maximum of 10 notification triggers are shown per page. + * Returns a list of triggers of a notification. Triggers define the conditions that will trigger a notification. Triggers are returned sorted by creation date, with the most recently created accounts appearing first. By default, a maximum of 10 notification triggers are shown per page. * List notification triggers of a notification. * @param notification Specifies the unique notification ID (starts with not_). * @param limit Specifies the maximum number of records to return. @@ -769,8 +757,58 @@ export class PromiseNotificationsApi { return result.toPromise(); } + +} + + + +import { ObservableNotificationsApi } from './ObservableAPI'; + +import { NotificationsApiRequestFactory, NotificationsApiResponseProcessor} from "../apis/NotificationsApi"; +export class PromiseNotificationsApi { + private api: ObservableNotificationsApi + + public constructor( + configuration: Configuration, + requestFactory?: NotificationsApiRequestFactory, + responseProcessor?: NotificationsApiResponseProcessor + ) { + this.api = new ObservableNotificationsApi(configuration, requestFactory, responseProcessor); + } + + /** + * Create a notification object. + * Create a notification object. + * @param createNotificationRequest + */ + public createNotification(createNotificationRequest: CreateNotificationRequest, _options?: Configuration): Promise { + const result = this.api.createNotification(createNotificationRequest, _options); + return result.toPromise(); + } + + /** + * Delete a notification by providing its notification id. + * Deletes a notification object. + * @param id Specifies the unique notification ID (starts with not_). + */ + public deleteNotification(id: string, _options?: Configuration): Promise { + const result = this.api.deleteNotification(id, _options); + return result.toPromise(); + } + + /** + * Retrieves the details of an existing notification. Supply the unique notification ID. + * Get existing notification. + * @param id Specifies the unique notification ID (starts with not_). + * @param expand + */ + public getNotification(id: string, expand?: Array, _options?: Configuration): Promise { + const result = this.api.getNotification(id, expand, _options); + return result.toPromise(); + } + /** - * Returns a list of notifications. The notifications are returned sorted by creation date, with the most recently created notifications appearing first. By default, a maximum of 10 notifications are shown per page. + * Returns a list of notifications. Notifications are useful to get notified about events that happen on-chain or in your Openfort account. Notifications are returned sorted by creation date, with the most recently created notifications appearing first. By default, a maximum of 10 notifications are shown per page. * List notifications. * @param limit Specifies the maximum number of records to return. * @param skip Specifies the offset for the first records to return.