Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update operations #46

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
.DS_Store
node_modules
dist
playground.js
playground.ts
example-responses/*
15 changes: 9 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class KhanApi {
operationName: "loginWithPasswordMutation",
variables: { identifier, password },
query:
"mutation loginWithPasswordMutation($identifier: String!, $password: String!) {\n loginWithPassword(identifier: $identifier, password: $password) {\n user {\n id\n kaid\n canAccessDistrictsHomepage\n isTeacher\n hasUnresolvedInvitations\n transferAuthToken\n preferredKaLocale {\n id\n kaLocale\n status\n __typename\n }\n __typename\n }\n isFirstLogin\n error {\n code\n __typename\n }\n __typename\n }\n}\n",
"mutation loginWithPasswordMutation($identifier: String!, $password: String!) {\n loginWithPassword(identifier: $identifier, password: $password) {\n user {\n id\n kaid\n canAccessDistrictsHomepage\n isTeacher\n hasUnresolvedInvitations\n preferredKaLocale {\n id\n kaLocale\n status\n __typename\n }\n __typename\n }\n isFirstLogin\n error {\n code\n __typename\n }\n __typename\n }\n}",
}

let url = `${BASE_URL}/api/internal/graphql/loginWithPasswordMutation`
Expand Down Expand Up @@ -145,20 +145,23 @@ export class KhanApi {
}

ProgressByStudent = async (
classId: string,
classDescriptor: string,
pageSize = 1000,
after = null
) => {
let payload = {
operationName: "ProgressByStudent",
variables: {
classId,
assignmentFilters: { dueAfter: null, dueBefore: null },
classDescriptor,
assignmentFilters: {
dueAfter: null,
dueBefore: null,
},
after,
pageSize,
},
query:
"query ProgressByStudent($assignmentFilters: CoachAssignmentFilters, $classId: String!, $pageSize: Int, $after: ID) {\n coach {\n id\n studentList(id: $classId) {\n id\n cacheId\n studentKaidsAndNicknames {\n id\n coachNickname\n __typename\n }\n assignmentsPage(filters: $assignmentFilters, after: $after, pageSize: $pageSize) {\n assignments {\n id\n dueDate\n contents {\n id\n translatedTitle\n kind\n defaultUrlPath\n __typename\n }\n itemCompletionStates: itemCompletionStatesForAllStudents {\n completedOn\n studentKaid\n bestScore {\n numAttempted\n numCorrect\n __typename\n }\n __typename\n }\n __typename\n }\n pageInfo {\n nextCursor\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n }\n}\n",
"query ProgressByStudent($assignmentFilters: CoachAssignmentFilters, $classDescriptor: String!, $pageSize: Int, $after: ID) {\n classroom: classroomByDescriptor(descriptor: $classDescriptor) {\n id\n cacheId\n descriptor\n name\n studentKaidsAndNicknames {\n id\n coachNickname\n __typename\n }\n assignmentsPage(filters: $assignmentFilters, after: $after, pageSize: $pageSize) {\n assignments {\n id\n title\n dueDate\n contents {\n id\n translatedTitle\n kind\n defaultUrlPath\n __typename\n }\n itemCompletionStates: itemCompletionStatesForAllStudents {\n completedOn\n studentKaid\n bestScore {\n numAttempted\n numCorrect\n __typename\n }\n activitySubmissions {\n threadID\n thread {\n id\n flagged\n lastUpdatedAt\n interactions {\n id\n answer\n question\n __typename\n }\n __typename\n }\n __typename\n }\n student {\n id\n kaid\n profileRoot\n __typename\n }\n __typename\n }\n __typename\n }\n pageInfo {\n nextCursor\n __typename\n }\n __typename\n }\n __typename\n }\n}",
}

return this.graphQL("/ProgressByStudent", payload)
Expand Down Expand Up @@ -191,7 +194,7 @@ export class KhanApi {
getClassroomRoster = async ({
classId,
teacherKaid,
pageSize = 40
pageSize = 40,
}: {
classId: string
teacherKaid: string
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
// error out if import and file system have a casing mismatch. Recommended by TS
"forceConsistentCasingInFileNames": true,
// `tsdx build` ignores this option, but it is commonly used when type-checking separately with `tsc`
"noEmit": true,
"noEmit": true
}
}
Loading