コード例 #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 }
     }));
 }
コード例 #2
0
ファイル: UserApi.cs プロジェクト: OpenWilma/openwilma_dotnet
        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);
        }
コード例 #3
0
ファイル: UserApi.cs プロジェクト: OpenWilma/openwilma_dotnet
        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);
        }
コード例 #4
0
ファイル: UserApi.cs プロジェクト: OpenWilma/openwilma_dotnet
        public async Task <bool> LogoutAsync(WilmaSession session)
        {
            using var response = await WAPI.PostAsync(session, "/logout").ConfigureAwait(false);

            return(response.IsSuccessStatusCode);
        }
コード例 #5
0
ファイル: ExamApi.cs プロジェクト: OpenWilma/openwilma_dotnet
 public Task MarkAsSeenAsync()
 => WAPI.PostAsync(_session, _role.Slug + "/exams/seen");