Skip to content

Instantly share code, notes, and snippets.

@jasonappah
Created February 27, 2023 21:35
Show Gist options
  • Save jasonappah/84111fed1cd5c6aa82469a42bae22d42 to your computer and use it in GitHub Desktop.
Save jasonappah/84111fed1cd5c6aa82469a42bae22d42 to your computer and use it in GitHub Desktop.
Nebula Labs Degree API Types (TypeScript)
enum RequirementTypes {
collection = "collection",
course = "course",
section = "section",
major = "major",
minor = "minor",
exam = "exam",
gpa = "gpa",
hours = "hours",
consent = "consent",
limit = "limit",
core = "core",
other = "other",
}
type CourseRequirement = {
type: RequirementTypes.course;
class_reference: string;
minimum_grade: string;
};
type SectionRequirement = {
type: RequirementTypes.section;
section_reference: string;
};
type MajorRequirement = {
type: RequirementTypes.major;
major: string;
};
type MinorRequirement = {
type: RequirementTypes.minor;
minor: string;
};
type ExamRequirement = {
type: RequirementTypes.exam;
exam_reference: string;
minimum_score: number;
};
type GPARequirement = {
type: RequirementTypes.gpa;
minimum: number;
subset: string;
};
type HoursRequirement = {
type: RequirementTypes.hours;
required: number;
options: CourseRequirement[];
};
type LimitRequirement = {
type: RequirementTypes.limit;
max_hours: number;
};
type ConsentRequirement = {
type: RequirementTypes.consent;
granter: string;
};
type CoreRequirement = {
type: RequirementTypes.core;
core_flag: "010" | "020" | "030" | "040" | "050" | "060" | "070" | "080" | "090";
hours: number;
};
type OtherRequirement = {
type: RequirementTypes.other;
description: string;
condition: string;
};
type CollectionRequirement = {
type: RequirementTypes.collection;
name: string;
required: number;
options: (
| CourseRequirement
| SectionRequirement
| MajorRequirement
| MinorRequirement
| ExamRequirement
| GPARequirement
| HoursRequirement
| LimitRequirement
| ConsentRequirement
| CoreRequirement
| OtherRequirement
| CollectionRequirement
)[];
};
type Degree = {
_id: string;
subtype: string;
school: string;
name: string;
year: string;
abbreviation: string;
minimum_credit_hours: number;
catalog_uri: string;
requirements: CollectionRequirement;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment