use serde::{Deserialize, Serialize};
use crate::canvas::CanvasInformation;
use crate::models::prelude::*;
use crate::parameters::*;
use crate::requests::*;
#[derive(Debug, Deserialize, Serialize)]
pub struct Canvas;
impl Canvas {
api_todo! {
conversations_get_running_batches()
}
api_get! {
conversations_unread_count():
"conversations/unread_count" =>
() -> () -> { "unread_count": usize }
}
api_todo! {
get_account()
}
api_todo! {
get_accounts()
}
api_todo! {
get_activity_stream_summary(self)
}
api_todo! {
get_announcements()
}
api_todo! {
get_appointment_group()
}
api_todo! {
get_appointment_groups()
}
api_todo! {
get_brand_variables()
}
api_todo! {
get_calendar_event()
}
api_todo! {
get_calendar_events()
}
api_todo! {
get_comm_messages()
}
api_todo! {
get_conversation()
}
api_todo! {
get_conversations()
}
api_get! {
get_course():
"courses/{id}" =>
() -> (id: usize) -> Course
}
api_todo! {
get_course_accounts()
}
api_todo! {
get_course_nickname()
}
api_todo! {
get_course_nicknames()
}
api_todo! {
get_courses()
}
api_todo! {
get_epub_exports()
}
api_todo! {
get_file()
}
api_todo! {
get_folder()
}
api_todo! {
get_group()
}
api_todo! {
get_group_category()
}
api_todo! {
get_group_participants()
}
api_todo! {
get_outcome()
}
api_todo! {
get_outcome_group()
}
api_todo! {
get_planner_note()
}
api_todo! {
get_planner_notes()
}
api_todo! {
get_planner_overrides()
}
api_todo! {
get_poll()
}
api_todo! {
get_polls()
}
api_todo! {
get_root_outcome_group()
}
api_todo! {
get_section()
}
api_get! {
get_todo_items():
"users/self/todo" =>
() -> () -> [Todo]
}
api_todo! {
get_upcomming_events()
}
api_todo! {
get_user()
}
api_todo! {
get_user_participants()
}
api_todo! {
searh_accounts()
}
pub fn search_course(
search: String,
public_only: bool,
open_enrollment_only: bool,
) -> anyhow::Result<GetPagedObjectRequest<serde_json::Value>> {
let mut request = GetPagedObjectRequest::<_>::new("search/all_courses/".to_string())
.add_parameter(RequestParameter {
name: "search".to_string(),
value: search,
});
if public_only {
request = request.add_parameter(RequestParameter {
name: "public_only".into(),
value: public_only.to_string(),
});
}
if open_enrollment_only {
request = request.add_parameter(RequestParameter {
name: "open_enrollment_only".into(),
value: open_enrollment_only.to_string(),
});
}
Ok(request)
}
api_todo! {
search_recipients()
}
}