Skip to content

Latest commit

 

History

History
681 lines (535 loc) · 51.3 KB

File metadata and controls

681 lines (535 loc) · 51.3 KB

EnrollmentsManagement

(enrollmentsManagement)

Overview

This enables the management of the enrollments of users (teachers, students, etc.) on classes supplied by schools.

Available Operations

getAllEnrollments

To get all Enrollments on the service provider.

Example Usage

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();

Standalone function

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();

Parameters

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.

Response

Promise<operations.GetAllEnrollmentsResponse>

Errors

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 */*

createEnrollment

To create a new Enrollment. The responding system must return the set of sourcedIds that have been allocated to the newly created enrollment record.

Example Usage

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();

Standalone function

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();

Parameters

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.

Response

Promise<operations.CreateEnrollmentResponse>

Errors

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 */*

getEnrollment

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.'

Example Usage

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();

Standalone function

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();

Parameters

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.

Response

Promise<operations.GetEnrollmentResponse>

Errors

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 */*

updateEnrollment

To update an existing Enrollment. The sourcedId for the record to be updated is supplied by the requesting system.

Example Usage

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();

Standalone function

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();

Parameters

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.

Response

Promise<{ [k: string]: any }>

Errors

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 */*

deleteEnrollment

Perform a soft delete on a specific Enrollment on the service provider. The operation changes the status of the Enrollment to 'tobedeleted'.

Example Usage

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();

Standalone function

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();

Parameters

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.

Response

Promise<void>

Errors

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 */*

getEnrollmentsForClassInSchool

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.'

Example Usage

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();

Standalone function

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();

Parameters

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.

Response

Promise<operations.GetEnrollmentsForClassInSchoolResponse>

Errors

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 */*

getEnrollmentsForSchool

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.'

Example Usage

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();

Standalone function

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();

Parameters

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.

Response

Promise<operations.GetEnrollmentsForSchoolResponse>

Errors

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 */*