コード例 #1
0
        public async Task <Result <LoginResult> > Login(string user, string password)
        {
            var loginRequest = new LoginRequest
            {
                User     = user,
                Password = password
            };

            ApiResponse <LoginResult> response = await _restClientService.Post <LoginResult>(ApiHelper.GetUrl("login"), loginRequest);

            Result <LoginResult> loginResult;

            if (response.StatusCode == HttpStatusCode.OK)
            {
                loginResult = new Result <LoginResult>(response.Result);
                var loginData = loginResult.Content.Data;
                _authHelper.IsAuthorized = true;
                _authHelper.UserId       = loginData.UserId;
                _authHelper.AuthToken    = loginData.AuthToken;
            }
            else
            {
                loginResult = new ErrorResult <LoginResult>(response.Message);
            }

            return(loginResult);
        }
コード例 #2
0
        public async Task <Result <bool> > SetAsset(Asset asset, bool refreshAllClients)
        {
            var payload = new Payload.Asset {
                AssetName = asset.ToString(), RefreshAllClients = refreshAllClients
            };
            var response = await _restClientService.Post <CallResult>(GetUrl("setAsset"), payload);

            return(ServiceHelper.MapBoolResponse(response));
        }
コード例 #3
0
        public async Task <Result <bool> > Delete(string emojiId)
        {
            var payload = new Payload.DeleteEmoji {
                EmojiId = emojiId
            };
            var response = await _restClientService.Post <CallResult>(GetUrl("delete"), payload);

            return(ServiceHelper.MapBoolResponse(response));
        }
コード例 #4
0
        public async Task <Result <bool> > SaveSetttings(Payload.AutoTranslateSettings payload)
        {
            var response = await _restClientService.Post <CallResult>(GetUrl("saveSetttings"), payload);

            return(ServiceHelper.MapBoolResponse(response));
        }
コード例 #5
0
        public async Task <Result <Channel> > AddAll(Payload.AddAll payload)
        {
            var response = await _restClientService.Post <ChannelResult>(GetUrl("addAll"), payload);

            return(ProcessChannelResponse(response));
        }
コード例 #6
0
        public async Task <Result <UserResult> > Create(Payload.User payload)
        {
            var response = await _restClientService.Post <UserResult>(GetUrl("create"), payload);

            return(ServiceHelper.MapResponse(response));
        }
コード例 #7
0
        public async Task <Result <DeleteMessageResult> > DeleteMessage(Payload.DeleteMessage payload)
        {
            var response = await _restClientService.Post <DeleteMessageResult>(GetUrl("delete"), payload);

            return(ServiceHelper.MapResponse(response));
        }
コード例 #8
0
        public async Task <Result <bool> > CleanHistory(Payload.CleanHistory payload)
        {
            var response = await _restClientService.Post <CallResult>(GetUrl("cleanHistory"), payload);

            return(ServiceHelper.MapBoolResponse(response));
        }
コード例 #9
0
        public async Task <Result <bool> > Run(Payload.RunCommand payload)
        {
            var response = await _restClientService.Post <CallResult>(GetUrl("run"), payload);

            return(ServiceHelper.MapBoolResponse(response));
        }