Skip to content

Latest commit

 

History

History
811 lines (643 loc) · 59.3 KB

File metadata and controls

811 lines (643 loc) · 59.3 KB

LineItemsManagement

(lineItemsManagement)

Overview

This enables the management of lineItems i.e. the set of results for the assessment of some activity.

Available Operations

getAllLineItems

Get all of the Line Items 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.lineItemsManagement.getAllLineItems({
    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 { lineItemsManagementGetAllLineItems } from "@superbuilders/oneroster/funcs/lineItemsManagementGetAllLineItems.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 lineItemsManagementGetAllLineItems(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("lineItemsManagementGetAllLineItems failed:", res.error);
  }
}

run();

Parameters

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

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

createLineItem

To create a new Line Item. The responding system must return the set of sourcedIds that have been allocated to the newly created Line Item records.

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.lineItemsManagement.createLineItem({
    lineItem: {
      title: "<value>",
      assignDate: new Date("2025-03-27T05:45:31.907Z"),
      dueDate: new Date("2025-01-04T15:42:48.821Z"),
      class: {
        sourcedId: "<id>",
      },
      school: {
        sourcedId: "<id>",
      },
      category: {
        sourcedId: "<id>",
      },
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { OneRosterCore } from "@superbuilders/oneroster/core.js";
import { lineItemsManagementCreateLineItem } from "@superbuilders/oneroster/funcs/lineItemsManagementCreateLineItem.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 lineItemsManagementCreateLineItem(oneRoster, {
    lineItem: {
      title: "<value>",
      assignDate: new Date("2025-03-27T05:45:31.907Z"),
      dueDate: new Date("2025-01-04T15:42:48.821Z"),
      class: {
        sourcedId: "<id>",
      },
      school: {
        sourcedId: "<id>",
      },
      category: {
        sourcedId: "<id>",
      },
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("lineItemsManagementCreateLineItem failed:", res.error);
  }
}

run();

Parameters

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

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

getLineItem

Get a specific Line Item on the service provider. If the corresponding record cannot be located, the api will return a 404 error code and message 'Line item 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.lineItemsManagement.getLineItem({
    sourcedId: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

run();

Parameters

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

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

updateLineItem

To update an existing Line Item. 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() {
  await oneRoster.lineItemsManagement.updateLineItem({
    sourcedId: "<id>",
    requestBody: {
      lineItem: {
        title: "<value>",
        assignDate: new Date("2024-01-03T19:53:44.676Z"),
        dueDate: new Date("2025-06-09T00:40:05.369Z"),
        class: {
          sourcedId: "<id>",
        },
        school: {
          sourcedId: "<id>",
        },
        category: {
          sourcedId: "<id>",
        },
      },
    },
  });


}

run();

Standalone function

The standalone function version of this method:

import { OneRosterCore } from "@superbuilders/oneroster/core.js";
import { lineItemsManagementUpdateLineItem } from "@superbuilders/oneroster/funcs/lineItemsManagementUpdateLineItem.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 lineItemsManagementUpdateLineItem(oneRoster, {
    sourcedId: "<id>",
    requestBody: {
      lineItem: {
        title: "<value>",
        assignDate: new Date("2024-01-03T19:53:44.676Z"),
        dueDate: new Date("2025-06-09T00:40:05.369Z"),
        class: {
          sourcedId: "<id>",
        },
        school: {
          sourcedId: "<id>",
        },
        category: {
          sourcedId: "<id>",
        },
      },
    },
  });
  if (res.ok) {
    const { value: result } = res;
    
  } else {
    console.log("lineItemsManagementUpdateLineItem failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.UpdateLineItemRequest ✔️ 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 */*

deleteLineItem

Perform a soft delete on a specific Line Item on the service provider. This operation changes the status of the LineItem 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.lineItemsManagement.deleteLineItem({
    sourcedId: "<id>",
  });


}

run();

Standalone function

The standalone function version of this method:

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

run();

Parameters

Parameter Type Required Description
request operations.DeleteLineItemRequest ✔️ 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 */*

createResultForLineItem

To create a new result for a specific Line Item. The responding system must return the set of sourcedIds that have been allocated to the newly created result records. If the corresponding record cannot be located, the api will return a 404 error code and message 'Line item 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.lineItemsManagement.createResultForLineItem({
    sourcedId: "<id>",
    requestBody: {
      results: [],
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

run();

Parameters

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

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

getLineItemsForSchool

Get the set of lineItems on the service provider for a specific school. If the corresponding record cannot be located, 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.lineItemsManagement.getLineItemsForSchool({
    sourcedId: "<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 { schoolsManagementGetLineItemsForSchool } from "@superbuilders/oneroster/funcs/schoolsManagementGetLineItemsForSchool.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 schoolsManagementGetLineItemsForSchool(oneRoster, {
    sourcedId: "<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("schoolsManagementGetLineItemsForSchool failed:", res.error);
  }
}

run();

Parameters

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

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

createLineItemsForSchool

To create a set of lineItems for a specific school. The responding system must return the set of sourcedIds that have been allocated to the newly created lineItem records. If the corresponding record cannot be located, 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.lineItemsManagement.createLineItemsForSchool({
    sourcedId: "<id>",
    requestBody: {
      lineItems: [
        {
          title: "<value>",
          assignDate: new Date("2024-09-10T07:55:46.630Z"),
          dueDate: new Date("2023-11-01T01:31:28.141Z"),
          class: {
            sourcedId: "<id>",
          },
          school: {
            sourcedId: "<id>",
          },
          category: {
            sourcedId: "<id>",
          },
        },
      ],
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { OneRosterCore } from "@superbuilders/oneroster/core.js";
import { schoolsManagementCreateLineItemsForSchool } from "@superbuilders/oneroster/funcs/schoolsManagementCreateLineItemsForSchool.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 schoolsManagementCreateLineItemsForSchool(oneRoster, {
    sourcedId: "<id>",
    requestBody: {
      lineItems: [
        {
          title: "<value>",
          assignDate: new Date("2024-09-10T07:55:46.630Z"),
          dueDate: new Date("2023-11-01T01:31:28.141Z"),
          class: {
            sourcedId: "<id>",
          },
          school: {
            sourcedId: "<id>",
          },
          category: {
            sourcedId: "<id>",
          },
        },
      ],
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("schoolsManagementCreateLineItemsForSchool failed:", res.error);
  }
}

run();

Parameters

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

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