open-index/open-npm huggingface dataset:
npm package: @groton/canvas-api.client.web
Description: Web client for @groton/canvas-api that works with PHP package groton-school/slim-canvas-api-proxy
Author: Seth Battis
Latest version: 0.2.9

# @groton/canvas-api.client.web

Web client for @groton/canvas-api that works with PHP package groton-school/slim-canvas-api-proxy

[![npm version](https://badge.fury.io/js/@groton%2Fcanvas-api.client.web.svg)](https://www.npmjs.com/package/@groton/canvas-api.client.web)

## Install

```sh
npm install @groton/canvas-api.client.web
```

## Usage

```ts
import { Canvas } from '@groton/canvas-api.client.web';

// initialize client (default configuration matches default configuration
// of groton-school/slim-canvas-api-proxy)
await Canvas.init();

const content = document.getElementById('content');

// pull a paginated list of typed users from the API
for (const user of await Canvas.v1.Accounts.Users.list({
  path: { account_id: 1 }
})) {
  const userDisplay = document.createElement('div');
  userDisplay.innerHTML = `<img src="${user.avatar_url}"/>${user.name}`;
  content.appendChild(userDisplay);
}
```

See [groton-school/slim-skeleton's gae/lti-tool_canvas_api_proxy branch](https://github.com/groton-school/slim-skeleton/tree/gae/lti-tool_canvas-api-proxy#readme) for a working example of this client.
npm package: @groton/canvas-api.utilities
Description: Utility functions to support @groton/canvas-api and its clients
Author: Seth Battis
Latest version: 0.2.1

# @groton/canvas-api.utilities

Utility functions to support @groton/canvas-api and its clients

[![npm version](https://badge.fury.io/js/@groton%2Fcanvas-api.utilities.svg)](https://www.npmjs.com/package/@groton/canvas-api.utilities)

## Install

```sh
npm install @groton/canvas-api.utilities
```

## Usage

```ts
import * as Canvas from '@groton/canvas-api';
import * as Utilities from '@groton/canvas-api.utilities';

// ...
// Canvas API initialization, etc.
// ...

// identify an API response as an error
const response = await Canvas.v1.Accounts.get({ pathParams: { id: 123 } });
if (Utilities.isError(response)) {
  // handle error
}

// stringify a complex object into a (Canvas-friendly) URL query string
const query: string = Utilities.stringify({
  assignment: {
    name: 'example',
    submission_types: ['online_upload', 'online_text_entry'],
    due_at: new Date('9/1/25 8:00 am').toISOString()
  }
});

// recursively flatten a complex object into a configurable URL query string
// (stringify() uses flatten()'s defaults)
const flattened: string = Utilities.flatten({
  assignment: {
    name: 'example',
    submission_types: ['online_upload', 'online_text_entry'],
    due_at: new Date('9/1/25 8:00 am').toISOString()
  },
  undefined, // accumulated parameter key string
  undefined, // accumulated result string[]
  true // use numeric indices for array parameterss
});

```
npm package: @groton/canvas-cli
Description: [![npm version](https://badge.fury.io/js/@groton%2Fcanvas-cli.svg)](https://badge.fury.io/js/@groton%2Fcanvas-cli)
Author: Seth Battis
Latest version: 0.0.8

# @groton/canvas-cli

[![npm version](https://badge.fury.io/js/@groton%2Fcanvas-cli.svg)](https://badge.fury.io/js/@groton%2Fcanvas-cli)

[Known Issues](https://github.com/groton-school/canvas-cli/labels/%40groton%2Fcanvas-cli)