Skip to content

Latest commit

 

History

History
669 lines (525 loc) · 51.2 KB

File metadata and controls

669 lines (525 loc) · 51.2 KB

StudentsManagement

(studentsManagement)

Overview

This enables the management of information about students (a student is a type of 'user').

Available Operations

getStudentsForClass

To get all students enrolled in a specific Class. If the corresponding record cannot be located, the api will return a 404 error code and message '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.studentsManagement.getStudentsForClass({
    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 { classesManagementGetStudentsForClass } from "@superbuilders/oneroster/funcs/classesManagementGetStudentsForClass.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 classesManagementGetStudentsForClass(oneRoster, {
    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("classesManagementGetStudentsForClass failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetStudentsForClassRequest ✔️ 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.GetStudentsForClassResponse>

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

addStudentToClass

Enrolls a student in a specific Class. 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.studentsManagement.addStudentToClass({
    classSourcedId: "<id>",
    requestBody: {
      enrollment: {
        user: {
          sourcedId: "<id>",
        },
        beginDate: "2024-01-01",
        endDate: "2024-01-01",
      },
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { OneRosterCore } from "@superbuilders/oneroster/core.js";
import { classesManagementAddStudentToClass } from "@superbuilders/oneroster/funcs/classesManagementAddStudentToClass.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 classesManagementAddStudentToClass(oneRoster, {
    classSourcedId: "<id>",
    requestBody: {
      enrollment: {
        user: {
          sourcedId: "<id>",
        },
        beginDate: "2024-01-01",
        endDate: "2024-01-01",
      },
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("classesManagementAddStudentToClass failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.AddStudentToClassRequest ✔️ 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.AddStudentToClassResponse>

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

getStudentsForClassInSchool

To get all Students 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.studentsManagement.getStudentsForClassInSchool({
    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 { schoolsManagementGetStudentsForClassInSchool } from "@superbuilders/oneroster/funcs/schoolsManagementGetStudentsForClassInSchool.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 schoolsManagementGetStudentsForClassInSchool(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("schoolsManagementGetStudentsForClassInSchool failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetStudentsForClassInSchoolRequest ✔️ 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.GetStudentsForClassInSchoolResponse>

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

getStudentsForSchool

To get all Students for a School 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.studentsManagement.getStudentsForSchool({
    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 { schoolsManagementGetStudentsForSchool } from "@superbuilders/oneroster/funcs/schoolsManagementGetStudentsForSchool.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 schoolsManagementGetStudentsForSchool(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("schoolsManagementGetStudentsForSchool failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetStudentsForSchoolRequest ✔️ 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.GetStudentsForSchoolResponse>

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

getAllStudents

To get all Students 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.studentsManagement.getAllStudents({
    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 { studentsManagementGetAllStudents } from "@superbuilders/oneroster/funcs/studentsManagementGetAllStudents.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 studentsManagementGetAllStudents(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("studentsManagementGetAllStudents failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetAllStudentsRequest ✔️ 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.GetAllStudentsResponse>

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

getStudent

To get a specific Student on the service provider. If the corresponding record cannot be located, the api will return a 404 error code and message 'Student 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.studentsManagement.getStudent({
    sourcedId: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { OneRosterCore } from "@superbuilders/oneroster/core.js";
import { studentsManagementGetStudent } from "@superbuilders/oneroster/funcs/studentsManagementGetStudent.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 studentsManagementGetStudent(oneRoster, {
    sourcedId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("studentsManagementGetStudent failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetStudentRequest ✔️ 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.GetStudentResponse>

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

getClassesForStudent

To get the set of Classes related to a specific Student. If the specified student cannot be identified within the service provider, the api will return a 404 error code and message 'Student 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.studentsManagement.getClassesForStudent({
    studentSourcedId: "<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 { classesManagementGetClassesForStudent } from "@superbuilders/oneroster/funcs/classesManagementGetClassesForStudent.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 classesManagementGetClassesForStudent(oneRoster, {
    studentSourcedId: "<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("classesManagementGetClassesForStudent failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetClassesForStudentRequest ✔️ 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.GetClassesForStudentResponse>

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