@alicloud/cloudauth20190307 3.8.0 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/client.d.ts +16 -0
  2. package/dist/client.js +127 -0
  3. package/dist/client.js.map +1 -1
  4. package/dist/models/CredentialProductVerifyV2advanceRequest.d.ts +49 -0
  5. package/dist/models/CredentialProductVerifyV2advanceRequest.js +67 -0
  6. package/dist/models/CredentialProductVerifyV2advanceRequest.js.map +1 -0
  7. package/dist/models/CredentialProductVerifyV2request.d.ts +48 -0
  8. package/dist/models/CredentialProductVerifyV2request.js +68 -0
  9. package/dist/models/CredentialProductVerifyV2request.js.map +1 -0
  10. package/dist/models/CredentialProductVerifyV2response.d.ts +19 -0
  11. package/dist/models/CredentialProductVerifyV2response.js +69 -0
  12. package/dist/models/CredentialProductVerifyV2response.js.map +1 -0
  13. package/dist/models/CredentialProductVerifyV2responseBody.d.ts +30 -0
  14. package/dist/models/CredentialProductVerifyV2responseBody.js +68 -0
  15. package/dist/models/CredentialProductVerifyV2responseBody.js.map +1 -0
  16. package/dist/models/CredentialProductVerifyV2responseBodyResultObject.d.ts +27 -0
  17. package/dist/models/CredentialProductVerifyV2responseBodyResultObject.js +67 -0
  18. package/dist/models/CredentialProductVerifyV2responseBodyResultObject.js.map +1 -0
  19. package/dist/models/model.d.ts +5 -0
  20. package/dist/models/model.js +15 -5
  21. package/dist/models/model.js.map +1 -1
  22. package/package.json +1 -1
  23. package/src/client.ts +139 -0
  24. package/src/models/CredentialProductVerifyV2advanceRequest.ts +72 -0
  25. package/src/models/CredentialProductVerifyV2request.ts +71 -0
  26. package/src/models/CredentialProductVerifyV2response.ts +40 -0
  27. package/src/models/CredentialProductVerifyV2responseBody.ts +52 -0
  28. package/src/models/CredentialProductVerifyV2responseBodyResultObject.ts +47 -0
  29. package/src/models/model.ts +5 -0
package/src/client.ts CHANGED
@@ -606,6 +606,145 @@ export default class Client extends OpenApi {
606
606
  return await this.createVerifySettingWithOptions(request, runtime);
607
607
  }
608
608
 
