pub struct User {
pub id: u64,
pub name: Option<String>,
pub sortable_name: Option<String>,
pub short_name: Option<String>,
pub sis_user_id: Option<String>,
pub login_id: Option<String>,
pub email: Option<String>,
pub avatar_url: Option<String>,
pub locale: Option<String>,
pub last_login: Option<DateTime<Utc>>,
pub time_zone: Option<String>,
pub bio: Option<String>,
/* private fields */
}Expand description
A Canvas user.
Fields§
§id: u64§name: Option<String>§sortable_name: Option<String>§short_name: Option<String>§sis_user_id: Option<String>§login_id: Option<String>§email: Option<String>§avatar_url: Option<String>§locale: Option<String>§last_login: Option<DateTime<Utc>>§time_zone: Option<String>§bio: Option<String>Implementations§
Source§impl User
impl User
Sourcepub fn get_courses(&self) -> PageStream<Course>
pub fn get_courses(&self) -> PageStream<Course>
Sourcepub fn get_enrollments(&self) -> PageStream<Enrollment>
pub fn get_enrollments(&self) -> PageStream<Enrollment>
Sourcepub fn get_communication_channels(&self) -> PageStream<CommunicationChannel>
pub fn get_communication_channels(&self) -> PageStream<CommunicationChannel>
Stream all communication channels for this user.
§Canvas API
GET /api/v1/users/:id/communication_channels
Sourcepub async fn edit(&self, params: EditUserParams) -> Result<User>
pub async fn edit(&self, params: EditUserParams) -> Result<User>
Sourcepub async fn get_profile(&self) -> Result<Value>
pub async fn get_profile(&self) -> Result<Value>
Sourcepub async fn terminate_sessions(&self) -> Result<()>
pub async fn terminate_sessions(&self) -> Result<()>
Sourcepub async fn merge_into(&self, destination_user_id: u64) -> Result<User>
pub async fn merge_into(&self, destination_user_id: u64) -> Result<User>
Merge this user into another user.
§Canvas API
PUT /api/v1/users/:id/merge_into/:destination_user_id
Sourcepub fn get_avatars(&self) -> PageStream<Value>
pub fn get_avatars(&self) -> PageStream<Value>
Sourcepub fn get_page_views(&self) -> PageStream<Value>
pub fn get_page_views(&self) -> PageStream<Value>
Sourcepub fn get_observees(&self) -> PageStream<User>
pub fn get_observees(&self) -> PageStream<User>
Sourcepub async fn add_observee(&self, observee_id: u64) -> Result<User>
pub async fn add_observee(&self, observee_id: u64) -> Result<User>
Sourcepub async fn remove_observee(&self, observee_id: u64) -> Result<User>
pub async fn remove_observee(&self, observee_id: u64) -> Result<User>
Sourcepub async fn show_observee(&self, observee_id: u64) -> Result<User>
pub async fn show_observee(&self, observee_id: u64) -> Result<User>
Sourcepub fn get_observers(&self) -> PageStream<User>
pub fn get_observers(&self) -> PageStream<User>
Sourcepub async fn get_colors(&self) -> Result<Value>
pub async fn get_colors(&self) -> Result<Value>
Sourcepub fn get_missing_submissions(&self) -> PageStream<Value>
pub fn get_missing_submissions(&self) -> PageStream<Value>
Sourcepub fn get_files(&self) -> PageStream<File>
pub fn get_files(&self) -> PageStream<File>
Sourcepub fn get_folders(&self) -> PageStream<Folder>
pub fn get_folders(&self) -> PageStream<Folder>
Sourcepub async fn create_folder(&self, name: &str) -> Result<Folder>
pub async fn create_folder(&self, name: &str) -> Result<Folder>
Sourcepub async fn get_file_quota(&self) -> Result<Value>
pub async fn get_file_quota(&self) -> Result<Value>
Sourcepub fn get_user_logins(&self) -> PageStream<Value>
pub fn get_user_logins(&self) -> PageStream<Value>
Sourcepub async fn get_settings(&self) -> Result<Value>
pub async fn get_settings(&self) -> Result<Value>
Sourcepub async fn create_communication_channel(
&self,
address: &str,
channel_type: &str,
) -> Result<CommunicationChannel>
pub async fn create_communication_channel( &self, address: &str, channel_type: &str, ) -> Result<CommunicationChannel>
Create a communication channel for this user.
address is the email address, phone number, etc.
channel_type is "email", "sms", "push", etc.
§Canvas API
POST /api/v1/users/:id/communication_channels
Sourcepub async fn create_pairing_code(&self) -> Result<Value>
pub async fn create_pairing_code(&self) -> Result<Value>
Create an observer pairing code for this user.
§Canvas API
POST /api/v1/users/:id/observer_pairing_codes
Sourcepub fn get_authentication_events(&self) -> PageStream<Value>
pub fn get_authentication_events(&self) -> PageStream<Value>
Stream authentication events (login/logout log) for this user.
§Canvas API
GET /api/v1/audit/authentication/users/:id
Sourcepub fn get_features(&self) -> PageStream<Value>
pub fn get_features(&self) -> PageStream<Value>
Sourcepub async fn get_enabled_features(&self) -> Result<Vec<String>>
pub async fn get_enabled_features(&self) -> Result<Vec<String>>
Sourcepub async fn export_content(&self, export_type: &str) -> Result<Value>
pub async fn export_content(&self, export_type: &str) -> Result<Value>
Sourcepub fn get_content_exports(&self) -> PageStream<Value>
pub fn get_content_exports(&self) -> PageStream<Value>
Sourcepub fn get_eportfolios(&self) -> PageStream<Value>
pub fn get_eportfolios(&self) -> PageStream<Value>
Sourcepub fn get_open_poll_sessions(&self) -> PageStream<Value>
pub fn get_open_poll_sessions(&self) -> PageStream<Value>
Sourcepub fn get_closed_poll_sessions(&self) -> PageStream<Value>
pub fn get_closed_poll_sessions(&self) -> PageStream<Value>
Sourcepub async fn get_folder(&self, folder_id: u64) -> Result<Folder>
pub async fn get_folder(&self, folder_id: u64) -> Result<Folder>
Fetch a single folder from this user’s folders.
§Canvas API
GET /api/v1/users/:id/folders/:folder_id
Sourcepub fn resolve_path(&self, full_path: Option<&str>) -> PageStream<Folder>
pub fn resolve_path(&self, full_path: Option<&str>) -> PageStream<Folder>
Resolve a folder path under this user’s files root.
Pass None to get the root folder. Pass a path like
"Folder_Level_1/Folder_Level_2" to walk the tree.
§Canvas API
GET /api/v1/users/:id/folders/by_path/*full_path
Sourcepub fn get_grade_change_events_for_grader(&self) -> PageStream<Value>
pub fn get_grade_change_events_for_grader(&self) -> PageStream<Value>
Stream grade-change audit events where this user is a grader.
§Canvas API
GET /api/v1/audit/grade_change/graders/:id
Sourcepub fn get_grade_change_events_for_student(&self) -> PageStream<Value>
pub fn get_grade_change_events_for_student(&self) -> PageStream<Value>
Stream grade-change audit events where this user is a student.
§Canvas API
GET /api/v1/audit/grade_change/students/:id
Sourcepub async fn get_content_migration(
&self,
migration_id: u64,
) -> Result<ContentMigration>
pub async fn get_content_migration( &self, migration_id: u64, ) -> Result<ContentMigration>
Fetch a single content migration for this user.
§Canvas API
GET /api/v1/users/:id/content_migrations/:migration_id
Sourcepub fn get_content_migrations(&self) -> PageStream<ContentMigration>
pub fn get_content_migrations(&self) -> PageStream<ContentMigration>
Sourcepub async fn create_content_migration(
&self,
migration_type: &str,
) -> Result<ContentMigration>
pub async fn create_content_migration( &self, migration_type: &str, ) -> Result<ContentMigration>
Sourcepub fn get_migration_systems(&self) -> PageStream<Migrator>
pub fn get_migration_systems(&self) -> PageStream<Migrator>
Stream available migration systems (migrators) for this user.
§Canvas API
GET /api/v1/users/:id/content_migrations/migrators
Sourcepub async fn get_feature_flag(&self, feature: &str) -> Result<Value>
pub async fn get_feature_flag(&self, feature: &str) -> Result<Value>
Fetch a specific feature flag for this user.
§Canvas API
GET /api/v1/users/:id/features/flags/:feature
Sourcepub async fn upload_file(
&self,
request: UploadRequest,
data: Vec<u8>,
) -> Result<File>
pub async fn upload_file( &self, request: UploadRequest, data: Vec<u8>, ) -> Result<File>
Upload a file to this user’s file storage.
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/users/:id/files
Sourcepub async fn add_observee_with_credentials(
&self,
params: &[(String, String)],
) -> Result<User>
pub async fn add_observee_with_credentials( &self, params: &[(String, String)], ) -> Result<User>
Add an observee via credentials (same endpoint as add_observee but without observee_id).
§Canvas API
POST /api/v1/users/:id/observees