Skip to main content

Course

Struct Course 

Source
pub struct Course {
Show 22 fields pub id: u64, pub name: Option<String>, pub course_code: Option<String>, pub workflow_state: Option<WorkflowState>, pub account_id: Option<u64>, pub root_account_id: Option<u64>, pub enrollment_term_id: Option<u64>, pub sis_course_id: Option<String>, pub start_at: Option<DateTime<Utc>>, pub end_at: Option<DateTime<Utc>>, pub grading_standard_id: Option<u64>, pub is_public: Option<bool>, pub license: Option<String>, pub locale: Option<String>, pub time_zone: Option<String>, pub total_students: Option<u64>, pub default_view: Option<String>, pub syllabus_body: Option<String>, pub public_description: Option<String>, pub hide_final_grades: Option<bool>, pub apply_assignment_group_weights: Option<bool>, pub restrict_enrollments_to_course_dates: Option<bool>, /* private fields */
}

Fields§

§id: u64§name: Option<String>§course_code: Option<String>§workflow_state: Option<WorkflowState>§account_id: Option<u64>§root_account_id: Option<u64>§enrollment_term_id: Option<u64>§sis_course_id: Option<String>§start_at: Option<DateTime<Utc>>§end_at: Option<DateTime<Utc>>§grading_standard_id: Option<u64>§is_public: Option<bool>§license: Option<String>§locale: Option<String>§time_zone: Option<String>§total_students: Option<u64>§default_view: Option<String>§syllabus_body: Option<String>§public_description: Option<String>§hide_final_grades: Option<bool>§apply_assignment_group_weights: Option<bool>§restrict_enrollments_to_course_dates: Option<bool>

Implementations§

Source§

impl Course

Source

pub fn get_assignments(&self) -> PageStream<Assignment>

Stream all assignments in this course.

§Canvas API

GET /api/v1/courses/:course_id/assignments

Source

pub async fn get_assignment(&self, assignment_id: u64) -> Result<Assignment>

Fetch a single assignment.

§Canvas API

GET /api/v1/courses/:course_id/assignments/:id

Source

pub async fn create_assignment( &self, params: CreateAssignmentParams, ) -> Result<Assignment>

Create a new assignment in this course.

§Canvas API

POST /api/v1/courses/:id/assignments

Source

pub fn get_sections(&self) -> PageStream<Section>

Stream all sections in this course.

§Canvas API

GET /api/v1/courses/:course_id/sections

Source

pub async fn get_section(&self, section_id: u64) -> Result<Section>

Fetch a single section by ID.

§Canvas API

GET /api/v1/courses/:id/sections/:section_id

Source

pub fn get_enrollments(&self) -> PageStream<Enrollment>

Stream all enrollments in this course.

§Canvas API

GET /api/v1/courses/:course_id/enrollments

Source

pub fn get_users(&self) -> PageStream<User>

Stream all users in this course.

§Canvas API

GET /api/v1/courses/:course_id/users

Source

pub async fn update(&self, params: UpdateCourseParams) -> Result<Course>

Update this course.

§Canvas API

PUT /api/v1/courses/:id

Source

pub async fn delete(&self) -> Result<Course>

Delete this course. Canvas returns the deleted course object.

§Canvas API

DELETE /api/v1/courses/:id

Source

pub fn get_quizzes(&self) -> PageStream<Quiz>

Stream all quizzes in this course.

§Canvas API

GET /api/v1/courses/:id/quizzes

Source

pub async fn get_quiz(&self, quiz_id: u64) -> Result<Quiz>

Fetch a single quiz.

§Canvas API

GET /api/v1/courses/:id/quizzes/:quiz_id

Source

pub async fn create_quiz(&self, params: CreateQuizParams) -> Result<Quiz>

Create a new quiz in this course.

§Canvas API

POST /api/v1/courses/:id/quizzes

Source

pub fn get_modules(&self) -> PageStream<Module>

Stream all modules in this course.

§Canvas API

GET /api/v1/courses/:id/modules

Source

pub async fn get_module(&self, module_id: u64) -> Result<Module>

Fetch a single module.

§Canvas API

GET /api/v1/courses/:id/modules/:module_id

Source

pub fn get_pages(&self) -> PageStream<Page>

Stream all pages in this course.

§Canvas API

GET /api/v1/courses/:id/pages

Source