609
+ /**
610
+ * 商品凭证核验
611
+ *
612
+ * @param request - CredentialProductVerifyV2Request
613
+ * @param runtime - runtime options for this request RuntimeOptions
614
+ * @returns CredentialProductVerifyV2Response
615
+ */
616
+ async credentialProductVerifyV2WithOptions(request: $_model.CredentialProductVerifyV2Request, runtime: $dara.RuntimeOptions): Promise<$_model.CredentialProductVerifyV2Response> {
617
+ request.validate();
618
+ let query = { };
619
+ if (!$dara.isNull(request.credName)) {
620
+ query["CredName"] = request.credName;
621
+ }
622
+
623
+ if (!$dara.isNull(request.credType)) {
624
+ query["CredType"] = request.credType;
625
+ }
626
+
627
+ if (!$dara.isNull(request.imageUrl)) {
628
+ query["ImageUrl"] = request.imageUrl;
629
+ }
630
+
631
+ if (!$dara.isNull(request.merchantId)) {
632
+ query["MerchantId"] = request.merchantId;
633
+ }
634
+
635
+ if (!$dara.isNull(request.productCode)) {
636
+ query["ProductCode"] = request.productCode;
637
+ }
638
+
639
+ let body : {[key: string ]: any} = { };
640
+ if (!$dara.isNull(request.imageFile)) {
641
+ body["ImageFile"] = request.imageFile;
642
+ }
643
+
644
+ let req = new $OpenApiUtil.OpenApiRequest({
645
+ query: OpenApiUtil.query(query),
646
+ body: OpenApiUtil.parseToMap(body),
647
+ });
648
+ let params = new $OpenApiUtil.Params({
649
+ action: "CredentialProductVerifyV2",
650
+ version: "2019-03-07",
651
+ protocol: "HTTPS",
652
+ pathname: "/",
653
+ method: "POST",
654
+ authType: "AK",
655
+ style: "RPC",
656
+ reqBodyType: "formData",
657
+ bodyType: "json",
658
+ });
659
+ return $dara.cast<$_model.CredentialProductVerifyV2Response>(await this.callApi(params, req, runtime), new $_model.CredentialProductVerifyV2Response({}));
660
+ }
661
+
662
+ /**
663
+ * 商品凭证核验
664
+ *
665
+ * @param request - CredentialProductVerifyV2Request
666
+ * @returns CredentialProductVerifyV2Response
667
+ */
668
+ async credentialProductVerifyV2(request: $_model.CredentialProductVerifyV2Request): Promise<$_model.CredentialProductVerifyV2Response> {
669
+ let runtime = new $dara.RuntimeOptions({ });
670
+ return await this.credentialProductVerifyV2WithOptions(request, runtime);
671
+ }
672
+
673
+ async credentialProductVerifyV2Advance(request: $_model.CredentialProductVerifyV2AdvanceRequest, runtime: $dara.RuntimeOptions): Promise<$_model.CredentialProductVerifyV2Response> {
674
+ // Step 0: init client
675
+ let accessKeyId = await this._credential.getAccessKeyId();
676
+ let accessKeySecret = await this._credential.getAccessKeySecret();
677
+ let securityToken = await this._credential.getSecurityToken();
678
+ let credentialType = this._credential.getType();
679
+ let openPlatformEndpoint = this._openPlatformEndpoint;
680
+ if ($dara.isNull(openPlatformEndpoint)) {
681
+ openPlatformEndpoint = "openplatform.aliyuncs.com";
682
+ }
683
+
684
+ if ($dara.isNull(credentialType)) {
685
+ credentialType = "access_key";
686
+ }
687
+
688
+ let authConfig = new $OpenApiUtil.Config({
689
+ accessKeyId: accessKeyId,
690
+ accessKeySecret: accessKeySecret,
691
+ securityToken: securityToken,
692
+ type: credentialType,
693
+ endpoint: openPlatformEndpoint,
694
+ protocol: this._protocol,
695
+ regionId: this._regionId,
696
+ });
697
+ let authClient = new OpenPlatform(authConfig);
698
+ let authRequest = new $OpenPlatform.AuthorizeFileUploadRequest({
699
+ product: "Cloudauth",
700
+ regionId: this._regionId,
701
+ });
702
+ let authResponse = new $OpenPlatform.AuthorizeFileUploadResponse({ });
703
+ let ossConfig = new $OSS.Config({
704
+ accessKeyId: accessKeyId,
705
+ accessKeySecret: accessKeySecret,
706
+ type: "access_key",
707
+ protocol: this._protocol,
708
+ regionId: this._regionId,
709
+ });
710
+ let ossClient : OSS = new OSS(ossConfig);
711
+ let fileObj = new $FileForm.FileField({ });
712
+ let ossHeader = new $OSS.PostObjectRequestHeader({ });
713
+ let uploadRequest = new $OSS.PostObjectRequest({ });
714
+ let ossRuntime = new $OSSUtil.RuntimeOptions({ });
715
+ OpenApiUtil.convert(runtime, ossRuntime);
716
+ let credentialProductVerifyV2Req = new $_model.CredentialProductVerifyV2Request({ });
717
+ OpenApiUtil.convert(request, credentialProductVerifyV2Req);
718
+ if (!$dara.isNull(request.imageFileObject)) {
719
+ authResponse = await authClient.authorizeFileUploadWithOptions(authRequest, runtime);
720
+ ossConfig.accessKeyId = authResponse.body.accessKeyId;
721
+ ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, this._endpointType);
722
+ ossClient = new OSS(ossConfig);
723
+ fileObj = new $FileForm.FileField({
724
+ filename: authResponse.body.objectKey,
725
+ content: request.imageFileObject,
726
+ contentType: "",
727
+ });
728
+ ossHeader = new $OSS.PostObjectRequestHeader({
729
+ accessKeyId: authResponse.body.accessKeyId,
730
+ policy: authResponse.body.encodedPolicy,
731
+ signature: authResponse.body.signature,
732
+ key: authResponse.body.objectKey,
733
+ file: fileObj,
734
+ successActionStatus: "201",
735
+ });
736
+ uploadRequest = new $OSS.PostObjectRequest({
737
+ bucketName: authResponse.body.bucket,
738
+ header: ossHeader,
739
+ });
740
+ await ossClient.postObject(uploadRequest, ossRuntime);
741
+ credentialProductVerifyV2Req.imageFile = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
742
+ }
743
+
744
+ let credentialProductVerifyV2Resp = await this.credentialProductVerifyV2WithOptions(credentialProductVerifyV2Req, runtime);
745
+ return credentialProductVerifyV2Resp;
746
+ }
747
+
609
748
  /**
610
749
  * 凭证核验
611
750
  *
@@ -0,0 +1,72 @@
1
+ // This file is auto-generated, don't edit it
2
+ import { Readable } from 'stream';
3
+ import * as $dara from '@darabonba/typescript';
4
+
5
+
6
+ export class CredentialProductVerifyV2AdvanceRequest extends $dara.Model {
7
+ /**
8
+ * @remarks
9
+ * This parameter is required.
10
+ *
11
+ * @example
12
+ * 0501
13
+ */
14
+ credName?: string;
15
+ /**
16
+ * @remarks
17
+ * This parameter is required.
18
+ *
19
+ * @example
20
+ * 05
21
+ */
22
+ credType?: string;
23
+ /**
24
+ * @example
25
+ * https://aliyundoc.com/picture*****.jpeg
26
+ */
27
+ imageFileObject?: Readable;
28
+ /**
29
+ * @example
30
+ * https://aliyundoc.com/picture*****.jpeg
31
+ */
32
+ imageUrl?: string;
33
+ merchantId?: string;
34
+ /**
35
+ * @remarks
36
+ * This parameter is required.
37
+ *
38
+ * @example
39
+ * ANTI_FAKE_CHECK
40
+ */
41
+ productCode?: string;
42
+ static names(): { [key: string]: string } {
43
+ return {
44
+ credName: 'CredName',
45
+ credType: 'CredType',
46
+ imageFileObject: 'ImageFile',
47
+ imageUrl: 'ImageUrl',
48
+ merchantId: 'MerchantId',
49
+ productCode: 'ProductCode',
50
+ };
51
+ }
52
+
53
+ static types(): { [key: string]: any } {
54
+ return {
55
+ credName: 'string',
56
+ credType: 'string',
57
+ imageFileObject: 'Readable',
58
+ imageUrl: 'string',
59
+ merchantId: 'string',
60
+ productCode: 'string',
61
+ };
62
+ }
63
+
64
+ validate() {
65
+ super.validate();
66
+ }
67
+
68
+ constructor(map?: { [key: string]: any }) {
69
+ super(map);
70
+ }
71
+ }
72
+
@@ -0,0 +1,71 @@
1
+ // This file is auto-generated, don't edit it
2
+ import * as $dara from '@darabonba/typescript';
3
+
4
+
5
+ export class CredentialProductVerifyV2Request extends $dara.Model {
6
+ /**
7
+ * @remarks
8
+ * This parameter is required.
9
+ *
10
+ * @example
11
+ * 0501
12
+ */
13
+ credName?: string;
14
+ /**
15
+ * @remarks
16
+ * This parameter is required.
17
+ *
18
+ * @example
19
+ * 05
20
+ */
21
+ credType?: string;
22
+ /**
23
+ * @example
24
+ * https://aliyundoc.com/picture*****.jpeg
25
+ */
26
+ imageFile?: string;
27
+ /**
28
+ * @example
29
+ * https://aliyundoc.com/picture*****.jpeg
30
+ */
31
+ imageUrl?: string;
32
+ merchantId?: string;
33
+ /**
34
+ * @remarks
35
+ * This parameter is required.
36
+ *
37
+ * @example
38
+ * ANTI_FAKE_CHECK
39
+ */
40
+ productCode?: string;
41
+ static names(): { [key: string]: string } {
42
+ return {
43
+ credName: 'CredName',
44
+ credType: 'CredType',
45
+ imageFile: 'ImageFile',
46
+ imageUrl: 'ImageUrl',
47
+ merchantId: 'MerchantId',
48
+ productCode: 'ProductCode',
49
+ };
50
+ }
51
+
52
+ static types(): { [key: string]: any } {
53
+ return {
54
+ credName: 'string',
55
+ credType: 'string',
56
+ imageFile: 'string',
57
+ imageUrl: 'string',
58
+ merchantId: 'string',
59
+ productCode: 'string',
60
+ };
61
+ }
62
+
63
+ validate() {
64
+ super.validate();
65
+ }
66
+
67
+ constructor(map?: { [key: string]: any }) {
68
+ super(map);
69
+ }
70
+ }
71
+
@@ -0,0 +1,40 @@
1
+ // This file is auto-generated, don't edit it
2
+ import * as $dara from '@darabonba/typescript';
3
+ import { CredentialProductVerifyV2ResponseBody } from "./CredentialProductVerifyV2responseBody";
4
+
5
+
6
+ export class CredentialProductVerifyV2Response extends $dara.Model {
7
+ headers?: { [key: string]: string };
8
+ statusCode?: number;
9
+ body?: CredentialProductVerifyV2ResponseBody;
10
+ static names(): { [key: string]: string } {
11
+ return {
12
+ headers: 'headers',
13
+ statusCode: 'statusCode',
14
+ body: 'body',
15
+ };
16
+ }
17
+
18
+ static types(): { [key: string]: any } {
19
+ return {
20
+ headers: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
21
+ statusCode: 'number',
22
+ body: CredentialProductVerifyV2ResponseBody,
23
+ };
24
+ }
25
+
26
+ validate() {
27
+ if(this.headers) {
28
+ $dara.Model.validateMap(this.headers);
29
+ }
30
+ if(this.body && typeof (this.body as any).validate === 'function') {
31
+ (this.body as any).validate();
32
+ }
33
+ super.validate();
34
+ }
35
+
36
+ constructor(map?: { [key: string]: any }) {
37
+ super(map);
38
+ }
39
+ }
40
+
@@ -0,0 +1,52 @@
1
+ // This file is auto-generated, don't edit it
2
+ import * as $dara from '@darabonba/typescript';
3
+ import { CredentialProductVerifyV2ResponseBodyResultObject } from "./CredentialProductVerifyV2responseBodyResultObject";
4
+
5
+
6
+ export class CredentialProductVerifyV2ResponseBody extends $dara.Model {
7
+ /**
8
+ * @example
9
+ * 200
10
+ */
11
+ code?: string;
12
+ /**
13
+ * @example
14
+ * success
15
+ */
16
+ message?: string;
17
+ /**
18
+ * @example
19
+ * 130A2C10-B9EE-4D84-88E3-5384FF039795
20
+ */
21
+ requestId?: string;
22
+ resultObject?: CredentialProductVerifyV2ResponseBodyResultObject;
23
+ static names(): { [key: string]: string } {
24
+ return {
25
+ code: 'Code',
26
+ message: 'Message',
27
+ requestId: 'RequestId',
28
+ resultObject: 'ResultObject',
29
+ };
30
+ }
31
+
32
+ static types(): { [key: string]: any } {
33
+ return {
34
+ code: 'string',
35
+ message: 'string',
36
+ requestId: 'string',
37
+ resultObject: CredentialProductVerifyV2ResponseBodyResultObject,
38
+ };
39
+ }
40
+
41
+ validate() {
42
+ if(this.resultObject && typeof (this.resultObject as any).validate === 'function') {
43
+ (this.resultObject as any).validate();
44
+ }
45
+ super.validate();
46
+ }
47
+
48
+ constructor(map?: { [key: string]: any }) {
49
+ super(map);
50
+ }
51
+ }
52
+
@@ -0,0 +1,47 @@
1
+ // This file is auto-generated, don't edit it
2
+ import * as $dara from '@darabonba/typescript';
3
+
4
+
5
+ export class CredentialProductVerifyV2ResponseBodyResultObject extends $dara.Model {
6
+ materialInfo?: string;
7
+ /**
8
+ * @example
9
+ * 1
10
+ */
11
+ result?: string;
12
+ riskScore?: { [key: string]: string };
13
+ /**
14
+ * @example
15
+ * PS,LOW_QUALITY_PRODUCT
16
+ */
17
+ riskTag?: string;
18
+ static names(): { [key: string]: string } {
19
+ return {
20
+ materialInfo: 'MaterialInfo',
21
+ result: 'Result',
22
+ riskScore: 'RiskScore',
23
+ riskTag: 'RiskTag',
24
+ };
25
+ }
26
+
27
+ static types(): { [key: string]: any } {
28
+ return {
29
+ materialInfo: 'string',
30
+ result: 'string',
31
+ riskScore: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
32
+ riskTag: 'string',
33
+ };
34
+ }
35
+
36
+ validate() {
37
+ if(this.riskScore) {
38
+ $dara.Model.validateMap(this.riskScore);
39
+ }
40
+ super.validate();
41
+ }
42
+
43
+ constructor(map?: { [key: string]: any }) {
44
+ super(map);
45
+ }
46
+ }
47
+
@@ -3,6 +3,7 @@ export { BankMetaVerifyResponseBodyResultObject } from './BankMetaVerifyResponse
3
3
  export { CompareFaceVerifyResponseBodyResultObject } from './CompareFaceVerifyResponseBodyResultObject';
