public static DetectKneeXRayResponse Unmarshall(UnmarshallerContext _ctx)
        {
            DetectKneeXRayResponse detectKneeXRayResponse = new DetectKneeXRayResponse();

            detectKneeXRayResponse.HttpResponse = _ctx.HttpResponse;
            detectKneeXRayResponse.RequestId    = _ctx.StringValue("DetectKneeXRay.RequestId");

            DetectKneeXRayResponse.DetectKneeXRay_Data data = new DetectKneeXRayResponse.DetectKneeXRay_Data();

            List <DetectKneeXRayResponse.DetectKneeXRay_Data.DetectKneeXRay_KLDetectionsItem> data_kLDetections = new List <DetectKneeXRayResponse.DetectKneeXRay_Data.DetectKneeXRay_KLDetectionsItem>();

            for (int i = 0; i < _ctx.Length("DetectKneeXRay.Data.KLDetections.Length"); i++)
            {
                DetectKneeXRayResponse.DetectKneeXRay_Data.DetectKneeXRay_KLDetectionsItem kLDetectionsItem = new DetectKneeXRayResponse.DetectKneeXRay_Data.DetectKneeXRay_KLDetectionsItem();

                List <string> kLDetectionsItem_detections = new List <string>();
                for (int j = 0; j < _ctx.Length("DetectKneeXRay.Data.KLDetections[" + i + "].Detections.Length"); j++)
                {
                    kLDetectionsItem_detections.Add(_ctx.StringValue("DetectKneeXRay.Data.KLDetections[" + i + "].Detections[" + j + "]"));
                }
                kLDetectionsItem.Detections = kLDetectionsItem_detections;

                data_kLDetections.Add(kLDetectionsItem);
            }
            data.KLDetections           = data_kLDetections;
            detectKneeXRayResponse.Data = data;

            return(detectKneeXRayResponse);
        }
예제 #2
0
        public DetectKneeXRayResponse DetectKneeXRayAdvance(DetectKneeXRayAdvanceRequest 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  = "imageprocess",
                RegionId = _regionId,
            };
            AlibabaCloud.SDK.OpenPlatform20191219.Models.AuthorizeFileUploadResponse authResponse = authClient.AuthorizeFileUploadWithOptions(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.UrlObject,
                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
            DetectKneeXRayRequest detectKneeXRayreq = new DetectKneeXRayRequest();

            AlibabaCloud.Commons.Common.Convert(request, detectKneeXRayreq);
            detectKneeXRayreq.Url = "http://" + authResponse.Bucket + "." + authResponse.Endpoint + "/" + authResponse.ObjectKey;
            DetectKneeXRayResponse detectKneeXRayResp = DetectKneeXRay(detectKneeXRayreq, runtime);

            return(detectKneeXRayResp);
        }