academe-kit 0.3.9 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4929 -3172
- package/dist/index.esm.js +140 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +140 -4
- package/dist/index.js.map +1 -1
- package/dist/types/context/SecurityProvider/index.d.ts +10 -0
- package/dist/types/context/SecurityProvider/types.d.ts +1 -1
- package/dist/types/services/CourseService.d.ts +216 -0
- package/dist/types/services/InstitutionService.d.ts +595 -0
- package/dist/types/services/index.d.ts +3 -0
- package/dist/types/types/academe-api.d.ts +926 -0
- package/dist/types/types/index.d.ts +9 -0
- package/package.json +1 -1
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { SecurityContextType, AcademeKeycloakContextProps } from "./types";
|
|
3
|
+
interface InjectedKeycloakConfig {
|
|
4
|
+
token: string;
|
|
5
|
+
refreshToken: string;
|
|
6
|
+
fromMobile: boolean;
|
|
7
|
+
}
|
|
3
8
|
export declare const AcademeAuthProvider: React.FC<AcademeKeycloakContextProps>;
|
|
4
9
|
declare global {
|
|
5
10
|
interface Window {
|
|
6
11
|
accessToken?: string;
|
|
12
|
+
keycloakConfig?: InjectedKeycloakConfig;
|
|
13
|
+
ReactNativeWebView?: {
|
|
14
|
+
postMessage: (message: string) => void;
|
|
15
|
+
};
|
|
7
16
|
}
|
|
8
17
|
}
|
|
9
18
|
export declare const useAcademeAuth: () => SecurityContextType;
|
|
19
|
+
export {};
|
|
@@ -3,7 +3,7 @@ import { User } from '../../types';
|
|
|
3
3
|
import { AcademeApiClient, AcademeServices } from '../../services';
|
|
4
4
|
export type AcademeKeycloakContextProps = {
|
|
5
5
|
realm: string;
|
|
6
|
-
hubUrl
|
|
6
|
+
hubUrl: string;
|
|
7
7
|
clientId: string;
|
|
8
8
|
keycloakUrl: string;
|
|
9
9
|
apiBaseUrl?: string;
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import type { AcademeApiClient } from './index';
|
|
2
|
+
import type { components } from '../types/academe-api';
|
|
3
|
+
type CreateCourseDto = components['schemas']['CreateCourseDto'];
|
|
4
|
+
type UpdateCourseDto = components['schemas']['UpdateCourseDto'];
|
|
5
|
+
export declare function createCourseService(apiClient: AcademeApiClient): {
|
|
6
|
+
/**
|
|
7
|
+
* List all courses
|
|
8
|
+
*/
|
|
9
|
+
getAll(params?: {
|
|
10
|
+
categoryId?: string;
|
|
11
|
+
isActive?: boolean;
|
|
12
|
+
level?: string;
|
|
13
|
+
search?: string;
|
|
14
|
+
page?: number;
|
|
15
|
+
limit?: number;
|
|
16
|
+
}): Promise<import("openapi-fetch").FetchResponse<{
|
|
17
|
+
parameters: {
|
|
18
|
+
query?: never;
|
|
19
|
+
header?: never;
|
|
20
|
+
path?: never;
|
|
21
|
+
cookie?: never;
|
|
22
|
+
};
|
|
23
|
+
requestBody?: never;
|
|
24
|
+
responses: {
|
|
25
|
+
200: {
|
|
26
|
+
headers: {
|
|
27
|
+
[name: string]: unknown;
|
|
28
|
+
};
|
|
29
|
+
content: {
|
|
30
|
+
"application/json": {
|
|
31
|
+
status?: string;
|
|
32
|
+
data?: components["schemas"]["Course"][];
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
401: components["responses"]["Unauthorized"];
|
|
37
|
+
500: components["responses"]["ServerError"];
|
|
38
|
+
};
|
|
39
|
+
}, {
|
|
40
|
+
params: {
|
|
41
|
+
query: any;
|
|
42
|
+
};
|
|
43
|
+
}, `${string}/${string}`>>;
|
|
44
|
+
/**
|
|
45
|
+
* Get course by ID
|
|
46
|
+
*/
|
|
47
|
+
getById(id: string): Promise<import("openapi-fetch").FetchResponse<{
|
|
48
|
+
parameters: {
|
|
49
|
+
query?: never;
|
|
50
|
+
header?: never;
|
|
51
|
+
path: {
|
|
52
|
+
id: components["parameters"]["id"];
|
|
53
|
+
};
|
|
54
|
+
cookie?: never;
|
|
55
|
+
};
|
|
56
|
+
requestBody?: never;
|
|
57
|
+
responses: {
|
|
58
|
+
200: {
|
|
59
|
+
headers: {
|
|
60
|
+
[name: string]: unknown;
|
|
61
|
+
};
|
|
62
|
+
content: {
|
|
63
|
+
"application/json": {
|
|
64
|
+
status?: string;
|
|
65
|
+
data?: components["schemas"]["Course"];
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
400: components["responses"]["BadRequest"];
|
|
70
|
+
401: components["responses"]["Unauthorized"];
|
|
71
|
+
404: components["responses"]["NotFound"];
|
|
72
|
+
500: components["responses"]["ServerError"];
|
|
73
|
+
};
|
|
74
|
+
}, {
|
|
75
|
+
params: {
|
|
76
|
+
path: {
|
|
77
|
+
id: string;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
}, `${string}/${string}`>>;
|
|
81
|
+
/**
|
|
82
|
+
* Create a new course
|
|
83
|
+
*/
|
|
84
|
+
create(data: CreateCourseDto): Promise<import("openapi-fetch").FetchResponse<{
|
|
85
|
+
parameters: {
|
|
86
|
+
query?: never;
|
|
87
|
+
header?: never;
|
|
88
|
+
path?: never;
|
|
89
|
+
cookie?: never;
|
|
90
|
+
};
|
|
91
|
+
requestBody: {
|
|
92
|
+
content: {
|
|
93
|
+
"application/json": components["schemas"]["CreateCourseDto"];
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
responses: {
|
|
97
|
+
201: {
|
|
98
|
+
headers: {
|
|
99
|
+
[name: string]: unknown;
|
|
100
|
+
};
|
|
101
|
+
content: {
|
|
102
|
+
"application/json": {
|
|
103
|
+
status?: string;
|
|
104
|
+
data?: components["schemas"]["Course"];
|
|
105
|
+
message?: string;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
400: components["responses"]["BadRequest"];
|
|
110
|
+
401: components["responses"]["Unauthorized"];
|
|
111
|
+
500: components["responses"]["ServerError"];
|
|
112
|
+
};
|
|
113
|
+
}, {
|
|
114
|
+
body: {
|
|
115
|
+
description: string;
|
|
116
|
+
categoryId: string;
|
|
117
|
+
duration: number;
|
|
118
|
+
durationType: "hours" | "days" | "weeks" | "months";
|
|
119
|
+
externalId?: string;
|
|
120
|
+
quizId?: string;
|
|
121
|
+
isActive: boolean;
|
|
122
|
+
level?: "beginner" | "intermediate" | "advanced" | "expert";
|
|
123
|
+
};
|
|
124
|
+
}, `${string}/${string}`>>;
|
|
125
|
+
/**
|
|
126
|
+
* Update course
|
|
127
|
+
*/
|
|
128
|
+
update(id: string, data: UpdateCourseDto): Promise<import("openapi-fetch").FetchResponse<{
|
|
129
|
+
parameters: {
|
|
130
|
+
query?: never;
|
|
131
|
+
header?: never;
|
|
132
|
+
path: {
|
|
133
|
+
id: components["parameters"]["id"];
|
|
134
|
+
};
|
|
135
|
+
cookie?: never;
|
|
136
|
+
};
|
|
137
|
+
requestBody: {
|
|
138
|
+
content: {
|
|
139
|
+
"application/json": components["schemas"]["UpdateCourseDto"];
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
responses: {
|
|
143
|
+
200: {
|
|
144
|
+
headers: {
|
|
145
|
+
[name: string]: unknown;
|
|
146
|
+
};
|
|
147
|
+
content: {
|
|
148
|
+
"application/json": {
|
|
149
|
+
status?: string;
|
|
150
|
+
data?: components["schemas"]["Course"];
|
|
151
|
+
message?: string;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
400: components["responses"]["BadRequest"];
|
|
156
|
+
401: components["responses"]["Unauthorized"];
|
|
157
|
+
404: components["responses"]["NotFound"];
|
|
158
|
+
500: components["responses"]["ServerError"];
|
|
159
|
+
};
|
|
160
|
+
}, {
|
|
161
|
+
params: {
|
|
162
|
+
path: {
|
|
163
|
+
id: string;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
body: {
|
|
167
|
+
description?: string;
|
|
168
|
+
categoryId?: string;
|
|
169
|
+
duration?: number;
|
|
170
|
+
durationType?: "hours" | "days" | "weeks" | "months";
|
|
171
|
+
externalId?: string;
|
|
172
|
+
quizId?: string;
|
|
173
|
+
isActive?: boolean;
|
|
174
|
+
level?: "beginner" | "intermediate" | "advanced" | "expert";
|
|
175
|
+
};
|
|
176
|
+
}, `${string}/${string}`>>;
|
|
177
|
+
/**
|
|
178
|
+
* Delete course
|
|
179
|
+
*/
|
|
180
|
+
delete(id: string): Promise<import("openapi-fetch").FetchResponse<{
|
|
181
|
+
parameters: {
|
|
182
|
+
query?: never;
|
|
183
|
+
header?: never;
|
|
184
|
+
path: {
|
|
185
|
+
id: components["parameters"]["id"];
|
|
186
|
+
};
|
|
187
|
+
cookie?: never;
|
|
188
|
+
};
|
|
189
|
+
requestBody?: never;
|
|
190
|
+
responses: {
|
|
191
|
+
200: {
|
|
192
|
+
headers: {
|
|
193
|
+
[name: string]: unknown;
|
|
194
|
+
};
|
|
195
|
+
content: {
|
|
196
|
+
"application/json": {
|
|
197
|
+
status?: string;
|
|
198
|
+
message?: string;
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
400: components["responses"]["BadRequest"];
|
|
203
|
+
401: components["responses"]["Unauthorized"];
|
|
204
|
+
404: components["responses"]["NotFound"];
|
|
205
|
+
500: components["responses"]["ServerError"];
|
|
206
|
+
};
|
|
207
|
+
}, {
|
|
208
|
+
params: {
|
|
209
|
+
path: {
|
|
210
|
+
id: string;
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
}, `${string}/${string}`>>;
|
|
214
|
+
};
|
|
215
|
+
export type CourseService = ReturnType<typeof createCourseService>;
|
|
216
|
+
export {};
|