@uidu/client 3.16.0 → 3.17.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uidu/client",
3
- "version": "3.16.0",
3
+ "version": "3.17.0",
4
4
  "description": "Typed GraphQL client for the uidu platform. Server-first, framework-agnostic.",
5
5
  "license": "MIT",
6
6
  "author": "uidu",
package/src/courses.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import type { UiduClient } from './client';
2
2
  import {
3
+ CreateEnrollmentDocument,
4
+ type CreateEnrollmentMutationVariables,
3
5
  GetCourseDocument,
4
6
  type GetCourseQuery,
5
7
  type GetCourseQueryVariables,
@@ -15,6 +17,8 @@ import {
15
17
  type ListEnrollmentsQueryVariables,
16
18
  ListLecturesDocument,
17
19
  type ListLecturesQueryVariables,
20
+ UpdateEnrollmentDocument,
21
+ type UpdateEnrollmentMutationVariables,
18
22
  } from './generated';
19
23
  import { nodes } from './utils/relay';
20
24
 
@@ -75,6 +79,30 @@ export async function listEnrollments(
75
79
  return nodes(result.currentWorkspace?.enrollments);
76
80
  }
77
81
 
82
+ /**
83
+ * Enroll a contact in a course; returns the payload as-is,
84
+ * `{ errors, enrollment }`, validation failures included.
85
+ */
86
+ export async function createEnrollment(
87
+ client: UiduClient,
88
+ variables: CreateEnrollmentMutationVariables,
89
+ ) {
90
+ const result = await client.mutate(CreateEnrollmentDocument, variables);
91
+ return result.createEnrollment ?? null;
92
+ }
93
+
94
+ /**
95
+ * Update an enrollment — its `aasmState`, `outcome`, `certificateStatus` or
96
+ * other attributes; returns the payload as-is, `{ errors, enrollment }`.
97
+ */
98
+ export async function updateEnrollment(
99
+ client: UiduClient,
100
+ variables: UpdateEnrollmentMutationVariables,
101
+ ) {
102
+ const result = await client.mutate(UpdateEnrollmentDocument, variables);
103
+ return result.updateEnrollment ?? null;
104
+ }
105
+
78
106
  /**
79
107
  * One lecture with its `body`, its course and its `nextLecture` /
80
108
  * `previousLecture` for navigation, or null.
package/src/events.ts CHANGED
@@ -4,11 +4,17 @@ import {
4
4
  type CreateAttendanceMutationVariables,
5
5
  CreateEventDocument,
6
6
  type CreateEventMutationVariables,
7
+ CreateEventInstanceDocument,
8
+ type CreateEventInstanceMutationVariables,
7
9
  GetEventDocument,
8
10
  type GetEventQuery,
9
11
  type GetEventQueryVariables,
10
12
  ListEventsDocument,
11
13
  type ListEventsQueryVariables,
14
+ UpdateAttendanceDocument,
15
+ type UpdateAttendanceMutationVariables,
16
+ UpdateEventInstanceDocument,
17
+ type UpdateEventInstanceMutationVariables,
12
18
  } from './generated';
13
19
  import { nodes } from './utils/relay';
14
20
 
@@ -55,6 +61,18 @@ export async function createAttendance(
55
61
  return result.createAttendance ?? null;
56
62
  }
57
63
 
64
+ /**
65
+ * Update an attendance — change its `rsvpStatus`, check it in, or edit its
66
+ * other attributes; returns the payload as-is, `{ errors, attendance }`.
67
+ */
68
+ export async function updateAttendance(
69
+ client: UiduClient,
70
+ variables: UpdateAttendanceMutationVariables,
71
+ ) {
72
+ const result = await client.mutate(UpdateAttendanceDocument, variables);
73
+ return result.updateAttendance ?? null;
74
+ }
75
+
58
76
  /**
59
77
  * Create an event; returns the payload as-is, `{ errors, event }`, validation
60
78
  * failures included.
@@ -66,3 +84,27 @@ export async function createEvent(
66
84
  const result = await client.mutate(CreateEventDocument, variables);
67
85
  return result.createEvent ?? null;
68
86
  }
87
+
88
+ /**
89
+ * Create a new occurrence (date/time) of a recurring event; returns the
90
+ * payload as-is, `{ errors, eventInstance }`.
91
+ */
92
+ export async function createEventInstance(
93
+ client: UiduClient,
94
+ variables: CreateEventInstanceMutationVariables,
95
+ ) {
96
+ const result = await client.mutate(CreateEventInstanceDocument, variables);
97
+ return result.createEventInstance ?? null;
98
+ }
99
+
100
+ /**
101
+ * Update an event instance's schedule or venue; returns the payload as-is,
102
+ * `{ errors, eventInstance }`.
103
+ */
104
+ export async function updateEventInstance(
105
+ client: UiduClient,
106
+ variables: UpdateEventInstanceMutationVariables,
107
+ ) {
108
+ const result = await client.mutate(UpdateEventInstanceDocument, variables);
109
+ return result.updateEventInstance ?? null;
110
+ }