コード例 #1
0
        public static Task <Result <SessionInfo, HttpResponseMessage> > ValidateKeyAsync(this CreyRestClient creyClient, string key, string userAgent)
        {
            var request = creyClient.CreateRequest(HttpMethod.Post, IAM_SERVICE_NAME, "/iam/s2s/accounts/validate/key").AddS2SHeader();

            if (!string.IsNullOrEmpty(userAgent))
            {
                request.AddUserAgentHeader(userAgent);
            }

            request.SetContentJsonBody(new CheckKeyParams {
                Key = key
            });
            return(request.SendAndTryParseAsync <SessionInfo>());
        }
コード例 #2
0
        public static Task <SessionInfo> ImpersonateAccount(this CreyRestClient creyClient, int accountId)
        {
            var request = creyClient.CreateRequest(HttpMethod.Post, IAM_SERVICE_NAME, $"/iam/s2s/accounts/{accountId}/signin").AddS2SHeader();

            return(request.SendAndParseAsync <SessionInfo>());
        }
コード例 #3
0
        public static Task <UserInfo> GetUserInfoAsync(this CreyRestClient creyClient, int accountId)
        {
            var request = creyClient.CreateRequest(HttpMethod.Get, IAM_SERVICE_NAME, $"/iam/s2s/accounts/{accountId}/roles").AddS2SHeader();

            return(request.SendAndParseAsync <UserInfo>());
        }