@timeback/oneroster 0.1.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 (85) hide show
  1. package/README.md +295 -0
  2. package/dist/client.d.ts +125 -0
  3. package/dist/client.d.ts.map +1 -0
  4. package/dist/constants.d.ts +23 -0
  5. package/dist/constants.d.ts.map +1 -0
  6. package/dist/errors.d.ts +7 -0
  7. package/dist/errors.d.ts.map +1 -0
  8. package/dist/errors.js +1414 -0
  9. package/dist/factory.d.ts +100 -0
  10. package/dist/factory.d.ts.map +1 -0
  11. package/dist/index.d.ts +42 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +2614 -0
  14. package/dist/lib/index.d.ts +11 -0
  15. package/dist/lib/index.d.ts.map +1 -0
  16. package/dist/lib/pagination.d.ts +30 -0
  17. package/dist/lib/pagination.d.ts.map +1 -0
  18. package/dist/lib/resolve.d.ts +21 -0
  19. package/dist/lib/resolve.d.ts.map +1 -0
  20. package/dist/lib/transport.d.ts +32 -0
  21. package/dist/lib/transport.d.ts.map +1 -0
  22. package/dist/resources/assessment/index.d.ts +6 -0
  23. package/dist/resources/assessment/index.d.ts.map +1 -0
  24. package/dist/resources/assessment/line-items.d.ts +38 -0
  25. package/dist/resources/assessment/line-items.d.ts.map +1 -0
  26. package/dist/resources/assessment/results.d.ts +25 -0
  27. package/dist/resources/assessment/results.d.ts.map +1 -0
  28. package/dist/resources/base.d.ts +181 -0
  29. package/dist/resources/base.d.ts.map +1 -0
  30. package/dist/resources/gradebook/categories.d.ts +16 -0
  31. package/dist/resources/gradebook/categories.d.ts.map +1 -0
  32. package/dist/resources/gradebook/index.d.ts +8 -0
  33. package/dist/resources/gradebook/index.d.ts.map +1 -0
  34. package/dist/resources/gradebook/line-items.d.ts +52 -0
  35. package/dist/resources/gradebook/line-items.d.ts.map +1 -0
  36. package/dist/resources/gradebook/results.d.ts +24 -0
  37. package/dist/resources/gradebook/results.d.ts.map +1 -0
  38. package/dist/resources/gradebook/score-scales.d.ts +16 -0
  39. package/dist/resources/gradebook/score-scales.d.ts.map +1 -0
  40. package/dist/resources/index.d.ts +11 -0
  41. package/dist/resources/index.d.ts.map +1 -0
  42. package/dist/resources/resources/index.d.ts +5 -0
  43. package/dist/resources/resources/index.d.ts.map +1 -0
  44. package/dist/resources/resources/resources.d.ts +39 -0
  45. package/dist/resources/resources/resources.d.ts.map +1 -0
  46. package/dist/resources/rostering/academic-sessions.d.ts +97 -0
  47. package/dist/resources/rostering/academic-sessions.d.ts.map +1 -0
  48. package/dist/resources/rostering/classes.d.ts +276 -0
  49. package/dist/resources/rostering/classes.d.ts.map +1 -0
  50. package/dist/resources/rostering/courses.d.ts +75 -0
  51. package/dist/resources/rostering/courses.d.ts.map +1 -0
  52. package/dist/resources/rostering/demographics.d.ts +18 -0
  53. package/dist/resources/rostering/demographics.d.ts.map +1 -0
  54. package/dist/resources/rostering/enrollments.d.ts +28 -0
  55. package/dist/resources/rostering/enrollments.d.ts.map +1 -0
  56. package/dist/resources/rostering/index.d.ts +12 -0
  57. package/dist/resources/rostering/index.d.ts.map +1 -0
  58. package/dist/resources/rostering/orgs.d.ts +18 -0
  59. package/dist/resources/rostering/orgs.d.ts.map +1 -0
  60. package/dist/resources/rostering/schools.d.ts +214 -0
  61. package/dist/resources/rostering/schools.d.ts.map +1 -0
  62. package/dist/resources/rostering/users.d.ts +191 -0
  63. package/dist/resources/rostering/users.d.ts.map +1 -0
  64. package/dist/types/base.d.ts +127 -0
  65. package/dist/types/base.d.ts.map +1 -0
  66. package/dist/types/callable.d.ts +246 -0
  67. package/dist/types/callable.d.ts.map +1 -0
  68. package/dist/types/client.d.ts +58 -0
  69. package/dist/types/client.d.ts.map +1 -0
  70. package/dist/types/filters.d.ts +165 -0
  71. package/dist/types/filters.d.ts.map +1 -0
  72. package/dist/types/gradebook.d.ts +262 -0
  73. package/dist/types/gradebook.d.ts.map +1 -0
  74. package/dist/types/index.d.ts +13 -0
  75. package/dist/types/index.d.ts.map +1 -0
  76. package/dist/types/resources.d.ts +191 -0
  77. package/dist/types/resources.d.ts.map +1 -0
  78. package/dist/types/rostering.d.ts +732 -0
  79. package/dist/types/rostering.d.ts.map +1 -0
  80. package/dist/types.d.ts +10 -0
  81. package/dist/types.d.ts.map +1 -0
  82. package/dist/types.js +0 -0
  83. package/dist/utils.d.ts +51 -0
  84. package/dist/utils.d.ts.map +1 -0
  85. package/package.json +41 -0
