Skip to content

Commit

Permalink
schoolinfo API
Browse files Browse the repository at this point in the history
  • Loading branch information
Seth Battis committed Dec 26, 2024
1 parent e519cf4 commit 397487a
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/datadirect-puppeteer/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export * as assessment from './api/assessment.js';
export * as Assignment2 from './api/Assignment2.js';
export * as datadirect from './api/datadirect.js';
export * as LtiTool from './api/LtiTool.js';
export * as schoolinfo from './api/schoolinfo.js';
4 changes: 4 additions & 0 deletions packages/datadirect-puppeteer/src/api/schoolinfo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { schoolparams as S } from 'datadirect/dist/api/schoolinfo.js';
import { fetchViaPuppeteer } from './fetchViaPuppeteer.js';

export const schoolparams = fetchViaPuppeteer<S.Payload, S.Response>(S);
1 change: 1 addition & 0 deletions packages/datadirect/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export * as Assignment2 from './api/Assignment2.js';
export * as datadirect from './api/datadirect.js';
export * as Endpoint from './api/Endpoint.js';
export * as LtiTool from './api/LtiTool.js';
export * as schoolinfo from './api/schoolinfo.js';
1 change: 1 addition & 0 deletions packages/datadirect/src/api/schoolinfo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * as schoolparams from './schoolinfo/schoolparams.js';
8 changes: 8 additions & 0 deletions packages/datadirect/src/api/schoolinfo/schoolparams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import * as Endpoint from '../Endpoint.js';
import { Payload } from './schoolparams/Payload.js';

export * from './schoolparams/Payload.js';
export * from './schoolparams/Response.js';

export const prepare: Endpoint.Prepare<Payload> = (payload, base?: string) =>
Endpoint.prepare({ payload, base, path: '/api/schoolinfo/schoolparams' });
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type Payload = { all?: boolean };
42 changes: 42 additions & 0 deletions packages/datadirect/src/api/schoolinfo/schoolparams/Response.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
export type Response = {
SchoolId: number;
SchoolName: string;
HoursFromServer: number;
AppLocaleId: number;
LocaleId: number;
Timezone: string;
DatabaseTimezone: string;
LiveUrl: URLString;
Username: string;
PortalMyBeforeSchool: boolean;
PortalDisplayLabel: string;
MailboxName: EmailString;
HelplinkText: string;
SignInOption: number;
LocalDateTime: DateTimeString;
ServerDateTime: DateTimeString;
IndividualMessageEnabled: boolean;
BulkMessageEnabled: boolean;
BulkEmailEnabled: boolean;
HasPodiumSite: boolean;
PodiumFrontendStatus: 2;
NameFormat: string;
ShowFeaturedContent: NumericBoolean;
ShowRecentActivity: NumericBoolean;
ShowScoreboard: NumericBoolean;
ShowArchivedContent: NumericBoolean;
AppCultureName: string;
CultureName: string;
EncCookieSiteUrl: string;
ShowAttendance: NumericBoolean;
BBSiteID: NumericString;
AllowRubricBankAdd: boolean;
IsSmallCollege: boolean;
MobileSiteInd: boolean;
SSLInd: boolean;
LoginRedirectInd: boolean;
LoginNameLabel: string;
DbNum: number;
DbDate: DateTimeString;
TestSchool: boolean;
};
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ export class Spider {
exclude,
haltOnError
});
/*
* FIXME FileName files in topics are at /ftpimages/:SchoolId/topics/:FileName
* :SchoolId can be determined by calling `/api/schoolinfo/schoolparams`
*/
} else if (
/Url$/i.test(key) ||
(/FilePath$/i.test(key) &&
Expand Down

0 comments on commit 397487a

Please sign in to comment.