@oauth2-cli/sky-api 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
4
 
5
+ ## [0.3.2](https://github.com/groton-school/myschoolapp-reporting/compare/oauth2-cli/sky-api/0.3.1...oauth2-cli/sky-api/0.3.2) (2026-01-04)
6
+
7
+
8
+ ### Features
9
+
10
+ * update to instance-based @oauth2-cli/qui-cli ([fae38fb](https://github.com/groton-school/myschoolapp-reporting/commit/fae38fbcd3e6361af6ac5d37cf9e29a339ce95da))
11
+
12
+ ## [0.3.1](https://github.com/groton-school/myschoolapp-reporting/compare/oauth2-cli/sky-api/0.3.0...oauth2-cli/sky-api/0.3.1) (2025-12-26)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * include Content-Type header when sending JSON bodies ([b06e18e](https://github.com/groton-school/myschoolapp-reporting/commit/b06e18e5136a08a00e251171348c9cf2325656ca))
18
+ * update CategroyRequest typing to match observed reality ([89ad060](https://github.com/groton-school/myschoolapp-reporting/commit/89ad060476e7efed3430aff969b0dbdaa99692d1))
19
+ * update Colors usage to match current version ([7a82e9f](https://github.com/groton-school/myschoolapp-reporting/commit/7a82e9f3e624992c8c2a0ba7241d82327913391f))
20
+ * update photoalbum.list() to reflect actual behavior, rather than documentation ([e2f1708](https://github.com/groton-school/myschoolapp-reporting/commit/e2f170804f5338c54279b2ca095a075fdbc32fb6))
21
+
5
22
  ## [0.3.0](https://github.com/groton-school/myschoolapp-reporting/compare/oauth2-cli/sky-api/0.2.2...oauth2-cli/sky-api/0.3.0) (2025-12-24)
6
23
 
7
24
 
package/dist/Client.d.ts CHANGED
@@ -1,15 +1,19 @@
1
- import { OAuth2 } from '@oauth2-cli/qui-cli-plugin';
1
+ import * as OAuth2 from '@oauth2-cli/qui-cli/dist/OAuth2.js';
2
2
  import * as Plugin from '@qui-cli/plugin';
3
- export type Configuration = Plugin.Configuration & {
3
+ type SkyConfiguration = {
4
4
  subscription_key?: string;
5
5
  subscriptionKeyEnvVar: string;
6
6
  };
7
- export declare const name = "@oauth2-cli/sky-api";
8
- export declare function configure(proposal?: Partial<Configuration>): void;
9
- export declare function options(): Plugin.Options;
10
- export declare function init({ values }: Plugin.ExpectedArguments<typeof options>): Promise<void>;
11
- export declare const getToken: typeof OAuth2.getToken;
12
- export declare const request: typeof OAuth2.request;
13
- export declare const requestJSON: typeof OAuth2.requestJSON;
14
- /** @deprecated Use {@link requestJSON} */
15
- export declare const fetch: typeof OAuth2.request;
7
+ export type Credentials = OAuth2.Credentials & {
8
+ subscription_key: string;
9
+ };
10
+ export type Configuration = OAuth2.Configuration & SkyConfiguration;
11
+ export type ConfigurationProposal = OAuth2.ConfigurationProposal & Partial<SkyConfiguration>;
12
+ export declare class Client extends OAuth2.OAuth2 {
13
+ private skyConfig;
14
+ constructor(name?: string);
15
+ configure({ subscription_key, subscriptionKeyEnvVar, ...proposal }?: ConfigurationProposal): void;
16
+ options(): Plugin.Options;
17
+ init({ values }: Plugin.ExpectedArguments<typeof this.options>): Promise<void>;
18
+ }
19
+ export {};
package/dist/Client.js CHANGED
@@ -1,56 +1,59 @@
1
- import { OAuth2 } from '@oauth2-cli/qui-cli-plugin';
1
+ import * as OAuth2 from '@oauth2-cli/qui-cli/dist/OAuth2.js';
2
2
  import { Colors } from '@qui-cli/colors';
3
3
  import { Env } from '@qui-cli/env-1password';
4
- OAuth2.configure({
5
- authorization_endpoint: 'https://app.blackbaud.com/oauth/authorize',
6
- token_endpoint: 'https://oauth2.sky.blackbaud.com/token',
7
- env: {
8
- client_id: 'SKY_CLIENT_ID',
9
- client_secret: 'SKY_CLIENT_SECRET',
10
- redirect_uri: 'SKY_REDIRECT_URI',
11
- token_path: 'SKY_TOKEN_PATH',
12
- access_token: 'SKY_ACCESS_TOKEN'
13
- },
14
- man: { heading: 'Sky API options' },
15
- suppress: {
16
- authorizationEndpoint: true,
17
- tokenEndpoint: true,
18
- tokenPath: true
4
+ export class Client extends OAuth2.OAuth2 {
5
+ skyConfig = {
6
+ subscriptionKeyEnvVar: 'SKY_SUBSCRIPTION_KEY'
7
+ };
8
+ constructor(name = '@oauth2-cli/sky-api') {
9
+ super(name);
10
+ super.configure({
11
+ authorization_endpoint: 'https://app.blackbaud.com/oauth/authorize',
12
+ token_endpoint: 'https://oauth2.sky.blackbaud.com/token',
13
+ env: {
14
+ client_id: 'SKY_CLIENT_ID',
15
+ client_secret: 'SKY_CLIENT_SECRET',
16
+ redirect_uri: 'SKY_REDIRECT_URI',
17
+ token_path: 'SKY_TOKEN_PATH',
18
+ access_token: 'SKY_ACCESS_TOKEN'
19
+ },
20
+ man: { heading: 'Sky API options' },
21
+ suppress: {
22
+ authorizationEndpoint: true,
23
+ tokenEndpoint: true,
24
+ tokenPath: true
25
+ }
26
+ });
19
27
  }
20
- });
21
- export const name = '@oauth2-cli/sky-api';
22
- const config = {
23
- subscriptionKeyEnvVar: 'SKY_SUBSCRIPTION_KEY'
24
- };
25
- export function configure(proposal = {}) {
26
- for (const key in proposal) {
27
- if (proposal[key] !== undefined) {
28
- config[key] = proposal[key];
29
- }
28
+ configure({ subscription_key, subscriptionKeyEnvVar, ...proposal } = {}) {
29
+ super.configure(proposal);
30
+ this.skyConfig.subscription_key =
31
+ subscription_key || this.skyConfig.subscription_key;
32
+ this.skyConfig.subscriptionKeyEnvVar =
33
+ subscriptionKeyEnvVar || this.skyConfig.subscriptionKeyEnvVar;
30
34
  }
31
- }
32
- export function options() {
33
- return {
34
- opt: {
35
+ options() {
36
+ const options = super.options();
37
+ options.opt = {
38
+ ...options.opt,
35
39
  subscriptionKey: {
36
- description: `Blackbaud subscription access key; will use environment variable ${Colors.varName(config.subscriptionKeyEnvVar)} if present`,
40
+ description: `Blackbaud subscription access key; will use environment ` +
41
+ `variable ${Colors.varName(this.skyConfig.subscriptionKeyEnvVar)} ` +
42
+ `if present`,
37
43
  secret: true,
38
- default: config.subscription_key
44
+ default: this.skyConfig.subscription_key
39
45
  }
40
- }
41
- };
42
- }
43
- export async function init({ values }) {
44
- const { subscriptionKey: subscription_key = await Env.get({
45
- key: config.subscriptionKeyEnvVar
46
- }) } = values;
47
- configure({ subscription_key, ...values });
48
- OAuth2.configure({
49
- headers: { 'Bb-Api-Subscription-Key': config.subscription_key }
50
- });
46
+ };
47
+ return options;
48
+ }
49
+ async init({ values }) {
50
+ const { subscriptionKey: subscription_key = await Env.get({
51
+ key: this.skyConfig.subscriptionKeyEnvVar
52
+ }) } = values;
53
+ this.configure({
54
+ subscription_key,
55
+ ...values,
56
+ headers: { 'Bb-Api-Subscription-Key': this.skyConfig.subscription_key }
57
+ });
58
+ }
51
59
  }
52
- export const getToken = OAuth2.getToken;
53
- export const request = OAuth2.request;
54
- export const requestJSON = OAuth2.requestJSON;
55
- /** @deprecated Use {@link requestJSON} */
56
- export const fetch = OAuth2.request;
@@ -1,10 +1,11 @@
1
1
  import { URLString } from '@battis/descriptive-types';
2
- type Data<T> = {
2
+ import { JSONValue } from '@battis/typescript-tricks';
3
+ type Data<T extends JSONValue> = {
3
4
  count?: number;
4
5
  next_link?: URLString;
5
6
  value?: T[];
6
7
  };
7
- export declare class Paginated<T> implements AsyncIterable<T> {
8
+ export declare class Paginated<T extends JSONValue> implements AsyncIterable<T> {
8
9
  private data;
9
10
  constructor(data: Data<T>);
10
11
  [Symbol.asyncIterator](): AsyncIterator<T>;
package/dist/Paginated.js CHANGED
@@ -1,4 +1,4 @@
1
- import * as Client from './Client.js';
1
+ import { Client } from './SkyAPI.js';
2
2
  export class Paginated {
3
3
  data;
4
4
  constructor(data) {
package/dist/SkyAPI.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export * from './Client.js';
1
+ import { Client as C } from './Client.js';
2
+ export declare const Client: C;
2
3
  export * as school from './school/index.js';
package/dist/SkyAPI.js CHANGED
@@ -1,2 +1,3 @@
1
- export * from './Client.js';
1
+ import { Client as C } from './Client.js';
2
+ export const Client = new C();
2
3
  export * as school from './school/index.js';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { register } from '@qui-cli/plugin';
2
- import * as Client from './Client.js';
2
+ import { Client } from './SkyAPI.js';
3
3
  export * as SkyAPI from './SkyAPI.js';
4
4
  await register(Client);
@@ -1,5 +1,5 @@
1
1
  import { Paginated } from '../../../../../Paginated.js';
2
- import { Assignment } from './Assignment.js';
2
+ import * as SkyAPI from '../../../../../SkyAPI.js';
3
3
  type Options = {
4
4
  types?: string;
5
5
  status?: '0' | '1' | '2' | '-1';
@@ -7,5 +7,5 @@ type Options = {
7
7
  filter?: 'expired' | 'future' | 'all';
8
8
  search?: string;
9
9
  };
10
- export declare function assignmentsBySection(section_id: number, params?: Options): Promise<Paginated<Assignment>>;
10
+ export declare function assignmentsBySection(section_id: number, params?: Options): Promise<Paginated<SkyAPI.school.v1.academics.sections.assignments.Assignment>>;
11
11
  export {};
@@ -1,6 +1,6 @@
1
1
  import { buildQuery } from '../../../../../buildQuery.js';
2
- import * as SkyAPI from '../../../../../Client.js';
3
2
  import { Paginated } from '../../../../../Paginated.js';
3
+ import * as SkyAPI from '../../../../../SkyAPI.js';
4
4
  export async function assignmentsBySection(section_id, params = {}) {
5
- return new Paginated(await SkyAPI.requestJSON(`https://api.sky.blackbaud.com/school/v1/academics/sections/${section_id}/assignments?${buildQuery(params)}`));
5
+ return new Paginated(await SkyAPI.Client.requestJSON(`https://api.sky.blackbaud.com/school/v1/academics/sections/${section_id}/assignments?${buildQuery(params)}`));
6
6
  }
@@ -1,4 +1,4 @@
1
1
  export type CategoryRequest = {
2
- id?: number;
3
- type?: 'Page content' | 'Class' | 'Activity' | 'Advisory' | 'Team' | 'Dorm' | 'Community';
2
+ id?: number | string;
3
+ type?: 'PageContent' | 'Class' | 'Activity' | 'Advisory' | 'Team' | 'Dorm' | 'Community';
4
4
  };
@@ -1,9 +1,8 @@
1
1
  import { Paginated } from '../../../../Paginated.js';
2
+ import * as SkyAPI from '../../../../SkyAPI.js';
2
3
  import { ContentManagementRequest } from '../ContentManagementRequest.js';
3
- import { ContentAnnouncement } from './ContentAnnouncement.js';
4
- import { ContentAnnouncementCategory } from './ContentAnnouncementCategory.js';
5
4
  export * from './ContentAnnouncement.js';
6
5
  export * from './ContentAnnouncementCategory.js';
7
6
  export * from './ContentAnnouncementCategoryCollection.js';
8
- export declare function categories(): Promise<Paginated<ContentAnnouncementCategory>>;
9
- export declare function list(request: ContentManagementRequest): Promise<ContentAnnouncement[]>;
7
+ export declare function categories(): Promise<Paginated<SkyAPI.school.v1.contentmanagement.announcements.ContentAnnouncementCategory>>;
8
+ export declare function list(request: ContentManagementRequest): Promise<SkyAPI.school.v1.contentmanagement.announcements.ContentAnnouncement[]>;
@@ -1,11 +1,11 @@
1
- import * as SkyAPI from '../../../../Client.js';
2
1
  import { Paginated } from '../../../../Paginated.js';
2
+ import * as SkyAPI from '../../../../SkyAPI.js';
3
3
  export * from './ContentAnnouncement.js';
4
4
  export * from './ContentAnnouncementCategory.js';
5
5
  export * from './ContentAnnouncementCategoryCollection.js';
6
6
  export async function categories() {
7
- return new Paginated(await SkyAPI.requestJSON('https://api.sky.blackbaud.com/school/v1/contentmanagement/announcements/categories'));
7
+ return new Paginated(await SkyAPI.Client.requestJSON('https://api.sky.blackbaud.com/school/v1/contentmanagement/announcements/categories'));
8
8
  }
9
9
  export async function list(request) {
10
- return SkyAPI.requestJSON('https://api.sky.blackbaud.com/school/v1/contentmanagement/announcements/list', 'POST', JSON.stringify(request));
10
+ return SkyAPI.Client.requestJSON('https://api.sky.blackbaud.com/school/v1/contentmanagement/announcements/list', 'POST', JSON.stringify(request), new Headers({ 'Content-Type': 'application/json' }));
11
11
  }
@@ -1,9 +1,8 @@
1
1
  import { Paginated } from '../../../../Paginated.js';
2
+ import * as SkyAPI from '../../../../SkyAPI.js';
2
3
  import { ContentManagementRequest } from '../ContentManagementRequest.js';
3
- import { NewsCategory } from './NewsCategory.js';
4
- import { NewsItem } from './NewsItem.js';
5
4
  export * from './NewsCategory.js';
6
5
  export * from './NewsCategoryCollection.js';
7
6
  export * from './NewsItem.js';
8
- export declare function categories(): Promise<Paginated<NewsCategory>>;
9
- export declare function list(request: ContentManagementRequest): Promise<NewsItem[]>;
7
+ export declare function categories(): Promise<Paginated<SkyAPI.school.v1.contentmanagement.news.NewsCategory>>;
8
+ export declare function list(request: ContentManagementRequest): Promise<SkyAPI.school.v1.contentmanagement.news.NewsItem[]>;
@@ -1,11 +1,11 @@
1
- import * as SkyAPI from '../../../../Client.js';
2
1
  import { Paginated } from '../../../../Paginated.js';
2
+ import * as SkyAPI from '../../../../SkyAPI.js';
3
3
  export * from './NewsCategory.js';
4
4
  export * from './NewsCategoryCollection.js';
5
5
  export * from './NewsItem.js';
6
6
  export async function categories() {
7
- return new Paginated(await SkyAPI.requestJSON('https://api.sky.blackbaud.com/school/v1/contentmanagement/news/categories'));
7
+ return new Paginated(await SkyAPI.Client.requestJSON('https://api.sky.blackbaud.com/school/v1/contentmanagement/news/categories'));
8
8
  }
9
9
  export async function list(request) {
10
- return await SkyAPI.requestJSON('https://api.sky.blackbaud.com/school/v1/contentmanagement/news/list', 'POST', JSON.stringify(request));
10
+ return await SkyAPI.Client.requestJSON('https://api.sky.blackbaud.com/school/v1/contentmanagement/news/list', 'POST', JSON.stringify(request), new Headers({ 'Content-Type': 'application/json' }));
11
11
  }
@@ -0,0 +1,7 @@
1
+ import { URLString } from '@battis/descriptive-types';
2
+ import { PhotoAlbum } from './PhotoAlbum.js';
3
+ export type PhotoAlbumCollection = {
4
+ count?: number;
5
+ next_link?: URLString;
6
+ value?: PhotoAlbum[];
7
+ };
@@ -1,8 +1,6 @@
1
1
  import { Paginated } from '../../../../Paginated.js';
2
+ import * as SkyAPI from '../../../../SkyAPI.js';
2
3
  import { ContentManagementRequest } from '../ContentManagementRequest.js';
3
- import { MediaItem } from './MediaItem.js';
4
- import { PhotoAlbum } from './PhotoAlbum.js';
5
- import { PhotoCategory } from './PhotoCategory.js';
6
4
  export * from './ImageDimension.js';
7
5
  export * from './ImageSettings.js';
8
6
  export * from './MediaItem.js';
@@ -10,6 +8,6 @@ export * from './MediaItemCollection.js';
10
8
  export * from './PhotoAlbum.js';
11
9
  export * from './PhotoCategory.js';
12
10
  export * from './PhotoCategoryCollection.js';
13
- export declare function categories(): Promise<Paginated<PhotoCategory>>;
14
- export declare function list(request: ContentManagementRequest): Promise<PhotoAlbum[]>;
15
- export declare function photosById(album_id: number): Promise<Paginated<MediaItem>>;
11
+ export declare function categories(): Promise<Paginated<SkyAPI.school.v1.contentmanagement.photoalbums.PhotoCategory>>;
12
+ export declare function list(request: ContentManagementRequest): Promise<Paginated<SkyAPI.school.v1.contentmanagement.photoalbums.PhotoAlbum>>;
13
+ export declare function photosById(album_id: number): Promise<Paginated<SkyAPI.school.v1.contentmanagement.photoalbums.MediaItem>>;
@@ -1,5 +1,5 @@
1
- import * as SkyAPI from '../../../../Client.js';
2
1
  import { Paginated } from '../../../../Paginated.js';
2
+ import * as SkyAPI from '../../../../SkyAPI.js';
3
3
  export * from './ImageDimension.js';
4
4
  export * from './ImageSettings.js';
5
5
  export * from './MediaItem.js';
@@ -8,11 +8,11 @@ export * from './PhotoAlbum.js';
8
8
  export * from './PhotoCategory.js';
9
9
  export * from './PhotoCategoryCollection.js';
10
10
  export async function categories() {
11
- return new Paginated(await SkyAPI.requestJSON('https://api.sky.blackbaud.com/school/v1/contentmanagement/photoalbums/categories'));
11
+ return new Paginated(await SkyAPI.Client.requestJSON('https://api.sky.blackbaud.com/school/v1/contentmanagement/photoalbums/categories'));
12
12
  }
13
13
  export async function list(request) {
14
- return await SkyAPI.requestJSON('https://api.sky.blackbaud.com/school/v1/contentmanagement/photoalbums/list', 'POST', JSON.stringify(request));
14
+ return new Paginated(await SkyAPI.Client.requestJSON('https://api.sky.blackbaud.com/school/v1/contentmanagement/photoalbums/list', 'POST', JSON.stringify(request), new Headers({ 'Content-Type': 'application/json' })));
15
15
  }
16
16
  export async function photosById(album_id) {
17
- return new Paginated(await SkyAPI.requestJSON(`https://api.sky.blackbaud.com/school/v1/contentmanagement/photoalbums/${album_id}`));
17
+ return new Paginated(await SkyAPI.Client.requestJSON(`https://api.sky.blackbaud.com/school/v1/contentmanagement/photoalbums/${album_id}`));
18
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oauth2-cli/sky-api",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "keywords": [
5
5
  "blackbaud",
6
6
  "sky",
@@ -27,9 +27,10 @@
27
27
  },
28
28
  "devDependencies": {
29
29
  "@battis/descriptive-types": "^0.2.6",
30
- "@oauth2-cli/qui-cli-plugin": "^0.3.0",
31
- "@qui-cli/colors": "^3.1.1",
32
- "@qui-cli/env-1password": "^1.2.2",
30
+ "@battis/typescript-tricks": "^0.7.6",
31
+ "@oauth2-cli/qui-cli": "^0.4.1",
32
+ "@qui-cli/colors": "^3.2.1",
33
+ "@qui-cli/env-1password": "^1.2.5",
33
34
  "@qui-cli/plugin": "^4.0.0",
34
35
  "@tsconfig/node20": "^20.1.8",
35
36
  "commit-and-tag-version": "^12.6.1",
@@ -38,8 +39,8 @@
38
39
  "typescript": "^5.9.3"
39
40
  },
40
41
  "peerDependencies": {
41
- "@oauth2-cli/qui-cli-plugin": "0.x",
42
- "@qui-cli/plugin": "4.x"
42
+ "@oauth2-cli/qui-cli": "0.4.x",
43
+ "@qui-cli/plugin": ">=3"
43
44
  },
44
45
  "scripts": {
45
46
  "clean": "del ./dist",