Skip to content

Commit

Permalink
Merge pull request #322 from RedHatInsights/create-v2-notifications
Browse files Browse the repository at this point in the history
feat: create V2 spec of notifications client RHCLOUD-36224
  • Loading branch information
florkbr authored Nov 19, 2024
2 parents da1d9ee + 6196b8f commit 4425e2c
Show file tree
Hide file tree
Showing 30 changed files with 2,543 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/notifications/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"executor": "@redhat-cloud-services/build-utils:client-generator",
"options": {
"specs": {
"default": "https://console.redhat.com/api/notifications/v1.0/openapi.json"
"default": "https://console.redhat.com/api/notifications/v1.0/openapi.json",
"v2": "https://console.redhat.com/api/notifications/v2/openapi.json"
}
}
},
Expand Down
4 changes: 4 additions & 0 deletions packages/notifications/v2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
wwwroot/*.js
node_modules
typings
dist
6 changes: 6 additions & 0 deletions packages/notifications/v2/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.openapi-generator
node_modules
.openapi-generator-ignore
package-lock.json
*.ts
!*.d.ts
23 changes: 23 additions & 0 deletions packages/notifications/v2/.openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
29 changes: 29 additions & 0 deletions packages/notifications/v2/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.gitignore
.npmignore
.openapi-generator-ignore
EventResourceV2GetEvents/index.ts
NotificationResourceV2AppendBehaviorGroupToEventType/index.ts
NotificationResourceV2CreateBehaviorGroup/index.ts
NotificationResourceV2DeleteBehaviorGroup/index.ts
NotificationResourceV2DeleteBehaviorGroupFromEventType/index.ts
NotificationResourceV2FindBehaviorGroupsByBundleId/index.ts
NotificationResourceV2GetApplicationByNameAndBundleName/index.ts
NotificationResourceV2GetApplicationsFacets/index.ts
NotificationResourceV2GetBehaviorGroupsAffectedByRemovalOfEndpoint/index.ts
NotificationResourceV2GetBundleByName/index.ts
NotificationResourceV2GetBundleFacets/index.ts
NotificationResourceV2GetEventTypes/index.ts
NotificationResourceV2GetEventTypesAffectedByRemovalOfBehaviorGroup/index.ts
NotificationResourceV2GetEventTypesByNameAndBundleAndApplicationName/index.ts
NotificationResourceV2GetLinkedBehaviorGroups/index.ts
NotificationResourceV2UpdateBehaviorGroup/index.ts
NotificationResourceV2UpdateBehaviorGroupActions/index.ts
NotificationResourceV2UpdateEventTypeBehaviors/index.ts
NotificationResourceV2UpdateEventTypeEndpoints/index.ts
OrgConfigResourceV2GetDailyDigestTimePreference/index.ts
OrgConfigResourceV2SaveDailyDigestTimePreference/index.ts
api.ts
git_push.sh
index.ts
index.ts
types/index.ts
1 change: 1 addition & 0 deletions packages/notifications/v2/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.0.0
215 changes: 215 additions & 0 deletions packages/notifications/v2/EventResourceV2GetEvents/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
// @ts-ignore
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig, Method } from 'axios';
// @ts-ignore
import { COLLECTION_FORMATS, RequiredError, AuthTypeEnum, DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '@redhat-cloud-services/javascript-clients-shared/dist/common';
import type { RequestArgs } from '@redhat-cloud-services/javascript-clients-shared/dist/common';
// @ts-ignore
import { BaseAPI } from '@redhat-cloud-services/javascript-clients-shared/dist/base';
import { Configuration } from '@redhat-cloud-services/javascript-clients-shared/dist/configuration';

// @ts-ignore
import type { EventLogEntryActionStatus, PageEventLogEntry } from '../types';


export type EventResourceV2GetEventsParams = {
/**
*
* @type { Set<string> }
* @memberof EventResourceV2GetEventsApi
*/
appIds?: Set<string>,
/**
*
* @type { Set<string> }
* @memberof EventResourceV2GetEventsApi
*/
bundleIds?: Set<string>,
/**
*
* @type { string }
* @memberof EventResourceV2GetEventsApi
*/
endDate?: string,
/**
*
* @type { Set<string> }
* @memberof EventResourceV2GetEventsApi
*/
endpointTypes?: Set<string>,
/**
*
* @type { string }
* @memberof EventResourceV2GetEventsApi
*/
eventTypeDisplayName?: string,
/**
*
* @type { boolean }
* @memberof EventResourceV2GetEventsApi
*/
includeActions?: boolean,
/**
*
* @type { boolean }
* @memberof EventResourceV2GetEventsApi
*/
includeDetails?: boolean,
/**
*
* @type { boolean }
* @memberof EventResourceV2GetEventsApi
*/
includePayload?: boolean,
/**
*
* @type { Set<boolean> }
* @memberof EventResourceV2GetEventsApi
*/
invocationResults?: Set<boolean>,
/**
*
* @type { number }
* @memberof EventResourceV2GetEventsApi
*/
limit?: number,
/**
*
* @type { number }
* @memberof EventResourceV2GetEventsApi
*/
offset?: number,
/**
*
* @type { number }
* @memberof EventResourceV2GetEventsApi
*/
pageNumber?: number,
/**
*
* @type { string }
* @memberof EventResourceV2GetEventsApi
*/
sortBy?: string,
/**
*
* @type { string }
* @memberof EventResourceV2GetEventsApi
*/
sortBy2?: string,
/**
*
* @type { string }
* @memberof EventResourceV2GetEventsApi
*/
startDate?: string,
/**
*
* @type { Set<EventLogEntryActionStatus> }
* @memberof EventResourceV2GetEventsApi
*/
status?: Set<EventLogEntryActionStatus>,
options?: AxiosRequestConfig
}

