@alicloud/cloudauth20190307 3.5.0 → 3.6.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alicloud/cloudauth20190307",
3
- "version": "3.5.0",
3
+ "version": "3.6.0",
4
4
  "description": "",
5
5
  "main": "dist/client.js",
6
6
  "scripts": {
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@darabonba/typescript": "^1.0.0",
23
- "@alicloud/oss-client": "^1.1.2",
23
+ "@alicloud/oss-client": "^1.1.4",
24
24
  "@alicloud/openplatform20191219": "2.0.0",
25
25
  "@alicloud/oss-util": "0.0.1",
26
26
  "@alicloud/tea-fileform": "^1.0.0",
package/src/client.ts CHANGED
@@ -1534,6 +1534,36 @@ export class Id2MetaVerifyResponseBodyResultObject extends $dara.Model {
1534
1534
  }
1535
1535
  }
1536
1536
 
1537
+ export class Id2MetaVerifyWithOCRResponseBodyResultObject extends $dara.Model {
1538
+ /**
1539
+ * @example
1540
+ * 1
1541
+ */
1542
+ bizCode?: string;
1543
+ cardInfo?: string;
1544
+ static names(): { [key: string]: string } {
1545
+ return {
1546
+ bizCode: 'BizCode',
1547
+ cardInfo: 'CardInfo',
1548
+ };
1549
+ }
1550
+
1551
+ static types(): { [key: string]: any } {
1552
+ return {
1553
+ bizCode: 'string',
1554
+ cardInfo: 'string',
1555
+ };
1556
+ }
1557
+
1558
+ validate() {
1559
+ super.validate();
1560
+ }
1561
+
1562
+ constructor(map?: { [key: string]: any }) {
1563
+ super(map);
1564
+ }
1565
+ }
1566
+
1537
1567
  export class InitFaceVerifyResponseBodyResultObject extends $dara.Model {
1538
1568
  /**
1539
1569
  * @example
@@ -6235,6 +6265,168 @@ export class Id2MetaVerifyResponse extends $dara.Model {
6235
6265
  }
6236
6266
  }
6237
6267
 
6268
+ export class Id2MetaVerifyWithOCRRequest extends $dara.Model {
6269
+ certFile?: string;
6270
+ certNationalFile?: string;
6271
+ /**
6272
+ * @example
6273
+ * https://www.aliyun.com/cert.jpeg
6274
+ */
6275
+ certNationalUrl?: string;
6276
+ /**
6277
+ * @example
6278
+ * https://www.aliyun.com/cert.jpeg
6279
+ */
6280
+ certUrl?: string;
6281
+ static names(): { [key: string]: string } {
6282
+ return {
6283
+ certFile: 'CertFile',
6284
+ certNationalFile: 'CertNationalFile',
6285
+ certNationalUrl: 'CertNationalUrl',
6286
+ certUrl: 'CertUrl',
6287
+ };
6288
+ }
6289
+
6290
+ static types(): { [key: string]: any } {
6291
+ return {
6292
+ certFile: 'string',
6293
+ certNationalFile: 'string',
6294
+ certNationalUrl: 'string',
6295
+ certUrl: 'string',
6296
+ };
6297
+ }
6298
+
6299
+ validate() {
6300
+ super.validate();
6301
+ }
6302
+
6303
+ constructor(map?: { [key: string]: any }) {
6304
+ super(map);
6305
+ }
6306
+ }
6307
+
6308
+ export class Id2MetaVerifyWithOCRAdvanceRequest extends $dara.Model {
6309
+ certFileObject?: Readable;
6310
+ certNationalFileObject?: Readable;
6311
+ /**
6312
+ * @example
6313
+ * https://www.aliyun.com/cert.jpeg
6314
+ */
6315
+ certNationalUrl?: string;
6316
+ /**
6317
+ * @example
6318
+ * https://www.aliyun.com/cert.jpeg
6319
+ */
6320
+ certUrl?: string;
6321
+ static names(): { [key: string]: string } {
6322
+ return {
6323
+ certFileObject: 'CertFile',
6324
+ certNationalFileObject: 'CertNationalFile',
6325
+ certNationalUrl: 'CertNationalUrl',
6326
+ certUrl: 'CertUrl',
6327
+ };
6328
+ }
6329
+
6330
+ static types(): { [key: string]: any } {
6331
+ return {
6332
+ certFileObject: 'Readable',
6333
+ certNationalFileObject: 'Readable',
6334
+ certNationalUrl: 'string',
6335
+ certUrl: 'string',
6336
+ };
6337
+ }
6338
+
6339
+ validate() {
6340
+ super.validate();
6341
+ }
6342
+
6343
+ constructor(map?: { [key: string]: any }) {
6344
+ super(map);
6345
+ }
6346
+ }
6347
+
6348
+ export class Id2MetaVerifyWithOCRResponseBody extends $dara.Model {
6349
+ /**
6350
+ * @example
6351
+ * 200
6352
+ */
6353
+ code?: string;
6354
+ /**
6355
+ * @example
6356
+ * success
6357
+ */
6358
+ message?: string;
6359
+ /**
6360
+ * @example
6361
+ * 130A2C10-B9EE-4D84-88E3-5384FF03****
6362
+ */
6363
+ requestId?: string;
6364
+ resultObject?: Id2MetaVerifyWithOCRResponseBodyResultObject;
6365
+ static names(): { [key: string]: string } {
6366
+ return {
6367
+ code: 'Code',
6368
+ message: 'Message',
6369
+ requestId: 'RequestId',
6370
+ resultObject: 'ResultObject',
6371
+ };
6372
+ }
6373
+
6374
+ static types(): { [key: string]: any } {
6375
+ return {
6376
+ code: 'string',
6377
+ message: 'string',
6378
+ requestId: 'string',
6379
+ resultObject: Id2MetaVerifyWithOCRResponseBodyResultObject,
6380
+ };
6381
+ }
6382
+
6383
+ validate() {
6384
+ if(this.resultObject && typeof (this.resultObject as any).validate === 'function') {
6385
+ (this.resultObject as any).validate();
6386
+ }
6387
+ super.validate();
6388
+ }
6389
+
6390
+ constructor(map?: { [key: string]: any }) {
6391
+ super(map);
6392
+ }
6393
+ }
6394
+
6395
+ export class Id2MetaVerifyWithOCRResponse extends $dara.Model {
6396
+ headers?: { [key: string]: string };
6397
+ statusCode?: number;
6398
+ body?: Id2MetaVerifyWithOCRResponseBody;
6399
+ static names(): { [key: string]: string } {
6400
+ return {
6401
+ headers: 'headers',
6402
+ statusCode: 'statusCode',
6403
+ body: 'body',
6404
+ };
6405
+ }
6406
+
6407
+ static types(): { [key: string]: any } {
6408
+ return {
6409
+ headers: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
6410
+ statusCode: 'number',
6411
+ body: Id2MetaVerifyWithOCRResponseBody,
6412
+ };
6413
+ }
6414
+
6415
+ validate() {
6416
+ if(this.headers) {
6417
+ $dara.Model.validateMap(this.headers);
6418
+ }
6419
+ if(this.body && typeof (this.body as any).validate === 'function') {
6420
+ (this.body as any).validate();
6421
+ }
6422
+ super.validate();
6423
+ }
6424
+
6425
+ constructor(map?: { [key: string]: any }) {
6426
+ super(map);
6427
+ }
6428
+ }
6429
+
6238
6430
  export class InitFaceVerifyRequest extends $dara.Model {
6239
6431
  appQualityCheck?: string;
6240
6432
  authId?: string;
@@ -10604,6 +10796,161 @@ export default class Client extends OpenApi {
10604
10796
  return await this.id2MetaVerifyWithOptions(request, runtime);
10605
10797
  }
10606
10798
 
10799
+ /**
10800
+ * 身份二要素图片核验
10801
+ *
10802
+ * @param request - Id2MetaVerifyWithOCRRequest
10803
+ * @param runtime - runtime options for this request RuntimeOptions
10804
+ * @returns Id2MetaVerifyWithOCRResponse
10805
+ */
10806
+ async id2MetaVerifyWithOCRWithOptions(request: Id2MetaVerifyWithOCRRequest, runtime: $dara.RuntimeOptions): Promise<Id2MetaVerifyWithOCRResponse> {
10807
+ request.validate();
10808
+ let body : {[key: string ]: any} = { };
10809
+ if (!$dara.isNull(request.certFile)) {
10810
+ body["CertFile"] = request.certFile;
10811
+ }
10812
+
10813
+ if (!$dara.isNull(request.certNationalFile)) {
10814
+ body["CertNationalFile"] = request.certNationalFile;
10815
+ }
10816
+
10817
+ if (!$dara.isNull(request.certNationalUrl)) {
10818
+ body["CertNationalUrl"] = request.certNationalUrl;
10819
+ }
10820
+
10821
+ if (!$dara.isNull(request.certUrl)) {
10822
+ body["CertUrl"] = request.certUrl;
10823
+ }
10824
+
10825
+ let req = new $OpenApiUtil.OpenApiRequest({
10826
+ body: OpenApiUtil.parseToMap(body),
10827
+ });
10828
+ let params = new $OpenApiUtil.Params({
10829
+ action: "Id2MetaVerifyWithOCR",
10830
+ version: "2019-03-07",
10831
+ protocol: "HTTPS",
10832
+ pathname: "/",
10833
+ method: "POST",
10834
+ authType: "AK",
10835
+ style: "RPC",
10836
+ reqBodyType: "formData",
10837
+ bodyType: "json",
10838
+ });
10839
+ return $dara.cast<Id2MetaVerifyWithOCRResponse>(await this.callApi(params, req, runtime), new Id2MetaVerifyWithOCRResponse({}));
10840
+ }
10841
+
10842
+ /**
10843
+ * 身份二要素图片核验
10844
+ *
10845
+ * @param request - Id2MetaVerifyWithOCRRequest
10846
+ * @returns Id2MetaVerifyWithOCRResponse
10847
+ */
10848
+ async id2MetaVerifyWithOCR(request: Id2MetaVerifyWithOCRRequest): Promise<Id2MetaVerifyWithOCRResponse> {
10849
+ let runtime = new $dara.RuntimeOptions({ });
10850
+ return await this.id2MetaVerifyWithOCRWithOptions(request, runtime);
10851
+ }
10852
+
10853
+ async id2MetaVerifyWithOCRAdvance(request: Id2MetaVerifyWithOCRAdvanceRequest, runtime: $dara.RuntimeOptions): Promise<Id2MetaVerifyWithOCRResponse> {
10854
+ // Step 0: init client
10855
+ let accessKeyId = await this._credential.getAccessKeyId();
10856
+ let accessKeySecret = await this._credential.getAccessKeySecret();
10857
+ let securityToken = await this._credential.getSecurityToken();
10858
+ let credentialType = this._credential.getType();
10859
+ let openPlatformEndpoint = this._openPlatformEndpoint;
10860
+ if ($dara.isNull(openPlatformEndpoint)) {
10861
+ openPlatformEndpoint = "openplatform.aliyuncs.com";
10862
+ }
10863
+
10864
+ if ($dara.isNull(credentialType)) {
10865
+ credentialType = "access_key";
10866
+ }
10867
+
10868
+ let authConfig = new $OpenApiUtil.Config({
10869
+ accessKeyId: accessKeyId,
10870
+ accessKeySecret: accessKeySecret,
10871
+ securityToken: securityToken,
10872
+ type: credentialType,
10873
+ endpoint: openPlatformEndpoint,
10874
+ protocol: this._protocol,
10875
+ regionId: this._regionId,
10876
+ });
10877
+ let authClient = new OpenPlatform(authConfig);
10878
+ let authRequest = new $OpenPlatform.AuthorizeFileUploadRequest({
10879
+ product: "Cloudauth",
10880
+ regionId: this._regionId,
10881
+ });
10882
+ let authResponse = new $OpenPlatform.AuthorizeFileUploadResponse({ });
10883
+ let ossConfig = new $OSS.Config({
10884
+ accessKeyId: accessKeyId,
10885
+ accessKeySecret: accessKeySecret,
10886
+ type: "access_key",
10887
+ protocol: this._protocol,
10888
+ regionId: this._regionId,
10889
+ });
10890
+ let ossClient : OSS = new OSS(ossConfig);
10891
+ let fileObj = new $FileForm.FileField({ });
10892
+ let ossHeader = new $OSS.PostObjectRequestHeader({ });
10893
+ let uploadRequest = new $OSS.PostObjectRequest({ });
10894
+ let ossRuntime = new $OSSUtil.RuntimeOptions({ });
10895
+ OpenApiUtil.convert(runtime, ossRuntime);
10896
+ let id2MetaVerifyWithOCRReq = new Id2MetaVerifyWithOCRRequest({ });
10897
+ OpenApiUtil.convert(request, id2MetaVerifyWithOCRReq);
10898
+ if (!$dara.isNull(request.certFileObject)) {
10899
+ authResponse = await authClient.authorizeFileUploadWithOptions(authRequest, runtime);
10900
+ ossConfig.accessKeyId = authResponse.body.accessKeyId;
10901
+ ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, this._endpointType);
10902
+ ossClient = new OSS(ossConfig);
10903
+ fileObj = new $FileForm.FileField({
10904
+ filename: authResponse.body.objectKey,
10905
+ content: request.certFileObject,
10906
+ contentType: "",
10907
+ });
10908
+ ossHeader = new $OSS.PostObjectRequestHeader({
10909
+ accessKeyId: authResponse.body.accessKeyId,
10910
+ policy: authResponse.body.encodedPolicy,
10911
+ signature: authResponse.body.signature,
10912
+ key: authResponse.body.objectKey,
10913
+ file: fileObj,
10914
+ successActionStatus: "201",
10915
+ });
10916
+ uploadRequest = new $OSS.PostObjectRequest({
10917
+ bucketName: authResponse.body.bucket,
10918
+ header: ossHeader,
10919
+ });
10920
+ await ossClient.postObject(uploadRequest, ossRuntime);
10921
+ id2MetaVerifyWithOCRReq.certFile = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
10922
+ }
10923
+
10924
+ if (!$dara.isNull(request.certNationalFileObject)) {
10925
+ authResponse = await authClient.authorizeFileUploadWithOptions(authRequest, runtime);
10926
+ ossConfig.accessKeyId = authResponse.body.accessKeyId;
10927
+ ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, this._endpointType);
10928
+ ossClient = new OSS(ossConfig);
10929
+ fileObj = new $FileForm.FileField({
10930
+ filename: authResponse.body.objectKey,
10931
+ content: request.certNationalFileObject,
10932
+ contentType: "",
10933
+ });
10934
+ ossHeader = new $OSS.PostObjectRequestHeader({
10935
+ accessKeyId: authResponse.body.accessKeyId,
10936
+ policy: authResponse.body.encodedPolicy,
10937
+ signature: authResponse.body.signature,
10938
+ key: authResponse.body.objectKey,
10939
+ file: fileObj,
10940
+ successActionStatus: "201",
10941
+ });
10942
+ uploadRequest = new $OSS.PostObjectRequest({
10943
+ bucketName: authResponse.body.bucket,
10944
+ header: ossHeader,
10945
+ });
10946
+ await ossClient.postObject(uploadRequest, ossRuntime);
10947
+ id2MetaVerifyWithOCRReq.certNationalFile = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
10948
+ }
10949
+
10950
+ let id2MetaVerifyWithOCRResp = await this.id2MetaVerifyWithOCRWithOptions(id2MetaVerifyWithOCRReq, runtime);
10951
+ return id2MetaVerifyWithOCRResp;
10952
+ }
10953
+
10607
10954
  /**
10608
10955
  * @param request - InitFaceVerifyRequest
10609
10956
  * @param runtime - runtime options for this request RuntimeOptions