@easyedu/js-lsm-api 1.67.0 → 1.68.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.
Files changed (62) hide show
  1. package/.openapi-generator/FILES +8 -0
  2. package/README.md +8 -2
  3. package/dist/apis/ContentApi.d.ts +56 -0
  4. package/dist/apis/ContentApi.js +121 -1
  5. package/dist/esm/apis/ContentApi.d.ts +56 -0
  6. package/dist/esm/apis/ContentApi.js +120 -0
  7. package/dist/esm/models/ContentAttemptItem.d.ts +69 -0
  8. package/dist/esm/models/ContentAttemptItem.js +68 -0
  9. package/dist/esm/models/ContentAttemptRollupScore.d.ts +38 -0
  10. package/dist/esm/models/ContentAttemptRollupScore.js +47 -0
  11. package/dist/esm/models/ContentAttemptScore.d.ts +50 -0
  12. package/dist/esm/models/ContentAttemptScore.js +47 -0
  13. package/dist/esm/models/GetContentAttempts.d.ts +90 -0
  14. package/dist/esm/models/GetContentAttempts.js +84 -0
  15. package/dist/esm/models/GetContentSession.d.ts +12 -0
  16. package/dist/esm/models/GetContentSession.js +8 -0
  17. package/dist/esm/models/GetContentSessionDetail.d.ts +12 -0
  18. package/dist/esm/models/GetContentSessionDetail.js +8 -0
  19. package/dist/esm/models/GetContentSessionListItem.d.ts +24 -0
  20. package/dist/esm/models/GetContentSessionListItem.js +16 -0
  21. package/dist/esm/models/PostContentSession.d.ts +12 -0
  22. package/dist/esm/models/PostContentSession.js +8 -0
  23. package/dist/esm/models/index.d.ts +4 -0
  24. package/dist/esm/models/index.js +4 -0
  25. package/dist/models/ContentAttemptItem.d.ts +69 -0
  26. package/dist/models/ContentAttemptItem.js +75 -0
  27. package/dist/models/ContentAttemptRollupScore.d.ts +38 -0
  28. package/dist/models/ContentAttemptRollupScore.js +54 -0
  29. package/dist/models/ContentAttemptScore.d.ts +50 -0
  30. package/dist/models/ContentAttemptScore.js +54 -0
  31. package/dist/models/GetContentAttempts.d.ts +90 -0
  32. package/dist/models/GetContentAttempts.js +92 -0
  33. package/dist/models/GetContentSession.d.ts +12 -0
  34. package/dist/models/GetContentSession.js +8 -0
  35. package/dist/models/GetContentSessionDetail.d.ts +12 -0
  36. package/dist/models/GetContentSessionDetail.js +8 -0
  37. package/dist/models/GetContentSessionListItem.d.ts +24 -0
  38. package/dist/models/GetContentSessionListItem.js +16 -0
  39. package/dist/models/PostContentSession.d.ts +12 -0
  40. package/dist/models/PostContentSession.js +8 -0
  41. package/dist/models/index.d.ts +4 -0
  42. package/dist/models/index.js +4 -0
  43. package/docs/ContentApi.md +159 -0
  44. package/docs/ContentAttemptItem.md +47 -0
  45. package/docs/ContentAttemptRollupScore.md +37 -0
  46. package/docs/ContentAttemptScore.md +41 -0
  47. package/docs/GetContentAttempts.md +51 -0
  48. package/docs/GetContentSession.md +4 -0
  49. package/docs/GetContentSessionDetail.md +4 -0
  50. package/docs/GetContentSessionListItem.md +8 -0
  51. package/docs/PostContentSession.md +4 -0
  52. package/package.json +1 -1
  53. package/src/apis/ContentApi.ts +172 -0
  54. package/src/models/ContentAttemptItem.ts +128 -0
  55. package/src/models/ContentAttemptRollupScore.ts +75 -0
  56. package/src/models/ContentAttemptScore.ts +89 -0
  57. package/src/models/GetContentAttempts.ts +164 -0
  58. package/src/models/GetContentSession.ts +18 -0
  59. package/src/models/GetContentSessionDetail.ts +18 -0
  60. package/src/models/GetContentSessionListItem.ts +36 -0
  61. package/src/models/PostContentSession.ts +18 -0
  62. package/src/models/index.ts +4 -0
