diff --git a/package.json b/package.json index 3096dd7..20a8aef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@themoment-team/datagsm-openapi", - "version": "1.0.0", + "version": "1.1.0", "description": "Official JavaScript/TypeScript SDK for DataGSM OpenAPI", "license": "MIT", "author": "themoment-team", diff --git a/src/domains/clubs.ts b/src/domains/clubs.ts index 2449f46..8f4830b 100644 --- a/src/domains/clubs.ts +++ b/src/domains/clubs.ts @@ -12,6 +12,8 @@ export class ClubsApi { clubId: request.clubId, clubName: request.clubName, clubType: request.clubType, + clubStatus: request.clubStatus, + foundedYear: request.foundedYear, page: request.page, size: request.size, includeLeaderInParticipants: request.includeLeaderInParticipants, diff --git a/src/domains/students.ts b/src/domains/students.ts index 370f6a6..eccb537 100644 --- a/src/domains/students.ts +++ b/src/domains/students.ts @@ -19,6 +19,8 @@ export class StudentsApi { role: request.role, dormitoryRoom: request.dormitoryRoom, includeGraduates: request.includeGraduates, + includeWithdrawn: request.includeWithdrawn, + onlyEnrolled: request.onlyEnrolled, page: request.page, size: request.size, sortBy: request.sortBy, diff --git a/src/index.ts b/src/index.ts index 51f3ff7..4730952 100644 --- a/src/index.ts +++ b/src/index.ts @@ -32,7 +32,13 @@ export type { GetStudentsResponse, } from './types/students'; -export type { Club, ClubSortBy, GetClubsRequest, GetClubsResponse } from './types/clubs'; +export type { + Club, + ClubSortBy, + ClubStatus, + GetClubsRequest, + GetClubsResponse, +} from './types/clubs'; export type { Project, diff --git a/src/types/clubs.ts b/src/types/clubs.ts index 62c64ce..08b2edd 100644 --- a/src/types/clubs.ts +++ b/src/types/clubs.ts @@ -1,19 +1,25 @@ -import type { ClubType, ParticipantInfo, SortDirection } from './index'; +import type { ApiResponse, ClubType, ParticipantInfo, SortDirection } from './index'; -export type ClubSortBy = 'ID' | 'NAME' | 'TYPE'; +export type ClubStatus = 'ACTIVE' | 'ABOLISHED'; +export type ClubSortBy = 'ID' | 'NAME' | 'TYPE' | 'FOUNDED_YEAR' | 'STATUS'; export interface Club { id: number; name: string; type: ClubType; - leader: ParticipantInfo; + leader?: ParticipantInfo; participants: ParticipantInfo[]; + foundedYear: number; + status: ClubStatus; + abolishedYear?: number; } export interface GetClubsRequest { clubId?: number; clubName?: string; clubType?: ClubType; + clubStatus?: ClubStatus; + foundedYear?: number; page?: number; size?: number; includeLeaderInParticipants?: boolean; @@ -21,13 +27,8 @@ export interface GetClubsRequest { sortDirection?: SortDirection; } -export interface GetClubsResponse { - status: string; - code: number; - message: string; - data: { - totalPages: number; - totalElements: number; - clubs: Club[]; - }; -} +export type GetClubsResponse = ApiResponse<{ + totalPages: number; + totalElements: number; + clubs: Club[]; +}>; diff --git a/src/types/health.ts b/src/types/health.ts index c12903d..c5969bb 100644 --- a/src/types/health.ts +++ b/src/types/health.ts @@ -1,5 +1,3 @@ -export interface HealthCheckResponse { - status: string; - code: number; - message: string; -} +import type { ApiResponse } from './index'; + +export type HealthCheckResponse = Omit, 'data'>; diff --git a/src/types/index.ts b/src/types/index.ts index d0ab67b..da9a9ff 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,7 +1,7 @@ export type SortDirection = 'ASC' | 'DESC'; export type Sex = 'MAN' | 'WOMAN'; export type Major = 'SW_DEVELOPMENT' | 'SMART_IOT' | 'AI'; -export type ClubType = 'MAJOR_CLUB' | 'JOB_CLUB' | 'AUTONOMOUS_CLUB'; +export type ClubType = 'MAJOR_CLUB' | 'AUTONOMOUS_CLUB'; export interface ClubSummary { id: number; diff --git a/src/types/neis.ts b/src/types/neis.ts index a2a4cdb..4693726 100644 --- a/src/types/neis.ts +++ b/src/types/neis.ts @@ -1,3 +1,5 @@ +import type { ApiResponse } from './index'; + export type MealType = 'BREAKFAST' | 'LUNCH' | 'DINNER'; export interface Meal { @@ -22,12 +24,7 @@ export interface GetMealsRequest { toDate?: string; } -export interface GetMealsResponse { - status: string; - code: number; - message: string; - data: Meal[]; -} +export type GetMealsResponse = ApiResponse; export interface Schedule { scheduleId: string; @@ -51,9 +48,4 @@ export interface GetSchedulesRequest { toDate?: string; } -export interface GetSchedulesResponse { - status: string; - code: number; - message: string; - data: Schedule[]; -} +export type GetSchedulesResponse = ApiResponse; diff --git a/src/types/projects.ts b/src/types/projects.ts index e59e930..8d55d09 100644 --- a/src/types/projects.ts +++ b/src/types/projects.ts @@ -1,4 +1,4 @@ -import type { ClubSummary, ParticipantInfo, SortDirection } from './index'; +import type { ApiResponse, ClubSummary, ParticipantInfo, SortDirection } from './index'; export type ProjectSortBy = 'ID' | 'NAME'; @@ -20,13 +20,8 @@ export interface GetProjectsRequest { sortDirection?: SortDirection; } -export interface GetProjectsResponse { - status: string; - code: number; - message: string; - data: { - totalPages: number; - totalElements: number; - projects: Project[]; - }; -} +export type GetProjectsResponse = ApiResponse<{ + totalPages: number; + totalElements: number; + projects: Project[]; +}>; diff --git a/src/types/students.ts b/src/types/students.ts index f6b5796..e506058 100644 --- a/src/types/students.ts +++ b/src/types/students.ts @@ -1,4 +1,4 @@ -import type { Sex, Major, ClubSummary, SortDirection } from './index'; +import type { ApiResponse, ClubSummary, Major, Sex, SortDirection } from './index'; export type Role = | 'STUDENT_COUNCIL' @@ -24,17 +24,19 @@ export interface Student { name: string; sex: Sex; email: string; - grade: number; - classNum: number; - number: number; - studentNumber: number; - major: Major; + grade?: number; + classNum?: number; + number?: number; + studentNumber?: number; + major?: Major; + specialty?: string; role: Role; - dormitoryFloor: number; - dormitoryRoom: number; + dormitoryFloor?: number; + dormitoryRoom?: number; majorClub?: ClubSummary; - jobClub?: ClubSummary; autonomousClub?: ClubSummary; + githubId?: string; + githubUrl?: string; } export interface GetStudentsRequest { @@ -48,19 +50,16 @@ export interface GetStudentsRequest { role?: Role; dormitoryRoom?: number; includeGraduates?: boolean; + includeWithdrawn?: boolean; + onlyEnrolled?: boolean; page?: number; size?: number; sortBy?: SortBy; sortDirection?: SortDirection; } -export interface GetStudentsResponse { - status: string; - code: number; - message: string; - data: { - totalPages: number; - totalElements: number; - students: Student[]; - }; -} +export type GetStudentsResponse = ApiResponse<{ + totalPages: number; + totalElements: number; + students: Student[]; +}>;