示例#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));
        }
        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));
        }