@oauth2-cli/sky-api 0.3.1 → 0.4.0
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 +23 -0
- package/dist/Module.d.ts +13 -0
- package/dist/Module.js +13 -0
- package/dist/Paginated.d.ts +3 -2
- package/dist/Paginated.js +1 -1
- package/dist/SkyAPI.d.ts +19 -2
- package/dist/SkyAPI.js +65 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -3
- package/dist/school/v1/academics/sections/assignments/assignmentsBySection.d.ts +2 -2
- package/dist/school/v1/academics/sections/assignments/assignmentsBySection.js +1 -1
- package/dist/school/v1/contentmanagement/announcements/index.d.ts +3 -4
- package/dist/school/v1/contentmanagement/announcements/index.js +2 -2
- package/dist/school/v1/contentmanagement/news/index.d.ts +3 -4
- package/dist/school/v1/contentmanagement/news/index.js +2 -2
- package/dist/school/v1/contentmanagement/photoalbums/index.d.ts +4 -6
- package/dist/school/v1/contentmanagement/photoalbums/index.js +2 -2
- package/package.json +8 -7
- package/dist/Client.d.ts +0 -15
- package/dist/Client.js +0 -56
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
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.4.0](https://github.com/groton-school/myschoolapp-reporting/compare/oauth2-cli/sky-api/0.3.2...oauth2-cli/sky-api/0.4.0) (2026-01-15)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
* pre-registered plugin is ESM module, updated option arg names
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* compile against Node.js v24 (current active version) ([dc67440](https://github.com/groton-school/myschoolapp-reporting/commit/dc6744054bc42139c4d17b1aca2ef9b057827f7f))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* pre-registered plugin is ESM module, updated option arg names ([50ff079](https://github.com/groton-school/myschoolapp-reporting/commit/50ff079a5849ccc30c41e86d7b1d72d340fe9b87))
|
|
20
|
+
|
|
21
|
+
## [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)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
* update to instance-based @oauth2-cli/qui-cli ([fae38fb](https://github.com/groton-school/myschoolapp-reporting/commit/fae38fbcd3e6361af6ac5d37cf9e29a339ce95da))
|
|
27
|
+
|
|
5
28
|
## [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
29
|
|
|
7
30
|
|
package/dist/Module.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SkyAPI } from './SkyAPI.js';
|
|
2
|
+
declare const sky: SkyAPI;
|
|
3
|
+
export declare const name: string;
|
|
4
|
+
export declare const configure: ({ subscription_key, subscriptionKeyEnvVar, ...proposal }?: import("./SkyAPI.js").ConfigurationProposal) => void;
|
|
5
|
+
export declare const options: () => import("@qui-cli/plugin").Options;
|
|
6
|
+
export declare const init: ({ values }: import("@qui-cli/plugin").ExpectedArguments<typeof this.options>) => Promise<void>;
|
|
7
|
+
export * as school from './school/index.js';
|
|
8
|
+
export declare const getToken: typeof sky.getToken;
|
|
9
|
+
export declare const getClient: typeof sky.getClient;
|
|
10
|
+
export declare const request: typeof sky.request;
|
|
11
|
+
export declare const requestJSON: typeof sky.requestJSON;
|
|
12
|
+
export declare const fetch: typeof sky.fetch;
|
|
13
|
+
export declare const fetchJSON: typeof sky.fetchJSON;
|
package/dist/Module.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SkyAPI } from './SkyAPI.js';
|
|
2
|
+
const sky = new SkyAPI();
|
|
3
|
+
export const name = sky.name;
|
|
4
|
+
export const configure = sky.configure.bind(sky);
|
|
5
|
+
export const options = sky.options.bind(sky);
|
|
6
|
+
export const init = sky.init.bind(sky);
|
|
7
|
+
export * as school from './school/index.js';
|
|
8
|
+
export const getToken = sky.getToken.bind(sky);
|
|
9
|
+
export const getClient = sky.getClient.bind(sky);
|
|
10
|
+
export const request = sky.request.bind(sky);
|
|
11
|
+
export const requestJSON = sky.requestJSON.bind(sky);
|
|
12
|
+
export const fetch = sky.fetch.bind(sky);
|
|
13
|
+
export const fetchJSON = sky.fetchJSON.bind(sky);
|
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
|
@@ -1,2 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as OAuth2 from '@oauth2-cli/qui-cli/dist/OAuth2.js';
|
|
2
|
+
import * as Plugin from '@qui-cli/plugin';
|
|
3
|
+
type SkyConfiguration = {
|
|
4
|
+
subscription_key?: string;
|
|
5
|
+
subscriptionKeyEnvVar: string;
|
|
6
|
+
};
|
|
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 SkyAPI 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/SkyAPI.js
CHANGED
|
@@ -1,2 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as OAuth2 from '@oauth2-cli/qui-cli/dist/OAuth2.js';
|
|
2
|
+
import { Colors } from '@qui-cli/colors';
|
|
3
|
+
import { Env } from '@qui-cli/env-1password';
|
|
4
|
+
export class SkyAPI 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
|
+
opt: {
|
|
14
|
+
clientId: 'skyClientId',
|
|
15
|
+
clientSecret: 'skyClientSecret',
|
|
16
|
+
redirectUri: 'skyRedirectUri'
|
|
17
|
+
},
|
|
18
|
+
env: {
|
|
19
|
+
clientId: 'SKY_CLIENT_ID',
|
|
20
|
+
clientSecret: 'SKY_CLIENT_SECRET',
|
|
21
|
+
redirectUri: 'SKY_REDIRECT_URI',
|
|
22
|
+
tokenPath: 'SKY_TOKEN_PATH',
|
|
23
|
+
accessToken: 'SKY_ACCESS_TOKEN'
|
|
24
|
+
},
|
|
25
|
+
man: { heading: 'Sky API options' },
|
|
26
|
+
suppress: {
|
|
27
|
+
authorizationEndpoint: true,
|
|
28
|
+
tokenEndpoint: true,
|
|
29
|
+
tokenPath: true,
|
|
30
|
+
accessToken: true
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
configure({ subscription_key, subscriptionKeyEnvVar, ...proposal } = {}) {
|
|
35
|
+
super.configure(proposal);
|
|
36
|
+
this.skyConfig.subscription_key =
|
|
37
|
+
subscription_key || this.skyConfig.subscription_key;
|
|
38
|
+
this.skyConfig.subscriptionKeyEnvVar =
|
|
39
|
+
subscriptionKeyEnvVar || this.skyConfig.subscriptionKeyEnvVar;
|
|
40
|
+
}
|
|
41
|
+
options() {
|
|
42
|
+
const options = super.options();
|
|
43
|
+
options.opt = {
|
|
44
|
+
...options.opt,
|
|
45
|
+
subscriptionKey: {
|
|
46
|
+
description: `Blackbaud subscription access key; will use environment ` +
|
|
47
|
+
`variable ${Colors.varName(this.skyConfig.subscriptionKeyEnvVar)} ` +
|
|
48
|
+
`if present`,
|
|
49
|
+
secret: true,
|
|
50
|
+
default: this.skyConfig.subscription_key
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return options;
|
|
54
|
+
}
|
|
55
|
+
async init({ values }) {
|
|
56
|
+
const { subscriptionKey: subscription_key = await Env.get({
|
|
57
|
+
key: this.skyConfig.subscriptionKeyEnvVar
|
|
58
|
+
}) } = values;
|
|
59
|
+
this.configure({
|
|
60
|
+
subscription_key,
|
|
61
|
+
...values,
|
|
62
|
+
headers: { 'Bb-Api-Subscription-Key': this.skyConfig.subscription_key }
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import * as SkyAPI from './Module.js';
|
|
2
|
+
export { SkyAPI };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { register } from '@qui-cli/plugin';
|
|
2
|
-
import * as
|
|
3
|
-
export
|
|
4
|
-
await register(
|
|
2
|
+
import * as SkyAPI from './Module.js';
|
|
3
|
+
export { SkyAPI };
|
|
4
|
+
await register(SkyAPI);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import * as SkyAPI from '../../../../../Module.js';
|
|
1
2
|
import { Paginated } from '../../../../../Paginated.js';
|
|
2
|
-
import { Assignment } from './Assignment.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,5 +1,5 @@
|
|
|
1
1
|
import { buildQuery } from '../../../../../buildQuery.js';
|
|
2
|
-
import * as SkyAPI from '../../../../../
|
|
2
|
+
import * as SkyAPI from '../../../../../Module.js';
|
|
3
3
|
import { Paginated } from '../../../../../Paginated.js';
|
|
4
4
|
export async function assignmentsBySection(section_id, params = {}) {
|
|
5
5
|
return new Paginated(await SkyAPI.requestJSON(`https://api.sky.blackbaud.com/school/v1/academics/sections/${section_id}/assignments?${buildQuery(params)}`));
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import * as SkyAPI from '../../../../Module.js';
|
|
1
2
|
import { Paginated } from '../../../../Paginated.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,4 +1,4 @@
|
|
|
1
|
-
import * as SkyAPI from '../../../../
|
|
1
|
+
import * as SkyAPI from '../../../../Module.js';
|
|
2
2
|
import { Paginated } from '../../../../Paginated.js';
|
|
3
3
|
export * from './ContentAnnouncement.js';
|
|
4
4
|
export * from './ContentAnnouncementCategory.js';
|
|
@@ -7,5 +7,5 @@ export async function categories() {
|
|
|
7
7
|
return new Paginated(await SkyAPI.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.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
|
+
import * as SkyAPI from '../../../../Module.js';
|
|
1
2
|
import { Paginated } from '../../../../Paginated.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,4 +1,4 @@
|
|
|
1
|
-
import * as SkyAPI from '../../../../
|
|
1
|
+
import * as SkyAPI from '../../../../Module.js';
|
|
2
2
|
import { Paginated } from '../../../../Paginated.js';
|
|
3
3
|
export * from './NewsCategory.js';
|
|
4
4
|
export * from './NewsCategoryCollection.js';
|
|
@@ -7,5 +7,5 @@ export async function categories() {
|
|
|
7
7
|
return new Paginated(await SkyAPI.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.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
|
+
import * as SkyAPI from '../../../../Module.js';
|
|
1
2
|
import { Paginated } from '../../../../Paginated.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,4 +1,4 @@
|
|
|
1
|
-
import * as SkyAPI from '../../../../
|
|
1
|
+
import * as SkyAPI from '../../../../Module.js';
|
|
2
2
|
import { Paginated } from '../../../../Paginated.js';
|
|
3
3
|
export * from './ImageDimension.js';
|
|
4
4
|
export * from './ImageSettings.js';
|
|
@@ -11,7 +11,7 @@ export async function categories() {
|
|
|
11
11
|
return new Paginated(await SkyAPI.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.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
17
|
return new Paginated(await SkyAPI.requestJSON(`https://api.sky.blackbaud.com/school/v1/contentmanagement/photoalbums/${album_id}`));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oauth2-cli/sky-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"blackbaud",
|
|
6
6
|
"sky",
|
|
@@ -27,19 +27,20 @@
|
|
|
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.5.0",
|
|
32
|
+
"@qui-cli/colors": "^3.2.1",
|
|
33
|
+
"@qui-cli/env-1password": "^1.2.6",
|
|
33
34
|
"@qui-cli/plugin": "^4.0.0",
|
|
34
|
-
"@tsconfig/
|
|
35
|
+
"@tsconfig/node24": "^24.0.3",
|
|
35
36
|
"commit-and-tag-version": "^12.6.1",
|
|
36
37
|
"del-cli": "^6.0.0",
|
|
37
38
|
"npm-run-all": "^4.1.5",
|
|
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.5",
|
|
43
|
+
"@qui-cli/plugin": ">=3"
|
|
43
44
|
},
|
|
44
45
|
"scripts": {
|
|
45
46
|
"clean": "del ./dist",
|
package/dist/Client.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { OAuth2 } from '@oauth2-cli/qui-cli-plugin';
|
|
2
|
-
import * as Plugin from '@qui-cli/plugin';
|
|
3
|
-
export type Configuration = Plugin.Configuration & {
|
|
4
|
-
subscription_key?: string;
|
|
5
|
-
subscriptionKeyEnvVar: string;
|
|
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;
|
package/dist/Client.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { OAuth2 } from '@oauth2-cli/qui-cli-plugin';
|
|
2
|
-
import { Colors } from '@qui-cli/colors';
|
|
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
|
|
19
|
-
}
|
|
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
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export function options() {
|
|
33
|
-
return {
|
|
34
|
-
opt: {
|
|
35
|
-
subscriptionKey: {
|
|
36
|
-
description: `Blackbaud subscription access key; will use environment variable ${Colors.varName(config.subscriptionKeyEnvVar)} if present`,
|
|
37
|
-
secret: true,
|
|
38
|
-
default: config.subscription_key
|
|
39
|
-
}
|
|
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
|
-
});
|
|
51
|
-
}
|
|
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;
|