Clojure wrapper for the Google Classroom API (v1).
Provides idiomatic Clojure functions for managing courses, course rosters (Students, Teachers), course work, announcements, and course aliases.
Auth: use csl/scoped-delegated-credentials or csl/user-credentials with the appropriate scope:
All list functions return {:data [...] :next-page-token "..."}. :next-page-token is absent when there are no further pages.
Update semantics: functions named update-* use PATCH (partial update); functions named replace-* use PUT (full replacement). The Classroom API only exposes PUT for Courses — CourseWork and Announcements are PATCH-only, so no replace-* exists for those resources.
All functions return {:data ...} on success or {:error ...} on failure.
Clojure wrapper for the Google Classroom API (v1).
Provides idiomatic Clojure functions for managing courses, course rosters
(Students, Teachers), course work, announcements, and course aliases.
Auth: use csl/scoped-delegated-credentials or csl/user-credentials with the
appropriate scope:
- ClassroomScopes/CLASSROOM_COURSES (read/write courses)
- ClassroomScopes/CLASSROOM_COURSES_READONLY
- ClassroomScopes/CLASSROOM_ROSTERS (read/write rosters)
- ClassroomScopes/CLASSROOM_ROSTERS_READONLY
- ClassroomScopes/CLASSROOM_COURSEWORK_STUDENTS (read/write course work as teacher)
- ClassroomScopes/CLASSROOM_COURSEWORK_ME (read/write course work as student)
- ClassroomScopes/CLASSROOM_ANNOUNCEMENTS (read/write announcements)
- ClassroomScopes/CLASSROOM_ANNOUNCEMENTS_READONLY
- ClassroomScopes/CLASSROOM_PROFILE_EMAILS (read roster profile emails)
All list functions return {:data [...] :next-page-token "..."}.
:next-page-token is absent when there are no further pages.
Update semantics: functions named update-* use PATCH (partial update);
functions named replace-* use PUT (full replacement). The Classroom API
only exposes PUT for Courses — CourseWork and Announcements are PATCH-only,
so no replace-* exists for those resources.
All functions return {:data ...} on success or {:error ...} on failure.(classroom-client credentials)(classroom-client credentials opts)Build an authenticated Classroom v1 REST client.
credentials — a com.google.auth.oauth2.GoogleCredentials instance, typically from csl/scoped-delegated-credentials or csl/user-credentials.
opts (optional):
Per-request opts on individual call sites override the client-level defaults.
Build an authenticated Classroom v1 REST client. credentials — a com.google.auth.oauth2.GoogleCredentials instance, typically from csl/scoped-delegated-credentials or csl/user-credentials. opts (optional): - :read-timeout-ms per-client default read timeout (default 120000 / 120s) - :connect-timeout-ms per-client default connect timeout (default 30000 / 30s) Per-request opts on individual call sites override the client-level defaults.
(create-announcement client course-id announcement & [opts])Create an announcement on a course.
announcement — map with kebab-case keys. Required: :text — announcement body
Optional fields include :materials (vector of Material maps), :state ("PUBLISHED" default, or "DRAFT"), :scheduled-time.
opts:
Create an announcement on a course.
announcement — map with kebab-case keys. Required:
:text — announcement body
Optional fields include :materials (vector of Material maps),
:state ("PUBLISHED" default, or "DRAFT"), :scheduled-time.
opts:
- :fields — partial response field mask
- :read-timeout-ms — int, override the HTTP client's default read timeout(create-course client course & [opts])Create a new course.
course — map with kebab-case keys. Common fields: :name — required, the course name :section — optional section identifier :description — optional course description :room — optional room :owner-id — required, user ID of the course owner ("me" allowed)
opts:
Create a new course.
course — map with kebab-case keys. Common fields:
:name — required, the course name
:section — optional section identifier
:description — optional course description
:room — optional room
:owner-id — required, user ID of the course owner ("me" allowed)
opts:
- :fields — partial response field mask
- :read-timeout-ms — int, override the HTTP client's default read timeout(create-course-alias client course-id course-alias & [opts])Create an alias for a course.
course-alias — map with kebab-case keys. Required: :alias — alias string (must be prefixed with 'p:' for project-scoped, 'd:' for domain-scoped)
opts:
Create an alias for a course.
course-alias — map with kebab-case keys. Required:
:alias — alias string (must be prefixed with 'p:' for project-scoped,
'd:' for domain-scoped)
opts:
- :fields — partial response field mask
- :read-timeout-ms — int, override the HTTP client's default read timeout(create-course-work client course-id course-work & [opts])Create a course work item.
course-work — map with kebab-case keys. Common fields: :title — required :description — optional description / instructions :state — "PUBLISHED" (default) or "DRAFT" :work-type — "ASSIGNMENT" (default), "SHORT_ANSWER_QUESTION", "MULTIPLE_CHOICE_QUESTION" :due-date — {:year :month :day} (Date model) :due-time — {:hours :minutes :seconds :nanos} (TimeOfDay model) :materials — vector of Material maps (Drive files, links, YouTube videos) :max-points — numeric points for the assignment
opts:
Create a course work item.
course-work — map with kebab-case keys. Common fields:
:title — required
:description — optional description / instructions
:state — "PUBLISHED" (default) or "DRAFT"
:work-type — "ASSIGNMENT" (default), "SHORT_ANSWER_QUESTION",
"MULTIPLE_CHOICE_QUESTION"
:due-date — {:year :month :day} (Date model)
:due-time — {:hours :minutes :seconds :nanos} (TimeOfDay model)
:materials — vector of Material maps (Drive files, links, YouTube videos)
:max-points — numeric points for the assignment
opts:
- :fields — partial response field mask
- :read-timeout-ms — int, override the HTTP client's default read timeout(create-student client course-id student & [opts])Enroll a student in a course.
student — map with kebab-case keys. Required: :user-id — user ID of the student to enroll ("me" for the authenticated user)
opts:
Enroll a student in a course.
student — map with kebab-case keys. Required:
:user-id — user ID of the student to enroll ("me" for the authenticated user)
opts:
- :enrollment-code — course enrollment code (required when calling as a student
joining a course)
- :fields — partial response field mask
- :read-timeout-ms — int, override the HTTP client's default read timeout(create-teacher client course-id teacher & [opts])Add a teacher to a course.
teacher — map with kebab-case keys. Required: :user-id — user ID of the teacher
opts:
Add a teacher to a course. teacher — map with kebab-case keys. Required: :user-id — user ID of the teacher opts: - :fields — partial response field mask - :read-timeout-ms — int, override the HTTP client's default read timeout
(delete-announcement client course-id announcement-id & [opts])Delete an announcement.
opts:
Delete an announcement. opts: - :read-timeout-ms — int, override the HTTP client's default read timeout
(delete-course client course-id & [opts])Delete a course.
opts:
Delete a course. opts: - :read-timeout-ms — int, override the HTTP client's default read timeout
(delete-course-alias client course-id alias & [opts])Delete an alias for a course.
opts:
Delete an alias for a course. opts: - :read-timeout-ms — int, override the HTTP client's default read timeout
(delete-course-work client course-id course-work-id & [opts])Delete a course work item.
opts:
Delete a course work item. opts: - :read-timeout-ms — int, override the HTTP client's default read timeout
(delete-student client course-id user-id & [opts])Remove a student from a course.
opts:
Remove a student from a course. opts: - :read-timeout-ms — int, override the HTTP client's default read timeout
(delete-teacher client course-id user-id & [opts])Remove a teacher from a course.
opts:
Remove a teacher from a course. opts: - :read-timeout-ms — int, override the HTTP client's default read timeout
(get-announcement client course-id announcement-id & [opts])Get a single announcement.
opts:
Get a single announcement. opts: - :fields — partial response field mask - :read-timeout-ms — int, override the HTTP client's default read timeout
(get-course client course-id & [opts])Get a course by ID (or alias).
opts:
Get a course by ID (or alias). opts: - :fields — partial response field mask - :read-timeout-ms — int, override the HTTP client's default read timeout
(get-course-work client course-id course-work-id & [opts])Get a single course work item.
opts:
Get a single course work item. opts: - :fields — partial response field mask - :read-timeout-ms — int, override the HTTP client's default read timeout
(get-student client course-id user-id & [opts])Get a student enrollment.
user-id — student's user ID ("me" for the authenticated user)
opts:
Get a student enrollment.
user-id — student's user ID ("me" for the authenticated user)
opts:
- :fields — partial response field mask
- :read-timeout-ms — int, override the HTTP client's default read timeout(get-teacher client course-id user-id & [opts])Get a teacher's record in a course.
opts:
Get a teacher's record in a course. opts: - :fields — partial response field mask - :read-timeout-ms — int, override the HTTP client's default read timeout
(list-announcements client course-id & [opts])List announcements for a course.
opts:
List announcements for a course.
opts:
- :announcement-states — vector of state filters; keywords (:published, :draft,
:deleted) coerce to SCREAMING_SNAKE; strings pass through
- :order-by — sort expression (e.g. "updateTime desc")
- :page-token — token from a previous response
- :page-size — max items per page
- :fields — partial response field mask
- :read-timeout-ms — int, override the HTTP client's default read timeout(list-course-aliases client course-id & [opts])List aliases for a course. Aliases are alternative identifiers (e.g. a school district course number) that can be used in place of the numeric course ID.
opts:
List aliases for a course. Aliases are alternative identifiers (e.g. a school district course number) that can be used in place of the numeric course ID. opts: - :page-token — token from a previous response - :page-size — max aliases per page - :fields — partial response field mask - :read-timeout-ms — int, override the HTTP client's default read timeout
(list-course-work client course-id & [opts])List course work items for a course.
opts:
List course work items for a course.
opts:
- :course-work-states — vector of state filters; keywords (:published, :draft,
:deleted) coerce to SCREAMING_SNAKE; strings pass through
- :order-by — sort expression (e.g. "dueDate desc" or "updateTime")
- :page-token — token from a previous response
- :page-size — max items per page
- :fields — partial response field mask
- :read-timeout-ms — int, override the HTTP client's default read timeout(list-courses client & [opts])List courses visible to the authenticated user.
opts:
List courses visible to the authenticated user.
opts:
- :teacher-id — restrict to courses where this user is a teacher
- :student-id — restrict to courses where this user is a student
- :course-states — vector of state filters; keywords (:active, :archived,
:provisioned, :declined, :suspended) coerce to
SCREAMING_SNAKE; strings pass through
- :page-token — token from a previous response
- :page-size — max courses per page
- :fields — partial response field mask
- :read-timeout-ms — int, override the HTTP client's default read timeout(list-students client course-id & [opts])List students enrolled in a course.
opts:
List students enrolled in a course. opts: - :page-token — token from a previous response - :page-size — max students per page - :fields — partial response field mask - :read-timeout-ms — int, override the HTTP client's default read timeout
(list-teachers client course-id & [opts])List teachers of a course.
opts:
List teachers of a course. opts: - :page-token — token from a previous response - :page-size — max teachers per page - :fields — partial response field mask - :read-timeout-ms — int, override the HTTP client's default read timeout
(replace-course client course-id course & [opts])Fully replace a course (PUT semantics). The entire course resource is replaced with the provided data; omitted fields are cleared.
opts:
Fully replace a course (PUT semantics). The entire course resource is replaced with the provided data; omitted fields are cleared. opts: - :fields — partial response field mask - :read-timeout-ms — int, override the HTTP client's default read timeout
(update-announcement client course-id announcement-id announcement & [opts])Partially update an announcement (PATCH semantics). The Classroom API does not expose PUT for Announcement — there is no replace-announcement.
opts:
Partially update an announcement (PATCH semantics). The Classroom API does
not expose PUT for Announcement — there is no replace-announcement.
opts:
- :update-mask — comma-separated list of field paths to update
(allowed: text, state, scheduled_time)
- :fields — partial response field mask
- :read-timeout-ms — int, override the HTTP client's default read timeout(update-course client course-id course & [opts])Partially update a course (PATCH semantics). Only the fields listed in :update-mask (or, if omitted, the fields present in the course map) are modified.
opts:
Partially update a course (PATCH semantics). Only the fields listed in :update-mask (or, if omitted, the fields present in the course map) are modified. opts: - :update-mask — comma-separated list of field paths to update (FieldMask) - :fields — partial response field mask - :read-timeout-ms — int, override the HTTP client's default read timeout
(update-course-work client course-id course-work-id course-work & [opts])Partially update a course work item (PATCH semantics). The Classroom API does not expose PUT for CourseWork — there is no replace-course-work.
opts:
Partially update a course work item (PATCH semantics). The Classroom API
does not expose PUT for CourseWork — there is no replace-course-work.
opts:
- :update-mask — comma-separated list of field paths to update
(allowed: title, description, state, due_date, due_time,
max_points, scheduled_time, submission_modification_mode,
topic_id)
- :fields — partial response field mask
- :read-timeout-ms — int, override the HTTP client's default read timeoutcljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |