コード例 #1
0
 public Client(AlibabaCloud.RPCClient.Models.Config config) : base(config)
 {
     this._endpointRule = "regional";
     this._endpointMap  = new Dictionary <string, string>
     {
         { "ap-northeast-2-pop", "ft.aliyuncs.com" },
         { "ap-south-1", "ft.aliyuncs.com" },
         { "ap-southeast-1", "ft.aliyuncs.com" },
         { "ap-southeast-2", "ft.aliyuncs.com" },
         { "ap-southeast-3", "ft.aliyuncs.com" },
         { "ap-southeast-5", "ft.aliyuncs.com" },
         { "cn-beijing", "ft.aliyuncs.com" },
         { "cn-beijing-finance-1", "ft.aliyuncs.com" },
         { "cn-beijing-finance-pop", "ft.aliyuncs.com" },
         { "cn-beijing-gov-1", "ft.aliyuncs.com" },
         { "cn-beijing-nu16-b01", "ft.aliyuncs.com" },
         { "cn-chengdu", "ft.aliyuncs.com" },
         { "cn-edge-1", "ft.aliyuncs.com" },
         { "cn-fujian", "ft.aliyuncs.com" },
         { "cn-haidian-cm12-c01", "ft.aliyuncs.com" },
         { "cn-hangzhou-bj-b01", "ft.aliyuncs.com" },
         { "cn-hangzhou-finance", "ft.aliyuncs.com" },
         { "cn-hangzhou-internal-prod-1", "ft.aliyuncs.com" },
         { "cn-hangzhou-internal-test-1", "ft.aliyuncs.com" },
         { "cn-hangzhou-internal-test-2", "ft.aliyuncs.com" },
         { "cn-hangzhou-internal-test-3", "ft.aliyuncs.com" },
         { "cn-hangzhou-test-306", "ft.aliyuncs.com" },
         { "cn-hongkong-finance-pop", "ft.aliyuncs.com" },
         { "cn-huhehaote", "ft.aliyuncs.com" },
         { "cn-qingdao", "ft.aliyuncs.com" },
         { "cn-qingdao-nebula", "ft.aliyuncs.com" },
         { "cn-shanghai-et15-b01", "ft.aliyuncs.com" },
         { "cn-shanghai-et2-b01", "ft.aliyuncs.com" },
         { "cn-shanghai-finance-1", "ft.aliyuncs.com" },
         { "cn-shanghai-inner", "ft.aliyuncs.com" },
         { "cn-shanghai-internal-test-1", "ft.aliyuncs.com" },
         { "cn-shenzhen-finance-1", "ft.aliyuncs.com" },
         { "cn-shenzhen-inner", "ft.aliyuncs.com" },
         { "cn-shenzhen-st4-d01", "ft.aliyuncs.com" },
         { "cn-shenzhen-su18-b01", "ft.aliyuncs.com" },
         { "cn-wuhan", "ft.aliyuncs.com" },
         { "cn-yushanfang", "ft.aliyuncs.com" },
         { "cn-zhangbei-na61-b01", "ft.aliyuncs.com" },
         { "cn-zhangjiakou-na62-a01", "ft.aliyuncs.com" },
         { "cn-zhengzhou-nebula-1", "ft.aliyuncs.com" },
         { "eu-central-1", "ft.aliyuncs.com" },
         { "eu-west-1", "ft.aliyuncs.com" },
         { "eu-west-1-oxs", "ft.aliyuncs.com" },
         { "me-east-1", "ft.aliyuncs.com" },
         { "rus-west-1-pop", "ft.aliyuncs.com" },
         { "us-west-1", "ft.aliyuncs.com" },
     };
     CheckConfig(config);
     this._endpoint = GetEndpoint("ft", _regionId, _endpointRule, _network, _suffix, _endpointMap, _endpoint);
 }
コード例 #2
0
        private FileUtils(string accessKeyId, string accessKeySecret)
        {
            AlibabaCloud.RPCClient.Models.Config config = new AlibabaCloud.RPCClient.Models.Config
            {
                RegionId        = "cn-shanghai",
                AccessKeyId     = accessKeyId,
                AccessKeySecret = accessKeySecret,
                Endpoint        = "viapiutils.cn-shanghai.aliyuncs.com"
            };

            client           = new AlibabaCloud.SDK.Viapiutils20200401.Client(config);
            this.accessKeyId = accessKeyId;
        }
コード例 #3
0
 public Client(AlibabaCloud.RPCClient.Models.Config config) : base(config)
 {
     this._endpointRule = "central";
     this._endpointMap  = new Dictionary <string, string>
     {
         { "ap-northeast-1", "dysmsapi.ap-southeast-1.aliyuncs.com" },
         { "ap-northeast-2-pop", "dysmsapi.ap-southeast-1.aliyuncs.com" },
         { "ap-south-1", "dysmsapi.ap-southeast-1.aliyuncs.com" },
         { "ap-southeast-1", "dysmsapi.ap-southeast-1.aliyuncs.com" },
         { "ap-southeast-2", "dysmsapi.ap-southeast-1.aliyuncs.com" },
         { "ap-southeast-3", "dysmsapi.ap-southeast-1.aliyuncs.com" },
         { "ap-southeast-5", "dysmsapi.ap-southeast-1.aliyuncs.com" },
         { "cn-beijing", "dysmsapi-proxy.cn-beijing.aliyuncs.com" },
         { "eu-central-1", "dysmsapi.ap-southeast-1.aliyuncs.com" },
         { "eu-west-1", "dysmsapi.ap-southeast-1.aliyuncs.com" },
         { "eu-west-1-oxs", "dysmsapi.ap-southeast-1.aliyuncs.com" },
         { "me-east-1", "dysmsapi.ap-southeast-1.aliyuncs.com" },
         { "rus-west-1-pop", "dysmsapi.ap-southeast-1.aliyuncs.com" },
         { "us-east-1", "dysmsapi.ap-southeast-1.aliyuncs.com" },
         { "us-west-1", "dysmsapi.ap-southeast-1.aliyuncs.com" },
     };
     CheckConfig(config);
     this._endpoint = GetEndpoint("dysmsapi", _regionId, _endpointRule, _network, _suffix, _endpointMap, _endpoint);
 }
コード例 #4
0
ファイル: Client.cs プロジェクト: glenlgd/alibabacloud-sdk
 public Client(AlibabaCloud.RPCClient.Models.Config config) : base(config)
 {
     this._endpointRule = "central";
     CheckConfig(config);
     this._endpoint = GetEndpoint("servicemesh", _regionId, _endpointRule, _network, _suffix, _endpointMap, _endpoint);
 }
コード例 #5
0
        public async Task <ClassifyCommodityResponse> ClassifyCommodityAdvanceAsync(ClassifyCommodityAdvanceRequest request, AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime)
        {
            // Step 0: init client
            string accessKeyId = await this._credential.GetAccessKeyIdAsync();

            string accessKeySecret = await this._credential.GetAccessKeySecretAsync();

            AlibabaCloud.RPCClient.Models.Config authConfig = new AlibabaCloud.RPCClient.Models.Config
            {
                AccessKeyId     = accessKeyId,
                AccessKeySecret = accessKeySecret,
                Type            = "access_key",
                Endpoint        = "openplatform.aliyuncs.com",
                Protocol        = _protocol,
                RegionId        = _regionId,
            };
            AlibabaCloud.SDK.OpenPlatform20191219.Client authClient = new AlibabaCloud.SDK.OpenPlatform20191219.Client(authConfig);
            AlibabaCloud.SDK.OpenPlatform20191219.Models.AuthorizeFileUploadRequest authRequest = new AlibabaCloud.SDK.OpenPlatform20191219.Models.AuthorizeFileUploadRequest
            {
                Product  = "goodstech",
                RegionId = _regionId,
            };
            AlibabaCloud.SDK.OpenPlatform20191219.Models.AuthorizeFileUploadResponse authResponse = await authClient.AuthorizeFileUploadAsync(authRequest, runtime);

            // Step 1: request OSS api to upload file
            AlibabaCloud.OSS.Models.Config ossConfig = new AlibabaCloud.OSS.Models.Config
            {
                AccessKeyId     = authResponse.AccessKeyId,
                AccessKeySecret = accessKeySecret,
                Type            = "access_key",
                Endpoint        = AlibabaCloud.Commons.Common.GetEndpoint(authResponse.Endpoint, authResponse.UseAccelerate, _endpointType),
                Protocol        = _protocol,
                RegionId        = _regionId,
            };
            AlibabaCloud.OSS.Client ossClient = new AlibabaCloud.OSS.Client(ossConfig);
            AlibabaCloud.SDK.TeaFileform.Models.FileField fileObj = new AlibabaCloud.SDK.TeaFileform.Models.FileField
            {
                Filename    = authResponse.ObjectKey,
                Content     = request.ImageURLObject,
                ContentType = "",
            };
            AlibabaCloud.OSS.Models.PostObjectRequest.PostObjectRequestHeader ossHeader = new AlibabaCloud.OSS.Models.PostObjectRequest.PostObjectRequestHeader
            {
                AccessKeyId         = authResponse.AccessKeyId,
                Policy              = authResponse.EncodedPolicy,
                Signature           = authResponse.Signature,
                Key                 = authResponse.ObjectKey,
                File                = fileObj,
                SuccessActionStatus = "201",
            };
            AlibabaCloud.OSS.Models.PostObjectRequest uploadRequest = new AlibabaCloud.OSS.Models.PostObjectRequest
            {
                BucketName = authResponse.Bucket,
                Header     = ossHeader,
            };
            AlibabaCloud.OSSUtil.Models.RuntimeOptions ossRuntime = new AlibabaCloud.OSSUtil.Models.RuntimeOptions();
            AlibabaCloud.Commons.Common.Convert(runtime, ossRuntime);
            await ossClient.PostObjectAsync(uploadRequest, ossRuntime);

            // Step 2: request final api
            ClassifyCommodityRequest classifyCommodityreq = new ClassifyCommodityRequest();

            AlibabaCloud.Commons.Common.Convert(request, classifyCommodityreq);
            classifyCommodityreq.ImageURL = "http://" + authResponse.Bucket + "." + authResponse.Endpoint + "/" + authResponse.ObjectKey;
            ClassifyCommodityResponse classifyCommodityResp = await ClassifyCommodityAsync(classifyCommodityreq, runtime);

            return(classifyCommodityResp);
        }