4
4
  export { CompareFacesResponseBodyData } from './CompareFacesResponseBodyData';
5
5
  export { ContrastFaceVerifyResponseBodyResultObject } from './ContrastFaceVerifyResponseBodyResultObject';
6
+ export { CredentialProductVerifyV2ResponseBodyResultObject } from './CredentialProductVerifyV2responseBodyResultObject';
6
7
  export { CredentialVerifyRequestMerchantDetail } from './CredentialVerifyRequestMerchantDetail';
7
8
  export { CredentialVerifyResponseBodyResultObjectVlResult } from './CredentialVerifyResponseBodyResultObjectVlResult';
8
9
  export { CredentialVerifyResponseBodyResultObject } from './CredentialVerifyResponseBodyResultObject';
@@ -76,6 +77,10 @@ export { CreateAuthKeyResponse } from './CreateAuthKeyResponse';
76
77
  export { CreateVerifySettingRequest } from './CreateVerifySettingRequest';
77
78
  export { CreateVerifySettingResponseBody } from './CreateVerifySettingResponseBody';
78
79
  export { CreateVerifySettingResponse } from './CreateVerifySettingResponse';
80
+ export { CredentialProductVerifyV2Request } from './CredentialProductVerifyV2request';
81
+ export { CredentialProductVerifyV2AdvanceRequest } from './CredentialProductVerifyV2advanceRequest';
82
+ export { CredentialProductVerifyV2ResponseBody } from './CredentialProductVerifyV2responseBody';
83
+ export { CredentialProductVerifyV2Response } from './CredentialProductVerifyV2response';
79
84
  export { CredentialVerifyRequest } from './CredentialVerifyRequest';
80
85
  export { CredentialVerifyShrinkRequest } from './CredentialVerifyShrinkRequest';
81
86
  export { CredentialVerifyResponseBody } from './CredentialVerifyResponseBody';