pub async fn get_page(&self, url_or_id: &str) -> Result<Page>

Fetch a single page by URL slug or ID.

§Canvas API

GET /api/v1/courses/:id/pages/:url_or_id

Source

pub fn get_discussion_topics(&self) -> PageStream<DiscussionTopic>

Stream all discussion topics in this course.

§Canvas API

GET /api/v1/courses/:id/discussion_topics

Source

pub async fn get_discussion_topic( &self, topic_id: u64, ) -> Result<DiscussionTopic>

Fetch a single discussion topic.

§Canvas API

GET /api/v1/courses/:id/discussion_topics/:topic_id

Source

pub fn get_files(&self) -> PageStream<File>

Stream all files in this course.

§Canvas API

GET /api/v1/courses/:id/files

Source

pub fn get_tabs(&self) -> PageStream<Tab>

Stream all tabs in this course.

§Canvas API

GET /api/v1/courses/:id/tabs

Source

pub fn get_collaborations(&self) -> PageStream<Collaboration>

Stream all collaborations in this course.

§Canvas API

GET /api/v1/courses/:id/collaborations

Source

pub fn get_groups(&self) -> PageStream<Group>

Stream all groups in this course.

§Canvas API

GET /api/v1/courses/:id/groups

Source

pub async fn upload_file( &self, request: UploadRequest, data: Vec<u8>, ) -> Result<File>

Upload a file to this course.

Canvas uses a two-step upload: first POSTing metadata to obtain an upload URL, then POSTing the file as multipart form data to that URL.

§Canvas API

POST /api/v1/courses/:id/files

Source

pub async fn get_external_tool(&self, tool_id: u64) -> Result<ExternalTool>

Fetch a single external tool by ID.

§Canvas API

GET /api/v1/courses/:course_id/external_tools/:id

Source

pub fn get_external_tools(&self) -> PageStream<ExternalTool>

Stream all external tools for this course.

§Canvas API

GET /api/v1/courses/:course_id/external_tools

Source

pub async fn create_external_tool( &self, params: ExternalToolParams, ) -> Result<ExternalTool>

Create an external tool on this course.

§Canvas API

POST /api/v1/courses/:course_id/external_tools

Source

pub async fn get_rubric(&self, rubric_id: u64) -> Result<Rubric>

Fetch a single rubric by ID.

§Canvas API

GET /api/v1/courses/:course_id/rubrics/:id

Source

pub fn get_rubrics(&self) -> PageStream<Rubric>

Stream all rubrics for this course.

§Canvas API

GET /api/v1/courses/:course_id/rubrics

Source

pub async fn create_rubric(&self, params: RubricParams) -> Result<Rubric>

Create a rubric in this course.

§Canvas API

POST /api/v1/courses/:course_id/rubrics

Source

pub async fn get_rubric_association( &self, association_id: u64, ) -> Result<RubricAssociation>

Fetch a single rubric association by ID.

§Canvas API

GET /api/v1/courses/:course_id/rubric_associations/:id

Source

pub fn get_rubric_associations(&self) -> PageStream<RubricAssociation>

Stream all rubric associations for this course.

§Canvas API

GET /api/v1/courses/:course_id/rubric_associations

Source

pub async fn get_blueprint( &self, template_id: &str, ) -> Result<BlueprintTemplate>

Fetch the blueprint template for this course.

template_id is typically "default" or a numeric ID.

§Canvas API

GET /api/v1/courses/:course_id/blueprint_templates/:template_id

Source

pub fn get_blueprint_subscriptions(&self) -> PageStream<BlueprintSubscription>

Stream blueprint subscriptions for this (child) course.

§Canvas API

GET /api/v1/courses/:course_id/blueprint_subscriptions

Source

pub async fn get_content_migration( &self, migration_id: u64, ) -> Result<ContentMigration>

Fetch a single content migration by ID.

§Canvas API

GET /api/v1/courses/:course_id/content_migrations/:id

Source

pub fn get_content_migrations(&self) -> PageStream<ContentMigration>

Stream all content migrations for this course.

§Canvas API

GET /api/v1/courses/:course_id/content_migrations

Source

pub async fn create_content_migration( &self, migration_type: &str, params: &[(String, String)], ) -> Result<ContentMigration>

Create a content migration for this course.

§Canvas API

POST /api/v1/courses/:course_id/content_migrations

Source

