(enrollmentsManagement)
This enables the management of the enrollments of users (teachers, students, etc.) on classes supplied by schools.
- getAllEnrollments - Get all Enrollments
- createEnrollment - Create a new Enrollment
- getEnrollment - Get a specific Enrollment
- updateEnrollment - Update an Enrollment
- deleteEnrollment - Delete an Enrollment
- getEnrollmentsForClassInSchool - Get Enrollments for a specific Class in a School
- getEnrollmentsForSchool - Get all Enrollments for a School
To get all Enrollments on the service provider.
import { OneRoster } from "@superbuilders/oneroster";
const oneRoster = new OneRoster({
security: {
clientID: process.env["ONEROSTER_CLIENT_ID"] ?? "",
clientSecret: process.env["ONEROSTER_CLIENT_SECRET"] ?? "",
},
});
async function run() {
const result = await oneRoster.enrollmentsManagement.getAllEnrollments({
fields: "sourcedId,name",
filter: "status='active'",
});
for await (const page of result) {
console.log(page);
}
}
run();The standalone function version of this method:
import { OneRosterCore } from "@superbuilders/oneroster/core.js";
import { enrollmentsManagementGetAllEnrollments } from "@superbuilders/oneroster/funcs/enrollmentsManagementGetAllEnrollments.js";
// Use `OneRosterCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const oneRoster = new OneRosterCore({
security: {
clientID: process.env["ONEROSTER_CLIENT_ID"] ?? "",
clientSecret: process.env["ONEROSTER_CLIENT_SECRET"] ?? "",
},
});
async function run() {
const res = await enrollmentsManagementGetAllEnrollments(oneRoster, {
fields: "sourcedId,name",
filter: "status='active'",
});
if (res.ok) {
const { value: result } = res;
for await (const page of result) {
console.log(page);
}
} else {
console.log("enrollmentsManagementGetAllEnrollments failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetAllEnrollmentsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.GetAllEnrollmentsResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedRequestResponseError | 401 | application/json |
| errors.ForbiddenResponseError | 403 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.UnprocessableEntityResponseError | 422 | application/json |
| errors.TooManyRequestsResponseError | 429 | application/json |
| errors.InternalServerErrorResponse | 500 | application/json |
| errors.APIError | 4XX, 5XX | */* |
To create a new Enrollment. The responding system must return the set of sourcedIds that have been allocated to the newly created enrollment record.
import { OneRoster } from "@superbuilders/oneroster";
const oneRoster = new OneRoster({
security: {
clientID: process.env["ONEROSTER_CLIENT_ID"] ?? "",
clientSecret: process.env["ONEROSTER_CLIENT_SECRET"] ?? "",
},
});
async function run() {
const result = await oneRoster.enrollmentsManagement.createEnrollment({
enrollment: {
role: "student",
beginDate: "2024-01-01",
endDate: "2024-01-01",
user: {
sourcedId: "<id>",
},
class: {
sourcedId: "<id>",
},
},
});
console.log(result);
}
run();The standalone function version of this method:
import { OneRosterCore } from "@superbuilders/oneroster/core.js";
import { enrollmentsManagementCreateEnrollment } from "@superbuilders/oneroster/funcs/enrollmentsManagementCreateEnrollment.js";
// Use `OneRosterCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const oneRoster = new OneRosterCore({
security: {
clientID: process.env["ONEROSTER_CLIENT_ID"] ?? "",
clientSecret: process.env["ONEROSTER_CLIENT_SECRET"] ?? "",
},
});
async function run() {
const res = await enrollmentsManagementCreateEnrollment(oneRoster, {
enrollment: {
role: "student",
beginDate: "2024-01-01",
endDate: "2024-01-01",
user: {
sourcedId: "<id>",
},
class: {
sourcedId: "<id>",
},
},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("enrollmentsManagementCreateEnrollment failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.CreateEnrollmentRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.CreateEnrollmentResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedRequestResponseError | 401 | application/json |
| errors.ForbiddenResponseError | 403 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.UnprocessableEntityResponseError | 422 | application/json |
| errors.TooManyRequestsResponseError | 429 | application/json |
| errors.InternalServerErrorResponse | 500 | application/json |
| errors.APIError | 4XX, 5XX | */* |
Get a specific Enrollment on the service provider. If the corresponding record cannot be located, the api will return a 404 error code and message 'Enrollment not found.'
import { OneRoster } from "@superbuilders/oneroster";
const oneRoster = new OneRoster({
security: {
clientID: process.env["ONEROSTER_CLIENT_ID"] ?? "",
clientSecret: process.env["ONEROSTER_CLIENT_SECRET"] ?? "",
},
});
async function run() {
const result = await oneRoster.enrollmentsManagement.getEnrollment({
sourcedId: "<id>",
});
console.log(result);
}
run();The standalone function version of this method:
import { OneRosterCore } from "@superbuilders/oneroster/core.js";
import { enrollmentsManagementGetEnrollment } from "@superbuilders/oneroster/funcs/enrollmentsManagementGetEnrollment.js";
// Use `OneRosterCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const oneRoster = new OneRosterCore({
security: {
clientID: process.env["ONEROSTER_CLIENT_ID"] ?? "",
clientSecret: process.env["ONEROSTER_CLIENT_SECRET"] ?? "",
},
});
async function run() {
const res = await enrollmentsManagementGetEnrollment(oneRoster, {
sourcedId: "<id>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("enrollmentsManagementGetEnrollment failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetEnrollmentRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.GetEnrollmentResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedRequestResponseError | 401 | application/json |
| errors.ForbiddenResponseError | 403 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.UnprocessableEntityResponseError | 422 | application/json |
| errors.TooManyRequestsResponseError | 429 | application/json |
| errors.InternalServerErrorResponse | 500 | application/json |
| errors.APIError | 4XX, 5XX | */* |
To update an existing Enrollment. The sourcedId for the record to be updated is supplied by the requesting system.
import { OneRoster } from "@superbuilders/oneroster";
const oneRoster = new OneRoster({
security: {
clientID: process.env["ONEROSTER_CLIENT_ID"] ?? "",
clientSecret: process.env["ONEROSTER_CLIENT_SECRET"] ?? "",
},
});
async function run() {
const result = await oneRoster.enrollmentsManagement.updateEnrollment({
sourcedId: "<id>",
requestBody: {
enrollment: {
role: "student",
beginDate: "2024-01-01",
endDate: "2024-01-01",
user: {
sourcedId: "<id>",
},
class: {
sourcedId: "<id>",
},
},
},
});
console.log(result);
}
run();The standalone function version of this method:
import { OneRosterCore } from "@superbuilders/oneroster/core.js";
import { enrollmentsManagementUpdateEnrollment } from "@superbuilders/oneroster/funcs/enrollmentsManagementUpdateEnrollment.js";
// Use `OneRosterCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const oneRoster = new OneRosterCore({
security: {
clientID: process.env["ONEROSTER_CLIENT_ID"] ?? "",
clientSecret: process.env["ONEROSTER_CLIENT_SECRET"] ?? "",
},
});
async function run() {
const res = await enrollmentsManagementUpdateEnrollment(oneRoster, {
sourcedId: "<id>",
requestBody: {
enrollment: {
role: "student",
beginDate: "2024-01-01",
endDate: "2024-01-01",
user: {
sourcedId: "<id>",
},
class: {
sourcedId: "<id>",
},
},
},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("enrollmentsManagementUpdateEnrollment failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.UpdateEnrollmentRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<{ [k: string]: any }>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedRequestResponseError | 401 | application/json |
| errors.ForbiddenResponseError | 403 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.UnprocessableEntityResponseError | 422 | application/json |
| errors.TooManyRequestsResponseError | 429 | application/json |
| errors.InternalServerErrorResponse | 500 | application/json |
| errors.APIError | 4XX, 5XX | */* |
Perform a soft delete on a specific Enrollment on the service provider. The operation changes the status of the Enrollment to 'tobedeleted'.
import { OneRoster } from "@superbuilders/oneroster";
const oneRoster = new OneRoster({
security: {
clientID: process.env["ONEROSTER_CLIENT_ID"] ?? "",
clientSecret: process.env["ONEROSTER_CLIENT_SECRET"] ?? "",
},
});
async function run() {
await oneRoster.enrollmentsManagement.deleteEnrollment({
sourcedId: "<id>",
});
}
run();The standalone function version of this method:
import { OneRosterCore } from "@superbuilders/oneroster/core.js";
import { enrollmentsManagementDeleteEnrollment } from "@superbuilders/oneroster/funcs/enrollmentsManagementDeleteEnrollment.js";
// Use `OneRosterCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const oneRoster = new OneRosterCore({
security: {
clientID: process.env["ONEROSTER_CLIENT_ID"] ?? "",
clientSecret: process.env["ONEROSTER_CLIENT_SECRET"] ?? "",
},
});
async function run() {
const res = await enrollmentsManagementDeleteEnrollment(oneRoster, {
sourcedId: "<id>",
});
if (res.ok) {
const { value: result } = res;
} else {
console.log("enrollmentsManagementDeleteEnrollment failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.DeleteEnrollmentRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<void>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedRequestResponseError | 401 | application/json |
| errors.ForbiddenResponseError | 403 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.UnprocessableEntityResponseError | 422 | application/json |
| errors.TooManyRequestsResponseError | 429 | application/json |
| errors.InternalServerErrorResponse | 500 | application/json |
| errors.APIError | 4XX, 5XX | */* |
To get all Enrollments for a Class in a School on the service provider. If the specified school and/or class cannot be identified within the service provider, the api will return a 404 error code and message 'School or class not found.'
import { OneRoster } from "@superbuilders/oneroster";
const oneRoster = new OneRoster({
security: {
clientID: process.env["ONEROSTER_CLIENT_ID"] ?? "",
clientSecret: process.env["ONEROSTER_CLIENT_SECRET"] ?? "",
},
});
async function run() {
const result = await oneRoster.enrollmentsManagement.getEnrollmentsForClassInSchool({
schoolSourcedId: "<id>",
classSourcedId: "<id>",
fields: "sourcedId,name",
filter: "status='active'",
});
for await (const page of result) {
console.log(page);
}
}
run();The standalone function version of this method:
import { OneRosterCore } from "@superbuilders/oneroster/core.js";
import { schoolsManagementGetEnrollmentsForClassInSchool } from "@superbuilders/oneroster/funcs/schoolsManagementGetEnrollmentsForClassInSchool.js";
// Use `OneRosterCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const oneRoster = new OneRosterCore({
security: {
clientID: process.env["ONEROSTER_CLIENT_ID"] ?? "",
clientSecret: process.env["ONEROSTER_CLIENT_SECRET"] ?? "",
},
});
async function run() {
const res = await schoolsManagementGetEnrollmentsForClassInSchool(oneRoster, {
schoolSourcedId: "<id>",
classSourcedId: "<id>",
fields: "sourcedId,name",
filter: "status='active'",
});
if (res.ok) {
const { value: result } = res;
for await (const page of result) {
console.log(page);
}
} else {
console.log("schoolsManagementGetEnrollmentsForClassInSchool failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetEnrollmentsForClassInSchoolRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.GetEnrollmentsForClassInSchoolResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedRequestResponseError | 401 | application/json |
| errors.ForbiddenResponseError | 403 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.UnprocessableEntityResponseError | 422 | application/json |
| errors.TooManyRequestsResponseError | 429 | application/json |
| errors.InternalServerErrorResponse | 500 | application/json |
| errors.APIError | 4XX, 5XX | */* |
To get all Enrollments for a School on the service provider. If the specified school cannot be identified within the service provider, the api will return a 404 error code and message 'School not found.'
import { OneRoster } from "@superbuilders/oneroster";
const oneRoster = new OneRoster({
security: {
clientID: process.env["ONEROSTER_CLIENT_ID"] ?? "",
clientSecret: process.env["ONEROSTER_CLIENT_SECRET"] ?? "",
},
});
async function run() {
const result = await oneRoster.enrollmentsManagement.getEnrollmentsForSchool({
schoolSourcedId: "<id>",
fields: "sourcedId,name",
filter: "status='active'",
});
for await (const page of result) {
console.log(page);
}
}
run();The standalone function version of this method:
import { OneRosterCore } from "@superbuilders/oneroster/core.js";
import { schoolsManagementGetEnrollmentsForSchool } from "@superbuilders/oneroster/funcs/schoolsManagementGetEnrollmentsForSchool.js";
// Use `OneRosterCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const oneRoster = new OneRosterCore({
security: {
clientID: process.env["ONEROSTER_CLIENT_ID"] ?? "",
clientSecret: process.env["ONEROSTER_CLIENT_SECRET"] ?? "",
},
});
async function run() {
const res = await schoolsManagementGetEnrollmentsForSchool(oneRoster, {
schoolSourcedId: "<id>",
fields: "sourcedId,name",
filter: "status='active'",
});
if (res.ok) {
const { value: result } = res;
for await (const page of result) {
console.log(page);
}
} else {
console.log("schoolsManagementGetEnrollmentsForSchool failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetEnrollmentsForSchoolRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.GetEnrollmentsForSchoolResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedRequestResponseError | 401 | application/json |
| errors.ForbiddenResponseError | 403 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.UnprocessableEntityResponseError | 422 | application/json |
| errors.TooManyRequestsResponseError | 429 | application/json |
| errors.InternalServerErrorResponse | 500 | application/json |
| errors.APIError | 4XX, 5XX | */* |