export type EventResourceV2GetEventsReturnType = AxiosPromise<PageEventLogEntry>;

const isEventResourceV2GetEventsObjectParams = (params: [EventResourceV2GetEventsParams] | unknown[]): params is [EventResourceV2GetEventsParams] => {
return params.length === 1 && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true
}
/**
* Retrieves the event log entries. Use this endpoint to review a full history of the events related to the tenant. You can sort by the bundle, application, event, and created fields. You can specify the sort order by appending :asc or :desc to the field, for example bundle:desc. Sorting defaults to desc for the created field and to asc for all other fields.
* @summary Retrieve the event log entries
* @param {EventResourceV2GetEventsParams} config with all available params.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
export const eventResourceV2GetEventsParamCreator = async (...config: ([EventResourceV2GetEventsParams] | [Set<string>, Set<string>, string, Set<string>, string, boolean, boolean, boolean, Set<boolean>, number, number, number, string, string, string, Set<EventLogEntryActionStatus>, AxiosRequestConfig])): Promise<RequestArgs> => {
const params = isEventResourceV2GetEventsObjectParams(config) ? config[0] : ['appIds', 'bundleIds', 'endDate', 'endpointTypes', 'eventTypeDisplayName', 'includeActions', 'includeDetails', 'includePayload', 'invocationResults', 'limit', 'offset', 'pageNumber', 'sortBy', 'sortBy2', 'startDate', 'status', 'options'].reduce((acc, curr, index) => ({ ...acc, [curr]: config[index] }), {}) as EventResourceV2GetEventsParams;
const { appIds, bundleIds, endDate, endpointTypes, eventTypeDisplayName, includeActions, includeDetails, includePayload, invocationResults, limit, offset, pageNumber, sortBy, sortBy2, startDate, status, options = {} } = params;
const localVarPath = `/notifications/events`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const localVarRequestOptions = { method: 'GET' as Method, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;

if (appIds) {
localVarQueryParameter['appIds'] = Array.from(appIds);
}

if (bundleIds) {
localVarQueryParameter['bundleIds'] = Array.from(bundleIds);
}

if (endDate !== undefined) {
localVarQueryParameter['endDate'] = (endDate as any instanceof Date) ?
(endDate as any).toISOString().substr(0,10) :
endDate;
}

if (endpointTypes) {
localVarQueryParameter['endpointTypes'] = Array.from(endpointTypes);
}

if (eventTypeDisplayName !== undefined) {
localVarQueryParameter['eventTypeDisplayName'] = eventTypeDisplayName;
}

if (includeActions !== undefined) {
localVarQueryParameter['includeActions'] = includeActions;
}

if (includeDetails !== undefined) {
localVarQueryParameter['includeDetails'] = includeDetails;
}

if (includePayload !== undefined) {
localVarQueryParameter['includePayload'] = includePayload;
}

if (invocationResults) {
localVarQueryParameter['invocationResults'] = Array.from(invocationResults);
}

if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}

if (offset !== undefined) {
localVarQueryParameter['offset'] = offset;
}

if (pageNumber !== undefined) {
localVarQueryParameter['pageNumber'] = pageNumber;
}

if (sortBy !== undefined) {
localVarQueryParameter['sortBy'] = sortBy;
}

if (sortBy2 !== undefined) {
localVarQueryParameter['sort_by'] = sortBy2;
}

if (startDate !== undefined) {
localVarQueryParameter['startDate'] = (startDate as any instanceof Date) ?
(startDate as any).toISOString().substr(0,10) :
startDate;
}

if (status) {
localVarQueryParameter['status'] = Array.from(status);
}



setSearchParams(localVarUrlObj, localVarQueryParameter);
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};

return {
urlObj: localVarUrlObj,
options: localVarRequestOptions,
};
}

export default eventResourceV2GetEventsParamCreator;
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// @ts-ignore
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig, Method } from 'axios';
// @ts-ignore
import { COLLECTION_FORMATS, RequiredError, AuthTypeEnum, DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '@redhat-cloud-services/javascript-clients-shared/dist/common';
import type { RequestArgs } from '@redhat-cloud-services/javascript-clients-shared/dist/common';
// @ts-ignore
import { BaseAPI } from '@redhat-cloud-services/javascript-clients-shared/dist/base';
import { Configuration } from '@redhat-cloud-services/javascript-clients-shared/dist/configuration';

// @ts-ignore
import type { } from '../types';


export type NotificationResourceV2AppendBehaviorGroupToEventTypeParams = {
/**
*
* @type { string }
* @memberof NotificationResourceV2AppendBehaviorGroupToEventTypeApi
*/
behaviorGroupUuid: string,
/**
*
* @type { string }
* @memberof NotificationResourceV2AppendBehaviorGroupToEventTypeApi
*/
eventTypeUuid: string,
options?: AxiosRequestConfig
}

