pub struct SisuClient {
base_url: String,
}Fields§
§base_url: StringImplementations§
Source§impl SisuClient
impl SisuClient
fn get_url(&self) -> Result<Url, ParseError>
pub fn new(base_url: String) -> UtilResult<Self>
async fn get_request_sisu(&self, path: String) -> Result<Response, UtilError>
pub async fn get_course_ids( &self, course_modules: Vec<String>, ) -> UtilResult<Vec<Vec<String>>>
pub async fn get_course_info( &self, course_ids: Vec<Vec<String>>, ) -> UtilResult<Vec<SisuCourseInfoElement>>
pub fn parse_course_info( course_info: Vec<SisuCourseInfoElement>, course_language: String, ) -> HashMap<String, SisuDescriptions>
Sourcepub async fn get_course_contacts(
&self,
cache: &Cache,
uh_course_code: &str,
) -> UtilResult<SisuCourseContacts>
pub async fn get_course_contacts( &self, cache: &Cache, uh_course_code: &str, ) -> UtilResult<SisuCourseContacts>
Who Sisu lists as responsible for a UH course code today: the people on the course unit version valid today, then the teachers of its ongoing realisations (or the next one when none is ongoing), each person once, plus the responsible organisations. Errors when the code is unknown to Sisu or Sisu fails; an empty contact list is a valid answer. Answers are cached for a few hours.
async fn fetch_course_contacts( &self, uh_course_code: &str, ) -> UtilResult<SisuCourseContacts>
Sourceasync fn get_current_course_unit(
&self,
uh_course_code: &str,
today: NaiveDate,
) -> UtilResult<CourseUnitResponsibilities>
async fn get_current_course_unit( &self, uh_course_code: &str, today: NaiveDate, ) -> UtilResult<CourseUnitResponsibilities>
The latest-starting version of the course unit valid today, else the one that started last.
Sourceasync fn get_current_realisations(
&self,
assessment_item_ids: &[String],
today: NaiveDate,
) -> UtilResult<Vec<RealisationResponsibilities>>
async fn get_current_realisations( &self, assessment_item_ids: &[String], today: NaiveDate, ) -> UtilResult<Vec<RealisationResponsibilities>>
Published realisations of the assessment items that are ongoing today, or the one starting next when none is.
async fn push_contacts( &self, contacts: &mut Vec<SisuCourseContact>, seen_person_ids: &mut HashSet<String>, responsibility_infos: &[ResponsibilityInfo], source: SisuContactSource, today: NaiveDate, ) -> UtilResult<()>
Sourceasync fn get_person(&self, person_id: &str) -> UtilResult<Option<SisuPerson>>
async fn get_person(&self, person_id: &str) -> UtilResult<Option<SisuPerson>>
None when Sisu no longer has the person.
async fn get_organisation_name( &self, organisation_id: &str, ) -> UtilResult<Option<String>>
Sourceasync fn get_sisu_json<T: DeserializeOwned>(
&self,
path: String,
) -> UtilResult<Option<T>>
async fn get_sisu_json<T: DeserializeOwned>( &self, path: String, ) -> UtilResult<Option<T>>
GETs a Sisu path as JSON; None on 404 or 400, which Sisu answers for unknown ids.
pub fn mock_for_test() -> Self
Trait Implementations§
Source§impl Clone for SisuClient
impl Clone for SisuClient
Source§fn clone(&self) -> SisuClient
fn clone(&self) -> SisuClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SisuClient
impl RefUnwindSafe for SisuClient
impl Send for SisuClient
impl Sync for SisuClient
impl Unpin for SisuClient
impl UnsafeUnpin for SisuClient
impl UnwindSafe for SisuClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Apply a transformation to the response body. Read more
§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<Self>where
Self: Sized,
Decompress response bodies. Read more
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using HTTP status codes. Read more
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using gRPC headers. Read more