コード例 #1
0
        public static async Task ExecuteSecureBinaryCallAsync(this ServiceClientBase target, string methodName, object data, byte[] binary, string tokenId, string encryptionToken)
        {
            var request = target.BuildUserBinaryPostRequest(methodName, data, binary, tokenId, encryptionToken);

            target.ApplyHeaders(request);

            var result = await target.ExecuteRequestAsync <SecureResponse>(request);

            if (result.Success == false)
            {
                throw new Exception(result.Message);
            }
        }
コード例 #2
0
        public static async Task <(string FileName, string MimeType, byte[] Binary)> ExecuteSecureDownloadServiceCallAsync(this ServiceClientBase target, string methodName, object data, string tokenId, string encryptionToken)
        {
            var request = target.BuildUserPostRequest(methodName, data, tokenId, encryptionToken);

            target.ApplyHeaders(request);

            var result = await target.ExecuteRequestAsync <SecureBinaryResponse>(request);

            if (result.Success == false)
            {
                throw new Exception(result.Message);
            }

            return(result.FileName, result.MimeType, result.Data);
        }
コード例 #3
0
        public static async Task <T> ExecuteSecureCallAsync <T>(this ServiceClientBase target, string methodName, object data, string tokenId, string encryptionToken)
        {
            var request = target.BuildUserPostRequest(methodName, data, tokenId, encryptionToken);

            target.ApplyHeaders(request);

            var result = await target.ExecuteRequestAsync <SecureResponse>(request);

            if (result.Success == false)
            {
                throw new Exception(result.Message);
            }

            var payload = result.Payload.Extract <T>(encryptionToken);

            return(payload);
        }