Exemplo n.º 1
0
 /// <summary>
 /// Reply to a message which has the collated replies allowed.
 /// </summary>
 /// <param name="messageId">The identifier of the message which the reply is meant for.</param>
 /// <param name="bodyText">The reply message body.</param>
 public Task <HttpResponseMessage> ReplyAsync(int messageId, string bodyText)
 {
     return(WAPI.PostAsync(_session, _role.Slug + "/messages/collatedreply/" + messageId,
                           parameters: new Dictionary <string, string> {
         { "BodyText", bodyText }
     }));
 }
Exemplo n.º 2
0
        public async Task <WilmaSession?> LoginAsync(string username, string password)
        {
            string sessionId = await GetSessionIdAsync().ConfigureAwait(false);

            string apiKey = "sha1:" +
                            Utils.DeriveSHA1Digest($"{username}|{sessionId}|{_context.Key}");

            var parameters = new Dictionary <string, string>
            {
                { "Login", username },
                { "Password", password },
                { "SESSIONID", sessionId },
                { "ApiKey", apiKey },
                { "CompleteJson", string.Empty },
                { "format", "json" }
            };

            var response = await WAPI.PostAsync <IndexResponse>(_context, "/login",
                                                                parameters).ConfigureAwait(false);

            if (response.LoginResult == LoginResult.Ok)
            {
                return(new WilmaSession(_context, response));
            }

            return(null);
        }
Exemplo n.º 3
0
        public async Task <bool> ForgotPasswordAsync(string email, string username = "")
        {
            var parameters = new Dictionary <string, string>
            {
                { "username", username },
                { "email", email }
            };

            using var response = await WAPI.PostAsync(_context, "/forgotpasswd", parameters).ConfigureAwait(false);

            return(response.IsSuccessStatusCode);
        }
Exemplo n.º 4
0
        public async Task <bool> LogoutAsync(WilmaSession session)
        {
            using var response = await WAPI.PostAsync(session, "/logout").ConfigureAwait(false);

            return(response.IsSuccessStatusCode);
        }
Exemplo n.º 5
0
 public Task MarkAsSeenAsync()
 => WAPI.PostAsync(_session, _role.Slug + "/exams/seen");