export type NotificationResourceV2AppendBehaviorGroupToEventTypeReturnType = AxiosPromise<void>;

const isNotificationResourceV2AppendBehaviorGroupToEventTypeObjectParams = (params: [NotificationResourceV2AppendBehaviorGroupToEventTypeParams] | unknown[]): params is [NotificationResourceV2AppendBehaviorGroupToEventTypeParams] => {
return params.length === 1 && Object.prototype.hasOwnProperty.call(params, 'behaviorGroupUuid') && Object.prototype.hasOwnProperty.call(params, 'eventTypeUuid')
}
/**
*
* @summary Add a behavior group to the given event type.
* @param {NotificationResourceV2AppendBehaviorGroupToEventTypeParams} config with all available params.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
export const notificationResourceV2AppendBehaviorGroupToEventTypeParamCreator = async (...config: ([NotificationResourceV2AppendBehaviorGroupToEventTypeParams] | [string, string, AxiosRequestConfig])): Promise<RequestArgs> => {
const params = isNotificationResourceV2AppendBehaviorGroupToEventTypeObjectParams(config) ? config[0] : ['behaviorGroupUuid', 'eventTypeUuid', 'options'].reduce((acc, curr, index) => ({ ...acc, [curr]: config[index] }), {}) as NotificationResourceV2AppendBehaviorGroupToEventTypeParams;
const { behaviorGroupUuid, eventTypeUuid, options = {} } = params;
const localVarPath = `/notifications/eventTypes/{eventTypeUuid}/behaviorGroups/{behaviorGroupUuid}`
.replace(`{${"behaviorGroupUuid"}}`, encodeURIComponent(String(behaviorGroupUuid)))
.replace(`{${"eventTypeUuid"}}`, encodeURIComponent(String(eventTypeUuid)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const localVarRequestOptions = { method: 'PUT' as Method, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;



setSearchParams(localVarUrlObj, localVarQueryParameter);
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};

return {
urlObj: localVarUrlObj,
options: localVarRequestOptions,
};
}

export default notificationResourceV2AppendBehaviorGroupToEventTypeParamCreator;
Loading

0 comments on commit 4425e2c

Please sign in to comment.