Esempio n. 1
0
 public static async Task <HttpResponseMessage> PostAsync(WilmaSession session, string path,
                                                          ICollection <KeyValuePair <string, string> > parameters      = default,
                                                          ICollection <KeyValuePair <string, object> > queryParameters = default)
 {
     using var request = CreateRequest(session, HttpMethod.Post, path, queryParameters, parameters);
     return(await _client.SendAsync(request).ConfigureAwait(false));
 }
Esempio n. 2
0
        public static HttpRequestMessage CreateRequest(WilmaSession session, HttpMethod method, string path,
                                                       ICollection <KeyValuePair <string, object> > queryParameters = default,
                                                       ICollection <KeyValuePair <string, string> > parameters      = default)
        {
            var request = CreateRequest(session.Context, method, path, queryParameters, parameters);

            request.Headers.Add("FormKey", session.FormKey);
            return(request);
        }
Esempio n. 3
0
        public static async Task <T> GetAsync <T>(WilmaSession session, string path,
                                                  ICollection <KeyValuePair <string, object> > queryParameters = default,
                                                  Func <HttpContent, Task <T> > contentDeserializer            = default)
        {
            using var request  = CreateRequest(session, HttpMethod.Get, path, queryParameters);
            using var response = await _client.SendAsync(request).ConfigureAwait(false);

            return(await DeserializeContentAsync(response, contentDeserializer).ConfigureAwait(false));
        }
Esempio n. 4
0
 public MessageApi(WilmaSession session, Role role)
 {
     _session = session;
     _role    = role;
 }
 public AttendanceApi(WilmaSession session, Role role)
 {
     _session = session;
     _role    = role;
 }
Esempio n. 6
0
 public NewsApi(WilmaSession session, Role role)
 {
     _session = session;
     _role    = role;
 }
Esempio n. 7
0
        public async Task <bool> LogoutAsync(WilmaSession session)
        {
            using var response = await WAPI.PostAsync(session, "/logout").ConfigureAwait(false);

            return(response.IsSuccessStatusCode);
        }
Esempio n. 8
0
 public GroupApi(WilmaSession session, Role role)
 {
     _role    = role;
     _session = session;
 }
Esempio n. 9
0
 public ExamApi(WilmaSession session, Role role)
 {
     _role    = role;
     _session = session;
 }