@@ -0,0 +1,214 @@
1
+ /**
2
+ * Schools Resource
3
+ *
4
+ * Schools are a filtered view of organizations with nested resources.
5
+ */
6
+ import { Paginator } from '../../lib';
7
+ import type { ListParams } from '../../lib';
8
+ import type { AcademicSession, AcademicSessionFilterFields, Class, ClassFilterFields, Course, CourseFilterFields, CreateResponse, Enrollment, EnrollmentFilterFields, LineItem, LineItemCreateInput, LineItemFilterFields, OneRosterTransportLike, Organization, SchoolsCallable, ScoreScale, ScoreScaleFilterFields, User, UserFilterFields } from '../../types';
9
+ /**
10
+ * Scoped resource for a specific class within a school.
11
+ *
12
+ * Access via `client.schools(schoolId).class(classId)`.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const enrollments = await client.schools(schoolId).class(classId).enrollments()
17
+ * ```
18
+ */
19
+ export declare class ScopedSchoolClassResource {
20
+ private readonly transport;
21
+ private readonly basePath;
22
+ constructor(transport: OneRosterTransportLike, schoolId: string, classId: string);
23
+ /**
24
+ * List enrollments for this class within this school.
25
+ * @param params - Optional filter and pagination parameters
26
+ * @returns Promise resolving to enrollment array
27
+ */
28
+ enrollments(params?: ListParams<EnrollmentFilterFields>): Promise<Enrollment[]>;
29
+ /**
30
+ * Stream enrollments with lazy pagination.
31
+ * @param params - Optional filter and pagination parameters
32
+ * @returns Paginator for streaming enrollments
33
+ */
34
+ streamEnrollments(params?: ListParams<EnrollmentFilterFields>): Paginator<Enrollment, EnrollmentFilterFields>;
35
+ /**
36
+ * List students in this class at this school.
37
+ * @param params - Optional filter and pagination parameters
38
+ * @returns Promise resolving to user array
39
+ */
40
+ students(params?: ListParams<UserFilterFields>): Promise<User[]>;
41
+ /**
42
+ * Stream students with lazy pagination.
43
+ * @param params - Optional filter and pagination parameters
44
+ * @returns Paginator for streaming students
45
+ */
46
+ streamStudents(params?: ListParams<UserFilterFields>): Paginator<User, UserFilterFields>;
47
+ /**
48
+ * List teachers for this class at this school.
49
+ * @param params - Optional filter and pagination parameters
50
+ * @returns Promise resolving to user array
51
+ */
52
+ teachers(params?: ListParams<UserFilterFields>): Promise<User[]>;
53
+ /**
54
+ * Stream teachers with lazy pagination.
55
+ * @param params - Optional filter and pagination parameters
56
+ * @returns Paginator for streaming teachers
57
+ */
58
+ streamTeachers(params?: ListParams<UserFilterFields>): Paginator<User, UserFilterFields>;
59
+ }
60
+ /**
61
+ * Scoped resource for operations on a specific school.
62
+ *
63
+ * Access via `client.schools(schoolId)`.
64
+ *
65
+ * @example
66
+ * ```typescript
67
+ * const school = await client.schools(schoolId).get()
68
+ * const classes = await client.schools(schoolId).classes()
69
+ * const students = await client.schools(schoolId).students()
70
+ * const teachers = await client.schools(schoolId).teachers()
71
+ * const lineItems = await client.schools(schoolId).lineItems()
72
+ * const enrollments = await client.schools(schoolId).class(classId).enrollments()
73
+ * ```
74
+ */
75
+ export declare class ScopedSchoolResource {
76
+ private readonly transport;
77
+ private readonly basePath;
78
+ private readonly gradebookPath;
79
+ private readonly schoolId;
80
+ constructor(transport: OneRosterTransportLike, schoolId: string);
81
+ /**
82
+ * Get the school details.
83
+ * @returns The organization/school object
84
+ */
85
+ get(): Promise<Organization>;
86
+ /**
87
+ * Scope to a specific class within this school.
88
+ * @param classId - The class sourcedId
89
+ * @returns Scoped class resource for school-class operations
90
+ */
91
+ class(classId: string): ScopedSchoolClassResource;
92
+ /**
93
+ * List classes in this school.
94
+ * @param params - Optional filter and pagination parameters
95
+ * @returns Promise resolving to class array
96
+ */
97
+ classes(params?: ListParams<ClassFilterFields>): Promise<Class[]>;
98
+ /**
99
+ * Stream classes with lazy pagination.
100
+ * @param params - Optional filter and pagination parameters
101
+ * @returns Paginator for streaming classes
102
+ */
103
+ streamClasses(params?: ListParams<ClassFilterFields>): Paginator<Class, ClassFilterFields>;
104
+ /**
105
+ * List enrollments in this school.
106
+ * @param params - Optional filter and pagination parameters
107
+ * @returns Promise resolving to enrollment array
108
+ */
109
+ enrollments(params?: ListParams<EnrollmentFilterFields>): Promise<Enrollment[]>;
110
+ /**
111
+ * Stream enrollments with lazy pagination.
112
+ * @param params - Optional filter and pagination parameters
113
+ * @returns Paginator for streaming enrollments
114
+ */
115
+ streamEnrollments(params?: ListParams<EnrollmentFilterFields>): Paginator<Enrollment, EnrollmentFilterFields>;
116
+ /**
117
+ * List students in this school.
118
+ * @param params - Optional filter and pagination parameters
119
+ * @returns Promise resolving to user array
120
+ */
121
+ students(params?: ListParams<UserFilterFields>): Promise<User[]>;
122
+ /**
123
+ * Stream students with lazy pagination.
124
+ * @param params - Optional filter and pagination parameters
125
+ * @returns Paginator for streaming students
126
+ */
127
+ streamStudents(params?: ListParams<UserFilterFields>): Paginator<User, UserFilterFields>;
128
+ /**
129
+ * List teachers in this school.
130
+ * @param params - Optional filter and pagination parameters
131
+ * @returns Promise resolving to user array
132
+ */
133
+ teachers(params?: ListParams<UserFilterFields>): Promise<User[]>;
134
+ /**
135
+ * Stream teachers with lazy pagination.
136
+ * @param params - Optional filter and pagination parameters
137
+ * @returns Paginator for streaming teachers
138
+ */
139
+ streamTeachers(params?: ListParams<UserFilterFields>): Paginator<User, UserFilterFields>;
140
+ /**
141
+ * List courses in this school.
142
+ * @param params - Optional filter and pagination parameters
143
+ * @returns Promise resolving to course array
144
+ */
145
+ courses(params?: ListParams<CourseFilterFields>): Promise<Course[]>;
146
+ /**
147
+ * Stream courses with lazy pagination.
148
+ * @param params - Optional filter and pagination parameters
149
+ * @returns Paginator for streaming courses
150
+ */
151
+ streamCourses(params?: ListParams<CourseFilterFields>): Paginator<Course, CourseFilterFields>;
152
+ /**
153
+ * List terms/academic sessions for this school.
154
+ * @param params - Optional filter and pagination parameters
155
+ * @returns Promise resolving to academic session array
156
+ */
157
+ terms(params?: ListParams<AcademicSessionFilterFields>): Promise<AcademicSession[]>;
158
+ /**
159
+ * Stream terms with lazy pagination.
160
+ * @param params - Optional filter and pagination parameters
161
+ * @returns Paginator for streaming academic sessions
162
+ */
163
+ streamTerms(params?: ListParams<AcademicSessionFilterFields>): Paginator<AcademicSession, AcademicSessionFilterFields>;
164
+ /**
165
+ * List line items (assignments) in this school.
166
+ * @param params - Optional filter and pagination parameters
167
+ * @returns Promise resolving to line item array
168
+ */
169
+ lineItems(params?: ListParams<LineItemFilterFields>): Promise<LineItem[]>;
170
+ /**
171
+ * Stream line items with lazy pagination.
172
+ * @param params - Optional filter and pagination parameters
173
+ * @returns Paginator for streaming line items
174
+ */
175
+ streamLineItems(params?: ListParams<LineItemFilterFields>): Paginator<LineItem, LineItemFilterFields>;
176
+ /**
177
+ * Create a line item (assignment) in this school.
178
+ *
179
+ * @param data - Line item data
180
+ * @returns Create response with sourcedIdPairs
181
+ * @example
182
+ * ```typescript
183
+ * await client.schools(schoolId).createLineItem({
184
+ * title: 'Homework 1',
185
+ * class: { sourcedId: classId },
186
+ * school: { sourcedId: schoolId },
187
+ * category: { sourcedId: categoryId },
188
+ * assignDate: '2024-12-20',
189
+ * dueDate: '2024-12-27',
190
+ * status: 'active',
191
+ * })
192
+ * ```
193
+ */
194
+ createLineItem(data: LineItemCreateInput): Promise<CreateResponse>;
195
+ /**
196
+ * List score scales for this school.
197
+ * @param params - Optional filter and pagination parameters
198
+ * @returns Promise resolving to score scale array
199
+ */
200
+ scoreScales(params?: ListParams<ScoreScaleFilterFields>): Promise<ScoreScale[]>;
201
+ /**
202
+ * Stream score scales with lazy pagination.
203
+ * @param params - Optional filter and pagination parameters
204
+ * @returns Paginator for streaming score scales
205
+ */
206
+ streamScoreScales(params?: ListParams<ScoreScaleFilterFields>): Paginator<ScoreScale, ScoreScaleFilterFields>;
207
+ }
208
+ /**
209
+ * Create a callable schools resource.
210
+ * @param transport - OneRoster transport instance
211
+ * @returns Callable resource for schools
212
+ */
213
+ export declare function createSchoolsResource(transport: OneRosterTransportLike): SchoolsCallable;
214
+ //# sourceMappingURL=schools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schools.d.ts","sourceRoot":"","sources":["../../../src/resources/rostering/schools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAIrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,KAAK,EACX,eAAe,EACf,2BAA2B,EAC3B,KAAK,EACL,iBAAiB,EACjB,MAAM,EACN,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,sBAAsB,EACtB,QAAQ,EACR,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,YAAY,EAGZ,eAAe,EACf,UAAU,EACV,sBAAsB,EACtB,IAAI,EACJ,gBAAgB,EAChB,MAAM,aAAa,CAAA;AAMpB;;;;;;;;;GASG;AACH,qBAAa,yBAAyB;IAIpC,OAAO,CAAC,QAAQ,CAAC,SAAS;IAH3B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IAEjC,YACkB,SAAS,EAAE,sBAAsB,EAClD,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EAGf;IAED;;;;OAIG;IACH,WAAW,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,sBAAsB,CAAC,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAE9E;IAED;;;;OAIG;IACH,iBAAiB,CAChB,MAAM,CAAC,EAAE,UAAU,CAAC,sBAAsB,CAAC,GACzC,SAAS,CAAC,UAAU,EAAE,sBAAsB,CAAC,CAO/C;IAED;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,IAAI,EAAE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E,UAAU,CAAC,oBAAoB,CAAC,GACvC,SAAS,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAO3C;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,cAAc,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,CAAC,CAKjE;IAED;;;;OAIG;IACH,WAAW,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,sBAAsB,CAAC,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAE9E;IAED;;;;OAIG;IACH,iBAAiB,CAChB,MAAM,CAAC,EAAE,UAAU,CAAC,sBAAsB,CAAC,GACzC,SAAS,CAAC,UAAU,EAAE,sBAAsB,CAAC,CAO/C;CACD;AA6BD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,sBAAsB,GAAG,eAAe,CAaxF"}
@@ -0,0 +1,191 @@
1
+ /**
2
+ * Users Resource
3
+ *
4
+ * Access all users regardless of role.
5
+ */
6
+ import { Paginator } from '../../lib';
7
+ import type { ListParams } from '@timeback/internal-client-infra';
8
+ import type { AgentInput, Class, ClassFilterFields, CredentialCreateResponse, DecryptedCredential, OneRosterTransportLike, Resource, ResourceFilterFields, StudentsCallable, TeachersCallable, User, UserProfileCredential, UsersCallable } from '../../types';
9
+ /**
10
+ * Scoped resource for operations on a specific user.
11
+ *
12
+ * Access via `client.users(userId)`.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const user = await client.users(userId).get()
17
+ * const resources = await client.users(userId).resources()
18
+ * ```
19
+ */
20
+ export declare class ScopedUserResource {
21
+ private readonly transport;
22
+ private readonly basePath;
23
+ private readonly userId;
24
+ constructor(transport: OneRosterTransportLike, userId: string);
25
+ /**
26
+ * Get the user details.
27
+ * @returns The user object
28
+ */
29
+ get(): Promise<User>;
30
+ /**
31
+ * Get the user with their demographic information.
32
+ *
33
+ * Returns the user object with the `demographics` field populated.
34
+ *
35
+ * @returns The user object with demographics
36
+ */
37
+ demographics(): Promise<User>;
38
+ /**
39
+ * List resources for this user.
40
+ * @param params - Optional filter and pagination parameters
41
+ * @returns Promise resolving to resource array
42
+ */
43
+ resources(params?: ListParams<ResourceFilterFields>): Promise<Resource[]>;
44
+ /**
45
+ * Stream resources with lazy pagination.
46
+ * @param params - Optional filter and pagination parameters
47
+ * @returns Paginator for streaming resources
48
+ */
49
+ streamResources(params?: ListParams<ResourceFilterFields>): Paginator<Resource, ResourceFilterFields>;
50
+ /**
51
+ * List classes for this user.
52
+ * @param params - Optional filter and pagination parameters
53
+ * @returns Promise resolving to class array
54
+ */
55
+ classes(params?: ListParams<ClassFilterFields>): Promise<Class[]>;
56
+ /**
57
+ * Stream classes with lazy pagination.
58
+ * @param params - Optional filter and pagination parameters
59
+ * @returns Paginator for streaming classes
60
+ */
61
+ streamClasses(params?: ListParams<ClassFilterFields>): Paginator<Class, ClassFilterFields>;
62
+ /**
63
+ * Get users that this user is an agent (guardian/parent) for.
64
+ *
65
+ * For example, if this user is a parent, returns their children.
66
+ *
67
+ * @returns Array of users this user represents
68
+ */
69
+ agentFor(): Promise<User[]>;
70
+ /**
71
+ * Get agents (guardians/parents) for this user.
72
+ *
73
+ * For example, if this user is a student, returns their parents/guardians.
74
+ *
75
+ * @returns Array of agent users
76
+ */
77
+ agents(): Promise<User[]>;
78
+ /**
79
+ * Add an agent (guardian/parent) relationship for this user.
80
+ *
81
+ * @param data - Agent input with the agent user reference
82
+ * @returns Promise resolving when complete
83
+ */
84
+ addAgent(data: AgentInput): Promise<void>;
85
+ /**
86
+ * Remove an agent (guardian/parent) relationship from this user.
87
+ *
88
+ * @param agentSourcedId - The sourcedId of the agent to remove
89
+ * @returns Promise resolving when complete
90
+ */
91
+ removeAgent(agentSourcedId: string): Promise<void>;
92
+ /**
93
+ * Create credentials for this user.
94
+ *
95
+ * @param credential - Credential data to create
96
+ * @returns Response with userProfileId, credentialId, and message
97
+ */
98
+ createCredential(credential: Partial<UserProfileCredential>): Promise<CredentialCreateResponse>;
99
+ /**
100
+ * Decrypt a user's credential to retrieve the password.
101
+ *
102
+ * @param credentialId - The credential ID to decrypt
103
+ * @returns Decrypted credential with password
104
+ */
105
+ decryptCredential(credentialId: string): Promise<DecryptedCredential>;
106
+ }
107
+ /**
108
+ * Create a callable users resource.
109
+ * @param transport - OneRoster transport instance
110
+ * @returns Callable resource for users
111
+ */
112
+ export declare function createUsersResource(transport: OneRosterTransportLike): UsersCallable;
113
+ /**
114
+ * Scoped resource for operations on a specific student.
115
+ *
116
+ * Access via `client.students(studentId)`.
117
+ *
118
+ * @example
119
+ * ```typescript
120
+ * const student = await client.students(studentId).get()
121
+ * const classes = await client.students(studentId).classes()
122
+ * ```
123
+ */
124
+ export declare class ScopedStudentResource {
125
+ private readonly transport;
126
+ private readonly basePath;
127
+ constructor(transport: OneRosterTransportLike, studentId: string);
128
+ /**
129
+ * Get the student details.
130
+ * @returns The user object
131
+ */
132
+ get(): Promise<User>;
133
+ /**
134
+ * List classes this student is enrolled in.
135
+ * @param params - Optional filter and pagination parameters
136
+ * @returns Promise resolving to class array
137
+ */
138
+ classes(params?: ListParams<ClassFilterFields>): Promise<Class[]>;
139
+ /**
140
+ * Stream classes with lazy pagination.
141
+ * @param params - Optional filter and pagination parameters
142
+ * @returns Paginator for streaming classes
143
+ */
144
+ streamClasses(params?: ListParams<ClassFilterFields>): Paginator<Class, ClassFilterFields>;
145
+ }
146
+ /**
147
+ * Scoped resource for operations on a specific teacher.
148
+ *
149
+ * Access via `client.teachers(teacherId)`.
150
+ *
151
+ * @example
152
+ * ```typescript
153
+ * const teacher = await client.teachers(teacherId).get()
154
+ * const classes = await client.teachers(teacherId).classes()
155
+ * ```
156
+ */
157
+ export declare class ScopedTeacherResource {
158
+ private readonly transport;
159
+ private readonly basePath;
160
+ constructor(transport: OneRosterTransportLike, teacherId: string);
161
+ /**
162
+ * Get the teacher details.
163
+ * @returns The user object
164
+ */
165
+ get(): Promise<User>;
166
+ /**
167
+ * List classes this teacher is assigned to.
168
+ * @param params - Optional filter and pagination parameters
169
+ * @returns Promise resolving to class array
170
+ */
171
+ classes(params?: ListParams<ClassFilterFields>): Promise<Class[]>;
172
+ /**
173
+ * Stream classes with lazy pagination.
174
+ * @param params - Optional filter and pagination parameters
175
+ * @returns Paginator for streaming classes
176
+ */
177
+ streamClasses(params?: ListParams<ClassFilterFields>): Paginator<Class, ClassFilterFields>;
178
+ }
179
+ /**
180
+ * Create a callable students resource.
181
+ * @param transport - OneRoster transport instance
182
+ * @returns Callable resource for students
183
+ */
184
+ export declare function createStudentsResource(transport: OneRosterTransportLike): StudentsCallable;
185
+ /**
186
+ * Create a callable teachers resource.
187
+ * @param transport - OneRoster transport instance
188
+ * @returns Callable resource for teachers
189
+ */
190
+ export declare function createTeachersResource(transport: OneRosterTransportLike): TeachersCallable;
191
+ //# sourceMappingURL=users.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../../src/resources/rostering/users.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAIrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AACjE,OAAO,KAAK,EACX,UAAU,EACV,KAAK,EACL,iBAAiB,EACjB,wBAAwB,EACxB,mBAAmB,EACnB,sBAAsB,EACtB,QAAQ,EACR,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,IAAI,EAGJ,qBAAqB,EACrB,aAAa,EACb,MAAM,aAAa,CAAA;AAMpB;;;;;;;;;;GAUG;AACH,qBAAa,kBAAkB;IAK7B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAJ3B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;IAE/B,YACkB,SAAS,EAAE,sBAAsB,EAClD,MAAM,EAAE,MAAM,EAId;IAED;;;OAGG;IACG,GAAG,IAAI,OAAO,CAAC,IAAI,CA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ject, TimebackGrade, etc.) come from `@timeback/types`.
6
+ */
7
+ export type { IMSErrorResponse, LessonType, OneRosterUserRole, OrganizationType, ScoreStatus, TimebackGrade, TimebackSubject, } from '@timeback/types';
8
+ /**
9
+ * Base interface for all OneRoster entities.
10
+ *
11
+ * All OneRoster resources share these common fields for identification,
12
+ * status tracking, and extensibility.
13
+ */
14
+ export interface Base {
15
+ /**
16
+ * Globally unique identifier for the entity.
17
+ * Typically a UUID assigned by the source system.
18
+ */
19
+ sourcedId?: string;
20
+ /**
21
+ * The status of the entity.
22
+ * - `active`: Entity is current and valid
23
+ * - `tobedeleted`: Entity is marked for deletion
24
+ */
25
+ status?: 'active' | 'tobedeleted';
26
+ /**
27
+ * ISO 8601 timestamp of the last modification.
28
+ * @example "2024-01-15T10:30:00Z"
29
+ */
30
+ dateLastModified?: string;
31
+ /**
32
+ * Extensible metadata object for custom properties.
33
+ * Used for vendor-specific extensions.
34
+ */
35
+ metadata?: Record<string, unknown> | null;
36
+ }
37
+ /**
38
+ * A score for a specific learning objective.
39
+ */
40
+ export interface LearningObjectiveResult {
41
+ /** Identifier of the learning objective */
42
+ learningObjectiveId: string;
43
+ /** Numeric score */
44
+ score?: number;
45
+ /** Text-based score (e.g., "Proficient") */
46
+ textScore?: string;
47
+ }
48
+ /**
49
+ * A set of learning objectives with optional results.
50
+ */
51
+ export interface LearningObjectiveSetItem {
52
+ /** Source system for these learning objectives */
53
+ source: string;
54
+ /** Learning objective IDs (for line items) */
55
+ learningObjectiveIds?: string[];
56
+ /** Learning objective results (for results) */
57
+ learningObjectiveResults?: LearningObjectiveResult[];
58
+ }
59
+ /**
60
+ * Array of learning objective sets, or null if not applicable.
61
+ */
62
+ export type LearningObjectiveSet = LearningObjectiveSetItem[] | null;
63
+ /**
64
+ * A reference to another OneRoster entity by sourcedId.
65
+ */
66
+ export interface Ref {
67
+ /** The sourcedId of the referenced entity */
68
+ sourcedId: string;
69
+ }
70
+ /**
71
+ * A reference with an optional type discriminator.
72
+ */
73
+ export interface RefWithType extends Ref {
74
+ /** The type of the referenced entity (e.g., "user", "class") */
75
+ type?: string;
76
+ }
77
+ /**
78
+ * A fully-qualified reference with href and type.
79
+ * Commonly returned in API responses for navigable links.
80
+ */
81
+ export interface RefWithHref extends Ref {
82
+ /** The URL to fetch the referenced entity */
83
+ href: string;
84
+ /** The type of the referenced entity */
85
+ type: string;
86
+ }
87
+ /**
88
+ * Response returned when creating a new entity.
89
+ * Contains the mapping between supplied and allocated IDs.
90
+ */
91
+ export interface CreateResponse {
92
+ sourcedIdPairs: {
93
+ /** The sourcedId provided in the create request */
94
+ suppliedSourcedId: string;
95
+ /** The sourcedId allocated by the server (may differ) */
96
+ allocatedSourcedId: string;
97
+ };
98
+ }
99
+ /**
100
+ * Common interface for resources that support streaming/listing.
101
+ *
102
+ * All OneRoster resource classes implement this interface, allowing
103
+ * generic code to work with any resource type.
104
+ *
105
+ * @typeParam T - The entity type returned by the resource
106
+ */
107
+ export interface StreamableResource<T = unknown> {
108
+ /**
109
+ * List all resources, fetching all pages automatically.
110
+ * @returns Promise resolving to an array of all matching resources
111
+ */
112
+ list(params?: Record<string, unknown>): Promise<T[]>;
113
+ /**
114
+ * Stream resources with lazy pagination.
115
+ * @returns Async iterable for streaming results
116
+ */
117
+ stream(params?: Record<string, unknown>): AsyncIterable<T>;
118
+ /**
119
+ * Get a single resource by sourcedId.
120
+ */
121
+ get(sourcedId: string): Promise<T>;
122
+ }
123
+ /**
124
+ * Re-export ToArrayOptions from client-common.
125
+ */
126
+ export type { ToArrayOptions } from '@timeback/internal-client-infra';
127
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/types/base.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EACX,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,eAAe,GACf,MAAM,iBAAiB,CAAA;A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