コード例 #6
0
 public Client(AlibabaCloud.RPCClient.Models.Config config) : base(config)
 {
     this._endpointRule = "regional";
     CheckConfig(config);
     this._endpoint = GetEndpoint(_productId, _regionId, _endpointRule, _network, _suffix, _endpointMap, _endpoint);
 }
コード例 #7
0
        public DetectVideoShotResponse DetectVideoShotAdvance(DetectVideoShotAdvanceRequest request, AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime)
        {
            // Step 0: init client
            string accessKeyId     = this._credential.GetAccessKeyId();
            string accessKeySecret = this._credential.GetAccessKeySecret();

            AlibabaCloud.RPCClient.Models.Config authConfig = new AlibabaCloud.RPCClient.Models.Config
            {
                AccessKeyId     = accessKeyId,
                AccessKeySecret = accessKeySecret,
                Type            = "access_key",
                Endpoint        = "openplatform.aliyuncs.com",
                Protocol        = _protocol,
                RegionId        = _regionId,
            };
            AlibabaCloud.SDK.OpenPlatform20191219.Client authClient = new AlibabaCloud.SDK.OpenPlatform20191219.Client(authConfig);
            AlibabaCloud.SDK.OpenPlatform20191219.Models.AuthorizeFileUploadRequest authRequest = new AlibabaCloud.SDK.OpenPlatform20191219.Models.AuthorizeFileUploadRequest
            {
                Product  = "videorecog",
                RegionId = _regionId,
            };
            AlibabaCloud.SDK.OpenPlatform20191219.Models.AuthorizeFileUploadResponse authResponse = authClient.AuthorizeFileUpload(authRequest, runtime);
            // Step 1: request OSS api to upload file
            AlibabaCloud.OSS.Models.Config ossConfig = new AlibabaCloud.OSS.Models.Config
            {
                AccessKeyId     = authResponse.AccessKeyId,
                AccessKeySecret = accessKeySecret,
                Type            = "access_key",
                Endpoint        = AlibabaCloud.Commons.Common.GetEndpoint(authResponse.Endpoint, authResponse.UseAccelerate, _endpointType),
                Protocol        = _protocol,
                RegionId        = _regionId,
            };
            AlibabaCloud.OSS.Client ossClient = new AlibabaCloud.OSS.Client(ossConfig);
            AlibabaCloud.SDK.TeaFileform.Models.FileField fileObj = new AlibabaCloud.SDK.TeaFileform.Models.FileField
            {
                Filename    = authResponse.ObjectKey,
                Content     = request.VideoUrlObject,
                ContentType = "",
            };
            AlibabaCloud.OSS.Models.PostObjectRequest.PostObjectRequestHeader ossHeader = new AlibabaCloud.OSS.Models.PostObjectRequest.PostObjectRequestHeader
            {
                AccessKeyId         = authResponse.AccessKeyId,
                Policy              = authResponse.EncodedPolicy,
                Signature           = authResponse.Signature,
                Key                 = authResponse.ObjectKey,
                File                = fileObj,
                SuccessActionStatus = "201",
            };
            AlibabaCloud.OSS.Models.PostObjectRequest uploadRequest = new AlibabaCloud.OSS.Models.PostObjectRequest
            {
                BucketName = authResponse.Bucket,
                Header     = ossHeader,
            };
            AlibabaCloud.OSSUtil.Models.RuntimeOptions ossRuntime = new AlibabaCloud.OSSUtil.Models.RuntimeOptions();
            AlibabaCloud.Commons.Common.Convert(runtime, ossRuntime);
            ossClient.PostObject(uploadRequest, ossRuntime);
            // Step 2: request final api
            DetectVideoShotRequest detectVideoShotreq = new DetectVideoShotRequest();

            AlibabaCloud.Commons.Common.Convert(request, detectVideoShotreq);
            detectVideoShotreq.VideoUrl = "http://" + authResponse.Bucket + "." + authResponse.Endpoint + "/" + authResponse.ObjectKey;
            DetectVideoShotResponse detectVideoShotResp = DetectVideoShot(detectVideoShotreq, runtime);

            return(detectVideoShotResp);
        }
コード例 #8
0
 public Client(AlibabaCloud.RPCClient.Models.Config config) : base(config)
 {
     this._endpointRule = "";
     CheckConfig(config);
     this._endpoint = GetEndpoint("openplatform", _regionId, _endpointRule, _network, _suffix, _endpointMap, _endpoint);
 }