@@ -18,6 +18,11 @@ import {
18
18
  GetContentFromJSON,
19
19
  GetContentToJSON,
20
20
  } from '../models/GetContent';
21
+ import {
22
+ type GetContentAttempts,
23
+ GetContentAttemptsFromJSON,
24
+ GetContentAttemptsToJSON,
25
+ } from '../models/GetContentAttempts';
21
26
  import {
22
27
  type GetContentList,
23
28
  GetContentListFromJSON,
@@ -147,6 +152,14 @@ export interface GetContentRequest {
147
152
  courseId: string;
148
153
  }
149
154
 
155
+ export interface GetContentAttemptsRequest {
156
+ contentId: string;
157
+ moduleId: string;
158
+ courseId: string;
159
+ userId?: number;
160
+ environment?: GetContentAttemptsEnvironmentEnum;
161
+ }
162
+
150
163
  export interface GetContentListRequest {
151
164
  moduleId: string;
152
165
  courseId: string;
@@ -239,6 +252,13 @@ export interface PostContentSessionRequest {
239
252
  environment?: PostContentSessionEnvironmentEnum;
240
253
  }
241
254
 
255
+ export interface PostContentSessionRetakeRequest {
256
+ contentId: string;
257
+ moduleId: string;
258
+ courseId: string;
259
+ environment?: PostContentSessionRetakeEnvironmentEnum;
260
+ }
261
+
242
262
  export interface PostContentUploadRequest {
243
263
  moduleId: string;
244
264
  courseId: string;
@@ -528,6 +548,77 @@ export class ContentApi extends runtime.BaseAPI {
528
548
  return await response.value();
529
549
  }
530
550
 
551
+ /**
552
+ * Creates request options for getContentAttempts without sending the request
553
+ */
554
+ async getContentAttemptsRequestOpts(requestParameters: GetContentAttemptsRequest): Promise<runtime.RequestOpts> {
555
+ if (requestParameters['contentId'] == null) {
556
+ throw new runtime.RequiredError(
557
+ 'contentId',
558
+ 'Required parameter "contentId" was null or undefined when calling getContentAttempts().'
559
+ );
560
+ }
561
+
562
+ if (requestParameters['moduleId'] == null) {
563
+ throw new runtime.RequiredError(
564
+ 'moduleId',
565
+ 'Required parameter "moduleId" was null or undefined when calling getContentAttempts().'
566
+ );
567
+ }
568
+
569
+ if (requestParameters['courseId'] == null) {
570
+ throw new runtime.RequiredError(
571
+ 'courseId',
572
+ 'Required parameter "courseId" was null or undefined when calling getContentAttempts().'
573
+ );
574
+ }
575
+
576
+ const queryParameters: any = {};
577
+
578
+ if (requestParameters['userId'] != null) {
579
+ queryParameters['user_id'] = requestParameters['userId'];
580
+ }
581
+
582
+ if (requestParameters['environment'] != null) {
583
+ queryParameters['environment'] = requestParameters['environment'];
584
+ }
585
+
586
+ const headerParameters: runtime.HTTPHeaders = {};
587
+
588
+
589
+ let urlPath = `/courses/{courseId}/modules/{moduleId}/contents/{contentId}/attempts`;
590
+ urlPath = urlPath.replace('{contentId}', encodeURIComponent(String(requestParameters['contentId'])));
591
+ urlPath = urlPath.replace('{moduleId}', encodeURIComponent(String(requestParameters['moduleId'])));
592
+ urlPath = urlPath.replace('{courseId}', encodeURIComponent(String(requestParameters['courseId'])));
593
+
594
+ return {
595
+ path: urlPath,
596
+ method: 'GET',
597
+ headers: headerParameters,
598
+ query: queryParameters,
599
+ };
600
+ }
601
+
602
+ /**
603
+ * Lists content attempts and score rollup for the current learner. Instructors may pass user_id to inspect another learner.
604
+ * Get content attempts
605
+ */
606
+ async getContentAttemptsRaw(requestParameters: GetContentAttemptsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GetContentAttempts>> {
607
+ const requestOptions = await this.getContentAttemptsRequestOpts(requestParameters);
608
+ const response = await this.request(requestOptions, initOverrides);
609
+
610
+ return new runtime.JSONApiResponse(response, (jsonValue) => GetContentAttemptsFromJSON(jsonValue));
611
+ }
612
+
613
+ /**
614
+ * Lists content attempts and score rollup for the current learner. Instructors may pass user_id to inspect another learner.
615
+ * Get content attempts
616
+ */
617
+ async getContentAttempts(requestParameters: GetContentAttemptsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetContentAttempts> {
618
+ const response = await this.getContentAttemptsRaw(requestParameters, initOverrides);
619
+ return await response.value();
620
+ }
621
+
531
622
  /**
532
623
  * Creates request options for getContentList without sending the request
533
624
  */
@@ -1445,6 +1536,71 @@ export class ContentApi extends runtime.BaseAPI {
1445
1536
  return await response.value();
1446
1537
  }
1447
1538
 
1539
+ /**
1540
+ * Creates request options for postContentSessionRetake without sending the request
1541
+ */
1542
+ async postContentSessionRetakeRequestOpts(requestParameters: PostContentSessionRetakeRequest): Promise<runtime.RequestOpts> {
1543
+ if (requestParameters['contentId'] == null) {
1544
+ throw new runtime.RequiredError(
1545
+ 'contentId',
1546
+ 'Required parameter "contentId" was null or undefined when calling postContentSessionRetake().'
1547
+ );
1548
+ }
1549
+
1550
+ if (requestParameters['moduleId'] == null) {
1551
+ throw new runtime.RequiredError(
1552
+ 'moduleId',
1553
+ 'Required parameter "moduleId" was null or undefined when calling postContentSessionRetake().'
1554
+ );
1555
+ }
1556
+
1557
+ if (requestParameters['courseId'] == null) {
1558
+ throw new runtime.RequiredError(
1559
+ 'courseId',
1560
+ 'Required parameter "courseId" was null or undefined when calling postContentSessionRetake().'
1561
+ );
1562
+ }
1563
+
1564
+ const queryParameters: any = {};
1565
+
1566
+ if (requestParameters['environment'] != null) {
1567
+ queryParameters['environment'] = requestParameters['environment'];
1568
+ }
1569
+
1570
+ const headerParameters: runtime.HTTPHeaders = {};
1571
+
1572
+
1573
+ let urlPath = `/courses/{courseId}/modules/{moduleId}/contents/{contentId}/session/retake`;
1574
+ urlPath = urlPath.replace('{contentId}', encodeURIComponent(String(requestParameters['contentId'])));
1575
+ urlPath = urlPath.replace('{moduleId}', encodeURIComponent(String(requestParameters['moduleId'])));
1576
+ urlPath = urlPath.replace('{courseId}', encodeURIComponent(String(requestParameters['courseId'])));
1577
+
1578
+ return {
1579
+ path: urlPath,
1580
+ method: 'POST',
1581
+ headers: headerParameters,
1582
+ query: queryParameters,
1583
+ };
1584
+ }
1585
+
1586
+ /**
1587
+ * Create a new retake content session
1588
+ */
1589
+ async postContentSessionRetakeRaw(requestParameters: PostContentSessionRetakeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PostContentSession>> {
1590
+ const requestOptions = await this.postContentSessionRetakeRequestOpts(requestParameters);
1591
+ const response = await this.request(requestOptions, initOverrides);
1592
+
1593
+ return new runtime.JSONApiResponse(response, (jsonValue) => PostContentSessionFromJSON(jsonValue));
1594
+ }
1595
+
1596
+ /**
1597
+ * Create a new retake content session
1598
+ */
1599
+ async postContentSessionRetake(requestParameters: PostContentSessionRetakeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PostContentSession> {
1600
+ const response = await this.postContentSessionRetakeRaw(requestParameters, initOverrides);
1601
+ return await response.value();
1602
+ }
1603
+
1448
1604
  /**
1449
1605
  * Creates request options for postContentUpload without sending the request
1450
1606
  */
@@ -1946,6 +2102,14 @@ export class ContentApi extends runtime.BaseAPI {
1946
2102
 
1947
2103
  }
1948
2104
 
2105
+ /**
2106
+ * @export
2107
+ */
2108
+ export const GetContentAttemptsEnvironmentEnum = {
2109
+ Sandbox: 'sandbox',
2110
+ Live: 'live'
2111
+ } as const;
2112
+ export type GetContentAttemptsEnvironmentEnum = typeof GetContentAttemptsEnvironmentEnum[keyof typeof GetContentAttemptsEnvironmentEnum];
1949
2113
  /**
1950
2114
  * @export
1951
2115
  */
@@ -1962,3 +2126,11 @@ export const PostContentSessionEnvironmentEnum = {
1962
2126
  Live: 'live'
1963
2127
  } as const;
1964
2128
  export type PostContentSessionEnvironmentEnum = typeof PostContentSessionEnvironmentEnum[keyof typeof PostContentSessionEnvironmentEnum];
2129
+ /**
2130
+ * @export
2131
+ */
2132
+ export const PostContentSessionRetakeEnvironmentEnum = {
2133
+ Sandbox: 'sandbox',
2134
+ Live: 'live'
2135
+ } as const;
2136
+ export type PostContentSessionRetakeEnvironmentEnum = typeof PostContentSessionRetakeEnvironmentEnum[keyof typeof PostContentSessionRetakeEnvironmentEnum];
@@ -0,0 +1,128 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * LMS API
5
+ * LMS API
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ import type { ContentAttemptScore } from './ContentAttemptScore';
17
+ import {
18
+ ContentAttemptScoreFromJSON,
19
+ ContentAttemptScoreFromJSONTyped,
20
+ ContentAttemptScoreToJSON,
21
+ ContentAttemptScoreToJSONTyped,
22
+ } from './ContentAttemptScore';
23
+
24
+ /**
25
+ * A single learner attempt for a content item
26
+ * @export
27
+ * @interface ContentAttemptItem
28
+ */
29
+ export interface ContentAttemptItem {
30
+ /**
31
+ * Content session UUID for this attempt
32
+ * @type {string}
33
+ * @memberof ContentAttemptItem
34
+ */
35
+ sessionId: string;
36
+ /**
37
+ * Learner attempt number for this content item
38
+ * @type {number}
39
+ * @memberof ContentAttemptItem
40
+ */
41
+ attemptNumber: number;
42
+ /**
43
+ * Completion status for this attempt
44
+ * @type {string}
45
+ * @memberof ContentAttemptItem
46
+ */
47
+ completionStatus: string;
48
+ /**
49
+ * Grade status for this attempt
50
+ * @type {string}
51
+ * @memberof ContentAttemptItem
52
+ */
53
+ gradeStatus: string;
54
+ /**
55
+ *
56
+ * @type {ContentAttemptScore}
57
+ * @memberof ContentAttemptItem
58
+ */
59
+ score: ContentAttemptScore | null;
60
+ /**
61
+ * Attempt creation time as a Unix timestamp in seconds
62
+ * @type {number}
63
+ * @memberof ContentAttemptItem
64
+ */
65
+ createdAt: number;
66
+ /**
67
+ * Attempt update time as a Unix timestamp in seconds
68
+ * @type {number}
69
+ * @memberof ContentAttemptItem
70
+ */
71
+ updatedAt: number;
72
+ }
73
+
74
+ /**
75
+ * Check if a given object implements the ContentAttemptItem interface.
76
+ */
77
+ export function instanceOfContentAttemptItem(value: object): value is ContentAttemptItem {
78
+ if (!('sessionId' in value) || value['sessionId'] === undefined) return false;
79
+ if (!('attemptNumber' in value) || value['attemptNumber'] === undefined) return false;
80
+ if (!('completionStatus' in value) || value['completionStatus'] === undefined) return false;
81
+ if (!('gradeStatus' in value) || value['gradeStatus'] === undefined) return false;
82
+ if (!('score' in value) || value['score'] === undefined) return false;
83
+ if (!('createdAt' in value) || value['createdAt'] === undefined) return false;
84
+ if (!('updatedAt' in value) || value['updatedAt'] === undefined) return false;
85
+ return true;
86
+ }
87
+
88
+ export function ContentAttemptItemFromJSON(json: any): ContentAttemptItem {
89
+ return ContentAttemptItemFromJSONTyped(json, false);
90
+ }
91
+
92
+ export function ContentAttemptItemFromJSONTyped(json: any, ignoreDiscriminator: boolean): ContentAttemptItem {
93
+ if (json == null) {
94
+ return json;
95
+ }
96
+ return {
97
+
98
+ 'sessionId': json['session_id'],
99
+ 'attemptNumber': json['attempt_number'],
100
+ 'completionStatus': json['completion_status'],
101
+ 'gradeStatus': json['grade_status'],
102
+ 'score': ContentAttemptScoreFromJSON(json['score']),
103
+ 'createdAt': json['created_at'],
104
+ 'updatedAt': json['updated_at'],
105
+ };
106
+ }
107
+
108
+ export function ContentAttemptItemToJSON(json: any): ContentAttemptItem {
109
+ return ContentAttemptItemToJSONTyped(json, false);
110
+ }
111
+
112
+ export function ContentAttemptItemToJSONTyped(value?: ContentAttemptItem | null, ignoreDiscriminator: boolean = false): any {
113
+ if (value == null) {
114
+ return value;
115
+ }
116
+
117
+ return {
118
+
119
+ 'session_id': value['sessionId'],
120
+ 'attempt_number': value['attemptNumber'],
121
+ 'completion_status': value['completionStatus'],
122
+ 'grade_status': value['gradeStatus'],
123
+ 'score': ContentAttemptScoreToJSON(value['score']),
124
+ 'created_at': value['createdAt'],
125
+ 'updated_at': value['updatedAt'],
126
+ };
127
+ }
128
+
@@ -0,0 +1,75 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * LMS API
5
+ * LMS API
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ /**
17
+ * Rolled-up score for a content item
18
+ * @export
19
+ * @interface ContentAttemptRollupScore
20
+ */
21
+ export interface ContentAttemptRollupScore {
22
+ /**
23
+ * Rolled-up score normalized to a 0-100 percentage
24
+ * @type {number}
25
+ * @memberof ContentAttemptRollupScore
26
+ */
27
+ percentage: number;
28
+ /**
29
+ * Attempt number that supplied the rolled-up score
30
+ * @type {number}
31
+ * @memberof ContentAttemptRollupScore
32
+ */
33
+ sourceAttemptNumber: number;
34
+ }
35
+
36
+ /**
37
+ * Check if a given object implements the ContentAttemptRollupScore interface.
38
+ */
39
+ export function instanceOfContentAttemptRollupScore(value: object): value is ContentAttemptRollupScore {
40
+ if (!('percentage' in value) || value['percentage'] === undefined) return false;
41
+ if (!('sourceAttemptNumber' in value) || value['sourceAttemptNumber'] === undefined) return false;
42
+ return true;
43
+ }
44
+
45
+ export function ContentAttemptRollupScoreFromJSON(json: any): ContentAttemptRollupScore {
46
+ return ContentAttemptRollupScoreFromJSONTyped(json, false);
47
+ }
48
+
49
+ export function ContentAttemptRollupScoreFromJSONTyped(json: any, ignoreDiscriminator: boolean): ContentAttemptRollupScore {
50
+ if (json == null) {
51
+ return json;
52
+ }
53
+ return {
54
+
55
+ 'percentage': json['percentage'],
56
+ 'sourceAttemptNumber': json['source_attempt_number'],
57
+ };
58
+ }
59
+
60
+ export function ContentAttemptRollupScoreToJSON(json: any): ContentAttemptRollupScore {
61
+ return ContentAttemptRollupScoreToJSONTyped(json, false);
62
+ }
63
+
64
+ export function ContentAttemptRollupScoreToJSONTyped(value?: ContentAttemptRollupScore | null, ignoreDiscriminator: boolean = false): any {
65
+ if (value == null) {
66
+ return value;
67
+ }
68
+
69
+ return {
70
+
71
+ 'percentage': value['percentage'],
72
+ 'source_attempt_number': value['sourceAttemptNumber'],
73
+ };
74
+ }
75
+
@@ -0,0 +1,89 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * LMS API
5
+ * LMS API
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ /**
17
+ * Normalized score data for a content attempt
18
+ * @export
19
+ * @interface ContentAttemptScore
20
+ */
21
+ export interface ContentAttemptScore {
22
+ /**
23
+ * Raw score reported by the content, if available
24
+ * @type {number}
25
+ * @memberof ContentAttemptScore
26
+ */
27
+ raw?: number | null;
28
+ /**
29
+ * Minimum possible score, if available
30
+ * @type {number}
31
+ * @memberof ContentAttemptScore
32
+ */
33
+ min?: number | null;
34
+ /**
35
+ * Maximum possible score, if available
36
+ * @type {number}
37
+ * @memberof ContentAttemptScore
38
+ */
39
+ max?: number | null;
40
+ /**
41
+ * Score normalized to a 0-100 percentage, if available
42
+ * @type {number}
43
+ * @memberof ContentAttemptScore
44
+ */
45
+ percentage?: number | null;
46
+ }
47
+
48
+ /**
49
+ * Check if a given object implements the ContentAttemptScore interface.
50
+ */
51
+ export function instanceOfContentAttemptScore(value: object): value is ContentAttemptScore {
52
+ return true;
53
+ }
54
+
55
+ export function ContentAttemptScoreFromJSON(json: any): ContentAttemptScore {
56
+ return ContentAttemptScoreFromJSONTyped(json, false);
57
+ }
58
+
59
+ export function ContentAttemptScoreFromJSONTyped(json: any, ignoreDiscriminator: boolean): ContentAttemptScore {
60
+ if (json == null) {
61
+ return json;
62
+ }
63
+ return {
64
+
65
+ 'raw': json['raw'] == null ? undefined : json['raw'],
66
+ 'min': json['min'] == null ? undefined : json['min'],
67
+ 'max': json['max'] == null ? undefined : json['max'],
68
+ 'percentage': json['percentage'] == null ? undefined : json['percentage'],
69
+ };
70
+ }
71
+
72
+ export function ContentAttemptScoreToJSON(json: any): ContentAttemptScore {
73
+ return ContentAttemptScoreToJSONTyped(json, false);
74
+ }
75
+
76
+ export function ContentAttemptScoreToJSONTyped(value?: ContentAttemptScore | null, ignoreDiscriminator: boolean = false): any {
77
+ if (value == null) {
78
+ return value;
79
+ }
80
+
81
+ return {
82
+
83
+ 'raw': value['raw'],
84
+ 'min': value['min'],
85
+ 'max': value['max'],
86
+ 'percentage': value['percentage'],
87
+ };
88
+ }
89
+
@@ -0,0 +1,164 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * LMS API
5
+ * LMS API
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ import type { ContentAttemptRollupScore } from './ContentAttemptRollupScore';
17
+ import {
18
+ ContentAttemptRollupScoreFromJSON,
19
+ ContentAttemptRollupScoreFromJSONTyped,
20
+ ContentAttemptRollupScoreToJSON,
21
+ ContentAttemptRollupScoreToJSONTyped,
22
+ } from './ContentAttemptRollupScore';
23
+ import type { ContentAttemptItem } from './ContentAttemptItem';
24
+ import {
25
+ ContentAttemptItemFromJSON,
26
+ ContentAttemptItemFromJSONTyped,
27
+ ContentAttemptItemToJSON,
28
+ ContentAttemptItemToJSONTyped,
29
+ } from './ContentAttemptItem';
30
+
31
+ /**
32
+ * Learner attempt history and rollup for a content item
33
+ * @export
34
+ * @interface GetContentAttempts
35
+ */
36
+ export interface GetContentAttempts {
37
+ /**
38
+ * Content external ID
39
+ * @type {string}
40
+ * @memberof GetContentAttempts
41
+ */
42
+ contentId: string;
43
+ /**
44
+ * User ID these attempts belong to
45
+ * @type {string}
46
+ * @memberof GetContentAttempts
47
+ */
48
+ userId: string;
49
+ /**
50
+ * Maximum content sessions allowed for this learner/content pair
51
+ * @type {number}
52
+ * @memberof GetContentAttempts
53
+ */
54
+ maxAttempts: number;
55
+ /**
56
+ * Number of attempts already created
57
+ * @type {number}
58
+ * @memberof GetContentAttempts
59
+ */
60
+ attemptsUsed: number;
61
+ /**
62
+ * Number of additional attempts that can be created
63
+ * @type {number}
64
+ * @memberof GetContentAttempts
65
+ */
66
+ attemptsRemaining: number;
67
+ /**
68
+ * Whether another attempt may be started under the current policy
69
+ * @type {boolean}
70
+ * @memberof GetContentAttempts
71
+ */
72
+ canStartNewAttempt: boolean;
73
+ /**
74
+ * Strategy used to compute rollup_score from attempts
75
+ * @type {GetContentAttemptsScoreRollupStrategyEnum}
76
+ * @memberof GetContentAttempts
77
+ */
78
+ scoreRollupStrategy: GetContentAttemptsScoreRollupStrategyEnum;
79
+ /**
80
+ *
81
+ * @type {ContentAttemptRollupScore}
82
+ * @memberof GetContentAttempts
83
+ */
84
+ rollupScore: ContentAttemptRollupScore | null;
85
+ /**
86
+ *
87
+ * @type {Array<ContentAttemptItem>}
88
+ * @memberof GetContentAttempts
89
+ */
90
+ attempts: Array<ContentAttemptItem>;
91
+ }
92
+
93
+
94
+ /**
95
+ * @export
96
+ */
97
+ export const GetContentAttemptsScoreRollupStrategyEnum = {
98
+ Latest: 'Latest',
99
+ Best: 'Best'
100
+ } as const;
101
+ export type GetContentAttemptsScoreRollupStrategyEnum = typeof GetContentAttemptsScoreRollupStrategyEnum[keyof typeof GetContentAttemptsScoreRollupStrategyEnum];
102
+
103
+
104
+ /**
105
+ * Check if a given object implements the GetContentAttempts interface.
106
+ */
107
+ export function instanceOfGetContentAttempts(value: object): value is GetContentAttempts {
108
+ if (!('contentId' in value) || value['contentId'] === undefined) return false;
109
+ if (!('userId' in value) || value['userId'] === undefined) return false;
110
+ if (!('maxAttempts' in value) || value['maxAttempts'] === undefined) return false;
111
+ if (!('attemptsUsed' in value) || value['attemptsUsed'] === undefined) return false;
112
+ if (!('attemptsRemaining' in value) || value['attemptsRemaining'] === undefined) return false;
113
+ if (!('canStartNewAttempt' in value) || value['canStartNewAttempt'] === undefined) return false;
114
+ if (!('scoreRollupStrategy' in value) || value['scoreRollupStrategy'] === undefined) return false;
115
+ if (!('rollupScore' in value) || value['rollupScore'] === undefined) return false;
116
+ if (!('attempts' in value) || value['attempts'] === undefined) return false;
117
+ return true;
118
+ }
119
+
120
+ export function GetContentAttemptsFromJSON(json: any): GetContentAttempts {
121
+ return GetContentAttemptsFromJSONTyped(json, false);
122
+ }
123
+
124
+ export function GetContentAttemptsFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetContentAttempts {
125
+ if (json == null) {
126
+ return json;
127
+ }
128
+ return {
129
+
130
+ 'contentId': json['content_id'],
131
+ 'userId': json['user_id'],
132
+ 'maxAttempts': json['max_attempts'],
133
+ 'attemptsUsed': json['attempts_used'],
134
+ 'attemptsRemaining': json['attempts_remaining'],
135
+ 'canStartNewAttempt': json['can_start_new_attempt'],
136
+ 'scoreRollupStrategy': json['score_rollup_strategy'],
137
+ 'rollupScore': ContentAttemptRollupScoreFromJSON(json['rollup_score']),
138
+ 'attempts': ((json['attempts'] as Array<any>).map(ContentAttemptItemFromJSON)),
139
+ };
140
+ }
141
+
142
+ export function GetContentAttemptsToJSON(json: any): GetContentAttempts {
143
+ return GetContentAttemptsToJSONTyped(json, false);
144
+ }
145
+
146
+ export function GetContentAttemptsToJSONTyped(value?: GetContentAttempts | null, ignoreDiscriminator: boolean = false): any {
147
+ if (value == null) {
148
+ return value;
149
+ }
150
+
151
+ return {
152
+
153
+ 'content_id': value['contentId'],
154
+ 'user_id': value['userId'],
155
+ 'max_attempts': value['maxAttempts'],
156
+ 'attempts_used': value['attemptsUsed'],
157
+ 'attempts_remaining': value['attemptsRemaining'],
158
+ 'can_start_new_attempt': value['canStartNewAttempt'],
159
+ 'score_rollup_strategy': value['scoreRollupStrategy'],
160
+ 'rollup_score': ContentAttemptRollupScoreToJSON(value['rollupScore']),
161
+ 'attempts': ((value['attempts'] as Array<any>).map(ContentAttemptItemToJSON)),
162
+ };
163
+ }
164
+