pub fn get_migrators(&self) -> PageStream<Migrator>

Stream available content migration types for this course.

§Canvas API

GET /api/v1/courses/:course_id/content_migrations/migrators

Stream all outcome group links for this course.

§Canvas API

GET /api/v1/courses/:course_id/outcome_group_links

Source

pub async fn get_outcome_group(&self, group_id: u64) -> Result<OutcomeGroup>

Fetch a single outcome group by ID.

§Canvas API

GET /api/v1/courses/:course_id/outcome_groups/:id

Source

pub async fn create_outcome_group( &self, params: UpdateOutcomeGroupParams, ) -> Result<OutcomeGroup>

Create a top-level outcome group on this course.

§Canvas API

POST /api/v1/courses/:course_id/outcome_groups

Source

pub fn get_gradebook_history_dates(&self) -> PageStream<Day>

Stream the days for which there is gradebook history in this course.

§Canvas API

GET /api/v1/courses/:course_id/gradebook_history/days

Source

pub fn get_gradebook_history_details(&self, date: &str) -> PageStream<Grader>

Stream graders who worked in this course on a given date.

date should be formatted as YYYY-MM-DD.

§Canvas API

GET /api/v1/courses/:course_id/gradebook_history/:date

Source

pub fn get_submission_history( &self, date: &str, grader_id: u64, assignment_id: u64, ) -> PageStream<SubmissionHistory>

Stream submission versions graded by a specific grader on a specific assignment and date.

§Canvas API

GET /api/v1/courses/:course_id/gradebook_history/:date/graders/:grader_id/assignments/:assignment_id/submissions

Source

pub fn get_uncollated_submissions(&self) -> PageStream<SubmissionVersion>

Stream all submission versions (uncollated) for this course.

§Canvas API

GET /api/v1/courses/:course_id/gradebook_history/feed

Source

pub fn get_grading_periods(&self) -> PageStream<GradingPeriod>

Stream all grading periods for this course.

§Canvas API

GET /api/v1/courses/:course_id/grading_periods

Source

pub fn get_grading_standards(&self) -> PageStream<GradingStandard>

Stream all grading standards for this course.

§Canvas API

GET /api/v1/courses/:course_id/grading_standards

Source

pub async fn create_grading_standard( &self, params: GradingStandardParams, ) -> Result<GradingStandard>

Create a grading standard for this course.

§Canvas API

POST /api/v1/courses/:course_id/grading_standards

Source

pub async fn get_content_export(&self, export_id: u64) -> Result<ContentExport>

Fetch a single content export by ID.

§Canvas API

GET /api/v1/courses/:course_id/content_exports/:id

Source

pub fn get_content_exports(&self) -> PageStream<ContentExport>

Stream all content exports for this course.

§Canvas API

GET /api/v1/courses/:course_id/content_exports

Source

pub async fn create_content_export( &self, params: ContentExportParams, ) -> Result<ContentExport>

Create a content export for this course.

§Canvas API

POST /api/v1/courses/:course_id/content_exports

Source

pub fn get_grade_change_events(&self) -> PageStream<GradeChangeEvent>

Stream grade change audit events for this course.

The Canvas API wraps the array in { "events": [...] }; PageStream handles this automatically.

§Canvas API

GET /api/v1/audit/grade_change/courses/:course_id

Source

pub fn get_features(&self) -> PageStream<Feature>

Stream all feature flags for this course.

§Canvas API

GET /api/v1/courses/:course_id/features

Source

pub async fn get_feature_flag(&self, feature: &str) -> Result<FeatureFlag>

Fetch a specific feature flag for this course by feature name.

§Canvas API

GET /api/v1/courses/:course_id/features/flags/:feature

Source

pub async fn get_enabled_features(&self) -> Result<Vec<String>>

List all enabled feature names for this course.

§Canvas API

GET /api/v1/courses/:course_id/features/enabled

Stream all LTI resource links in this course.

§Canvas API

GET /api/v1/courses/:course_id/lti_resource_links

Fetch a single LTI resource link.

§Canvas API

GET /api/v1/courses/:course_id/lti_resource_links/:id

Create a new LTI resource link in this course.

§Canvas API

POST /api/v1/courses/:course_id/lti_resource_links

Trait Implementations§

Source§

impl Clone for Course

Source§

fn clone(&self) -> Course

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Course

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Course

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Course

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,