@oauth2-cli/sky-api 0.3.1 → 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 +7 -0
- package/dist/Client.d.ts +15 -11
- package/dist/Client.js +51 -48
- package/dist/Paginated.d.ts +3 -2
- package/dist/Paginated.js +1 -1
- package/dist/SkyAPI.d.ts +2 -1
- package/dist/SkyAPI.js +2 -1
- package/dist/index.js +1 -1
- package/dist/school/v1/academics/sections/assignments/assignmentsBySection.d.ts +2 -2
- package/dist/school/v1/academics/sections/assignments/assignmentsBySection.js +2 -2
- package/dist/school/v1/contentmanagement/announcements/index.d.ts +3 -4
- package/dist/school/v1/contentmanagement/announcements/index.js +3 -3
- package/dist/school/v1/contentmanagement/news/index.d.ts +3 -4
- package/dist/school/v1/contentmanagement/news/index.js +3 -3
- package/dist/school/v1/contentmanagement/photoalbums/index.d.ts +4 -6
- package/dist/school/v1/contentmanagement/photoalbums/index.js +4 -4
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
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
|
+
|
|
5
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)
|
|
6
13
|
|
|
7
14
|
|
package/dist/Client.d.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as OAuth2 from '@oauth2-cli/qui-cli/dist/OAuth2.js';
|
|
2
2
|
import * as Plugin from '@qui-cli/plugin';
|
|
3
|
-
|
|
3
|
+
type SkyConfiguration = {
|
|
4
4
|
subscription_key?: string;
|
|
5
5
|
subscriptionKeyEnvVar: string;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export declare
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
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.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
|
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:
|
|
44
|
+
default: this.skyConfig.subscription_key
|
|
39
45
|
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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;
|
package/dist/Paginated.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { URLString } from '@battis/descriptive-types';
|
|
2
|
-
|
|
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
package/dist/SkyAPI.d.ts
CHANGED
package/dist/SkyAPI.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Paginated } from '../../../../../Paginated.js';
|
|
2
|
-
import
|
|
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,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), { 'Content-Type': 'application/json' });
|
|
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), { 'Content-Type': 'application/json' });
|
|
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
|
}
|
|
@@ -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<Paginated<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 new Paginated(await SkyAPI.requestJSON('https://api.sky.blackbaud.com/school/v1/contentmanagement/photoalbums/list', 'POST', JSON.stringify(request), { 'Content-Type': 'application/json' }));
|
|
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.
|
|
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
|
-
"@
|
|
31
|
-
"@qui-cli
|
|
32
|
-
"@qui-cli/
|
|
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
|
|
42
|
-
"@qui-cli/plugin": "
|
|
42
|
+
"@oauth2-cli/qui-cli": "0.4.x",
|
|
43
|
+
"@qui-cli/plugin": ">=3"
|
|
43
44
|
},
|
|
44
45
|
"scripts": {
|
|
45
46
|
"clean": "del ./dist",
|