Skip to content

Commit 542e4bd

Browse files
authored
BC-11079 - Generate API client (#95)
1 parent 398425a commit 542e4bd

File tree

7 files changed

+61
-29
lines changed

7 files changed

+61
-29
lines changed

src/infra/authorization/authorization-api-client/.openapi-generator-ignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ models/*
3434
!models/api-validation-error.ts
3535
!models/authorization-body-params.ts
3636
!models/authorization-context-params.ts
37-
!models/authorized-reponse.ts
37+
!models/authorized-response.ts

src/infra/authorization/authorization-api-client/.openapi-generator/FILES

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ index.ts
44
models/api-validation-error.ts
55
models/authorization-body-params.ts
66
models/authorization-context-params.ts
7-
models/authorized-reponse.ts
7+
models/authorized-response.ts
88
runtime.ts

src/infra/authorization/authorization-api-client/apis/authorization-api.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ import * as runtime from '../runtime.js';
1717
import type {
1818
ApiValidationError,
1919
AuthorizationBodyParams,
20-
AuthorizedReponse,
20+
AuthorizedResponse,
2121
} from '../models/index.js';
2222
import {
2323
ApiValidationErrorFromJSON,
2424
ApiValidationErrorToJSON,
2525
AuthorizationBodyParamsFromJSON,
2626
AuthorizationBodyParamsToJSON,
27-
AuthorizedReponseFromJSON,
28-
AuthorizedReponseToJSON,
27+
AuthorizedResponseFromJSON,
28+
AuthorizedResponseToJSON,
2929
} from '../models/index.js';
3030

3131
export interface AuthorizationReferenceControllerAuthorizeByReferenceRequest {
@@ -47,12 +47,12 @@ export interface AuthorizationApiInterface {
4747
* @throws {RequiredError}
4848
* @memberof AuthorizationApiInterface
4949
*/
50-
authorizationReferenceControllerAuthorizeByReferenceRaw(requestParameters: AuthorizationReferenceControllerAuthorizeByReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthorizedReponse>>;
50+
authorizationReferenceControllerAuthorizeByReferenceRaw(requestParameters: AuthorizationReferenceControllerAuthorizeByReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthorizedResponse>>;
5151

5252
/**
5353
* Checks if user is authorized to perform the given operation.
5454
*/
55-
authorizationReferenceControllerAuthorizeByReference(requestParameters: AuthorizationReferenceControllerAuthorizeByReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthorizedReponse>;
55+
authorizationReferenceControllerAuthorizeByReference(requestParameters: AuthorizationReferenceControllerAuthorizeByReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthorizedResponse>;
5656

5757
}
5858

@@ -64,7 +64,7 @@ export class AuthorizationApi extends runtime.BaseAPI implements AuthorizationAp
6464
/**
6565
* Checks if user is authorized to perform the given operation.
6666
*/
67-
async authorizationReferenceControllerAuthorizeByReferenceRaw(requestParameters: AuthorizationReferenceControllerAuthorizeByReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthorizedReponse>> {
67+
async authorizationReferenceControllerAuthorizeByReferenceRaw(requestParameters: AuthorizationReferenceControllerAuthorizeByReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthorizedResponse>> {
6868
if (requestParameters['authorizationBodyParams'] == null) {
6969
throw new runtime.RequiredError(
7070
'authorizationBodyParams',
@@ -94,13 +94,13 @@ export class AuthorizationApi extends runtime.BaseAPI implements AuthorizationAp
9494
body: AuthorizationBodyParamsToJSON(requestParameters['authorizationBodyParams']),
9595
}, initOverrides);
9696

97-
return new runtime.JSONApiResponse(response, (jsonValue) => AuthorizedReponseFromJSON(jsonValue));
97+
return new runtime.JSONApiResponse(response, (jsonValue) => AuthorizedResponseFromJSON(jsonValue));
9898
}
9999

100100
/**
101101
* Checks if user is authorized to perform the given operation.
102102
*/
103-
async authorizationReferenceControllerAuthorizeByReference(requestParameters: AuthorizationReferenceControllerAuthorizeByReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthorizedReponse> {
103+
async authorizationReferenceControllerAuthorizeByReference(requestParameters: AuthorizationReferenceControllerAuthorizeByReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthorizedResponse> {
104104
const response = await this.authorizationReferenceControllerAuthorizeByReferenceRaw(requestParameters, initOverrides);
105105
return await response.value();
106106
}

src/infra/authorization/authorization-api-client/models/authorization-context-params.ts

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,17 @@ export const AuthorizationContextParamsRequiredPermissions = {
5555
ADMIN_EDIT: 'ADMIN_EDIT',
5656
ADMIN_VIEW: 'ADMIN_VIEW',
5757
BASE_VIEW: 'BASE_VIEW',
58+
BOARD_VIEW: 'BOARD_VIEW',
59+
BOARD_EDIT: 'BOARD_EDIT',
60+
BOARD_SHARE_BOARD: 'BOARD_SHARE_BOARD',
61+
BOARD_MANAGE_VIDEOCONFERENCE: 'BOARD_MANAGE_VIDEOCONFERENCE',
62+
BOARD_MANAGE_READERS_CAN_EDIT: 'BOARD_MANAGE_READERS_CAN_EDIT',
63+
BOARD_MANAGE: 'BOARD_MANAGE',
64+
BOARD_RELOCATE_CONTENT: 'BOARD_RELOCATE_CONTENT',
5865
CALENDAR_CREATE: 'CALENDAR_CREATE',
5966
CALENDAR_EDIT: 'CALENDAR_EDIT',
6067
CALENDAR_VIEW: 'CALENDAR_VIEW',
68+
CAN_EXECUTE_INSTANCE_OPERATIONS: 'CAN_EXECUTE_INSTANCE_OPERATIONS',
6169
CHANGE_TEAM_ROLES: 'CHANGE_TEAM_ROLES',
6270
CLASS_CREATE: 'CLASS_CREATE',
6371
CLASS_EDIT: 'CLASS_EDIT',
@@ -118,14 +126,17 @@ export const AuthorizationContextParamsRequiredPermissions = {
118126
IMPORT_USER_UPDATE: 'IMPORT_USER_UPDATE',
119127
IMPORT_USER_VIEW: 'IMPORT_USER_VIEW',
120128
INSTANCE_VIEW: 'INSTANCE_VIEW',
129+
INSTANCE_EDIT: 'INSTANCE_EDIT',
121130
INVITE_ADMINISTRATORS: 'INVITE_ADMINISTRATORS',
122-
INVITE_EXPERTS: 'INVITE_EXPERTS',
131+
INVITE_EXTERNAL_PERSONS: 'INVITE_EXTERNAL_PERSONS',
123132
JOIN_MEETING: 'JOIN_MEETING',
124133
LEAVE_TEAM: 'LEAVE_TEAM',
125134
LERNSTORE_VIEW: 'LERNSTORE_VIEW',
126135
LESSONS_CREATE: 'LESSONS_CREATE',
127136
LESSONS_VIEW: 'LESSONS_VIEW',
128137
LINK_CREATE: 'LINK_CREATE',
138+
MEDIA_SCHOOL_LICENSE_ADMIN: 'MEDIA_SCHOOL_LICENSE_ADMIN',
139+
MEDIA_SOURCE_ADMIN: 'MEDIA_SOURCE_ADMIN',
129140
NEWS_CREATE: 'NEWS_CREATE',
130141
NEWS_EDIT: 'NEWS_EDIT',
131142
NEWS_VIEW: 'NEWS_VIEW',
@@ -148,10 +159,24 @@ export const AuthorizationContextParamsRequiredPermissions = {
148159
ROLE_CREATE: 'ROLE_CREATE',
149160
ROLE_EDIT: 'ROLE_EDIT',
150161
ROLE_VIEW: 'ROLE_VIEW',
162+
ROOM_EDIT_CONTENT: 'ROOM_EDIT_CONTENT',
163+
ROOM_EDIT_ROOM: 'ROOM_EDIT_ROOM',
164+
ROOM_LIST_CONTENT: 'ROOM_LIST_CONTENT',
165+
ROOM_DELETE_ROOM: 'ROOM_DELETE_ROOM',
166+
ROOM_LEAVE_ROOM: 'ROOM_LEAVE_ROOM',
167+
ROOM_COPY_ROOM: 'ROOM_COPY_ROOM',
168+
ROOM_SHARE_ROOM: 'ROOM_SHARE_ROOM',
169+
ROOM_ADD_MEMBERS: 'ROOM_ADD_MEMBERS',
170+
ROOM_REMOVE_MEMBERS: 'ROOM_REMOVE_MEMBERS',
171+
ROOM_CHANGE_ROLES: 'ROOM_CHANGE_ROLES',
172+
ROOM_CHANGE_OWNER: 'ROOM_CHANGE_OWNER',
173+
ROOM_MANAGE_INVITATIONLINKS: 'ROOM_MANAGE_INVITATIONLINKS',
174+
ROOM_LIST_DRAFTS: 'ROOM_LIST_DRAFTS',
175+
ROOM_MANAGE_VIDEOCONFERENCES: 'ROOM_MANAGE_VIDEOCONFERENCES',
176+
SCHOOL_ADMINISTRATE_ROOMS: 'SCHOOL_ADMINISTRATE_ROOMS',
151177
SCHOOL_CHAT_MANAGE: 'SCHOOL_CHAT_MANAGE',
152178
SCHOOL_CREATE: 'SCHOOL_CREATE',
153179
SCHOOL_EDIT: 'SCHOOL_EDIT',
154-
SCHOOL_EDIT_ALL: 'SCHOOL_EDIT_ALL',
155180
SCHOOL_LOGO_MANAGE: 'SCHOOL_LOGO_MANAGE',
156181
SCHOOL_NEWS_EDIT: 'SCHOOL_NEWS_EDIT',
157182
SCHOOL_PERMISSION_CHANGE: 'SCHOOL_PERMISSION_CHANGE',
@@ -160,6 +185,14 @@ export const AuthorizationContextParamsRequiredPermissions = {
160185
SCHOOL_SYSTEM_EDIT: 'SCHOOL_SYSTEM_EDIT',
161186
SCHOOL_SYSTEM_VIEW: 'SCHOOL_SYSTEM_VIEW',
162187
SCHOOL_TOOL_ADMIN: 'SCHOOL_TOOL_ADMIN',
188+
SCHOOL_VIEW: 'SCHOOL_VIEW',
189+
SCHOOL_BECOME_ROOMOWNER: 'SCHOOL_BECOME_ROOMOWNER',
190+
SCHOOL_CREATE_ROOM: 'SCHOOL_CREATE_ROOM',
191+
SCHOOL_EDIT_ROOM: 'SCHOOL_EDIT_ROOM',
192+
SCHOOL_DELETE_ROOM: 'SCHOOL_DELETE_ROOM',
193+
SCHOOL_LIST_DISCOVERABLE_TEACHERS: 'SCHOOL_LIST_DISCOVERABLE_TEACHERS',
194+
SCHOOL_LIST_ROOM_MEMBERS: 'SCHOOL_LIST_ROOM_MEMBERS',
195+
SCHOOL_MANAGE_ROOM_INVITATIONLINKS: 'SCHOOL_MANAGE_ROOM_INVITATIONLINKS',
163196
SCOPE_PERMISSIONS_VIEW: 'SCOPE_PERMISSIONS_VIEW',
164197
START_MEETING: 'START_MEETING',
165198
STUDENT_CREATE: 'STUDENT_CREATE',
@@ -196,7 +229,6 @@ export const AuthorizationContextParamsRequiredPermissions = {
196229
TOPIC_EDIT: 'TOPIC_EDIT',
197230
TOPIC_VIEW: 'TOPIC_VIEW',
198231
UPLOAD_FILES: 'UPLOAD_FILES',
199-
USE_LIBREOFFICE: 'USE_LIBREOFFICE',
200232
USE_ROCKETCHAT: 'USE_ROCKETCHAT',
201233
USERGROUP_CREATE: 'USERGROUP_CREATE',
202234
USERGROUP_EDIT: 'USERGROUP_EDIT',

src/infra/authorization/authorization-api-client/models/authorized-reponse.ts renamed to src/infra/authorization/authorization-api-client/models/authorized-response.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,37 +16,37 @@ import { mapValues } from '../runtime.js';
1616
/**
1717
*
1818
* @export
19-
* @interface AuthorizedReponse
19+
* @interface AuthorizedResponse
2020
*/
21-
export interface AuthorizedReponse {
21+
export interface AuthorizedResponse {
2222
/**
2323
*
2424
* @type {string}
25-
* @memberof AuthorizedReponse
25+
* @memberof AuthorizedResponse
2626
*/
2727
userId: string;
2828
/**
2929
*
3030
* @type {boolean}
31-
* @memberof AuthorizedReponse
31+
* @memberof AuthorizedResponse
3232
*/
3333
isAuthorized: boolean;
3434
}
3535

3636
/**
37-
* Check if a given object implements the AuthorizedReponse interface.
37+
* Check if a given object implements the AuthorizedResponse interface.
3838
*/
39-
export function instanceOfAuthorizedReponse(value: object): value is AuthorizedReponse {
39+
export function instanceOfAuthorizedResponse(value: object): value is AuthorizedResponse {
4040
if (!('userId' in value) || value['userId'] === undefined) return false;
4141
if (!('isAuthorized' in value) || value['isAuthorized'] === undefined) return false;
4242
return true;
4343
}
4444

45-
export function AuthorizedReponseFromJSON(json: any): AuthorizedReponse {
46-
return AuthorizedReponseFromJSONTyped(json, false);
45+
export function AuthorizedResponseFromJSON(json: any): AuthorizedResponse {
46+
return AuthorizedResponseFromJSONTyped(json, false);
4747
}
4848

49-
export function AuthorizedReponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): AuthorizedReponse {
49+
export function AuthorizedResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): AuthorizedResponse {
5050
if (json == null) {
5151
return json;
5252
}
@@ -57,11 +57,11 @@ export function AuthorizedReponseFromJSONTyped(json: any, ignoreDiscriminator: b
5757
};
5858
}
5959

60-
export function AuthorizedReponseToJSON(json: any): AuthorizedReponse {
61-
return AuthorizedReponseToJSONTyped(json, false);
60+
export function AuthorizedResponseToJSON(json: any): AuthorizedResponse {
61+
return AuthorizedResponseToJSONTyped(json, false);
6262
}
6363

64-
export function AuthorizedReponseToJSONTyped(value?: AuthorizedReponse | null, ignoreDiscriminator: boolean = false): any {
64+
export function AuthorizedResponseToJSONTyped(value?: AuthorizedResponse | null, ignoreDiscriminator: boolean = false): any {
6565
if (value == null) {
6666
return value;
6767
}

src/infra/authorization/authorization-api-client/models/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
export * from './api-validation-error.js';
44
export * from './authorization-body-params.js';
55
export * from './authorization-context-params.js';
6-
export * from './authorized-reponse.js';
6+
export * from './authorized-response.js';

src/infra/authorization/authorization.service.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Test, TestingModule } from '@nestjs/testing';
33
import { HttpRequest } from 'uWebSockets.js';
44
import { WebSocketCloseCode } from '../../shared/type/websocket-close-code.js';
55
import { Logger } from '../logger/index.js';
6-
import { AuthorizationApi, AuthorizedReponse } from './authorization-api-client/index.js';
6+
import { AuthorizationApi, AuthorizedResponse } from './authorization-api-client/index.js';
77
import { AuthorizationService } from './authorization.service.js';
88

99
describe(AuthorizationService.name, () => {
@@ -51,7 +51,7 @@ describe(AuthorizationService.name, () => {
5151
const setup = () => {
5252
const { req } = setupRequest();
5353

54-
const response = createMock<AuthorizedReponse>({
54+
const response = createMock<AuthorizedResponse>({
5555
isAuthorized: true,
5656
userId: '123',
5757
});
@@ -75,7 +75,7 @@ describe(AuthorizationService.name, () => {
7575
const setup = () => {
7676
const { req } = setupRequest();
7777

78-
const response = createMock<AuthorizedReponse>({
78+
const response = createMock<AuthorizedResponse>({
7979
isAuthorized: false,
8080
userId: '123',
8181
});

0 commit comments

Comments
 (0)