ksyun-sdk-node 1.5.8 → 1.5.9

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/README.md CHANGED
@@ -31,24 +31,24 @@
31
31
  ```js
32
32
  const kscSdk = require('ksyun-sdk-node')
33
33
 
34
- const Client = kscSdk.Iam.v20151101
34
+ const IamClient = kscSdk.Iam.v20151101
35
35
  const clientConfig = {
36
- // 认证信息
37
- credential: {
38
- secretId: '',
39
- secretKey: '',
40
- },
41
- // 产品地域
42
- region: "cn-beijing-6",
43
- // 可选配置实例
44
- httpProfile: {
45
- method: 'POST', // 请求方法 GET 或者 POST
46
- timeout: 60, // 请求超时时间秒
47
- protocol: '', // 协议 http:// 或者 https://
48
- endpoint: '' // 接入点域名 如 iam.api.ksyun.com
49
- },
36
+ // 认证信息
37
+ credential: {
38
+ secretId: "KSYUN_SECRET_ID_HERE",
39
+ secretKey: "KSYUN_SECRET_KEY_HERE",
40
+ },
41
+ // 产品地域
42
+ region: "cn-beijing-6",
43
+ // 可选配置实例
44
+ httpProfile: {
45
+ method: 'POST',
46
+ timeout: 60, // 请求超时时间秒
47
+ protocol: '',
48
+ endpoint: 'iam.api.ksyun.com',
49
+ },
50
50
  }
51
- let client = new Client(clientConfig)
51
+ let client = new IamClient(clientConfig)
52
52
 
53
53
  /**
54
54
  * client.request 参数
@@ -56,19 +56,19 @@ let client = new Client(clientConfig)
56
56
  * @param {object} data 参数
57
57
  */
58
58
 
59
- let apiAction = 'GetUser'
59
+ let apiAction = 'ListUsers'
60
60
  let data = {
61
- "UserName": "test14"
61
+ "MaxItems": 100
62
62
  }
63
63
 
64
64
  client.request(apiAction, data)
65
- .then(res => res.json())
66
- .then(data => {
67
- console.log(JSON.stringify(data))
68
- })
69
- .catch(err => {
70
- console.log(err)
71
- })
65
+ .then(res => res.json())
66
+ .then(data => {
67
+ console.log(JSON.stringify(data))
68
+ })
69
+ .catch(err => {
70
+ console.log(err)
71
+ })
72
72
  ```
73
73
 
74
74
  # 更多示例
@@ -40,7 +40,8 @@ module.exports = class BaseClient {
40
40
  let region = this.region || this._baseConfig.config.credentials.region;
41
41
  let headers = {
42
42
  ...(this._baseConfig.config.headers || {}),
43
- ...(apiConfig.config.headers || {})
43
+ ...(apiConfig.config.headers || {}),
44
+ ...(this.httpProfile.headers || {})
44
45
  };
45
46
 
46
47
  // 处理自定义path
package/example/iam.js CHANGED
@@ -1,24 +1,23 @@
1
- const kscSdk = require('../src/index.js')
1
+ const kscSdk = require('ksyun-sdk-node')
2
2
 
3
- const Client = kscSdk.Iam.v20151101
3
+ const IamClient = kscSdk.Iam.v20151101
4
4
  const clientConfig = {
5
5
  // 认证信息
6
6
  credential: {
7
- secretId: '',
8
- secretKey: '',
7
+ secretId: "KSYUN_SECRET_ID_HERE",
8
+ secretKey: "KSYUN_SECRET_KEY_HERE",
9
9
  },
10
10
  // 产品地域
11
11
  region: "cn-beijing-6",
12
12
  // 可选配置实例
13
13
  httpProfile: {
14
- method: 'POST', // 请求方法 GET 或者 POST
14
+ method: 'POST',
15
15
  timeout: 60, // 请求超时时间秒
16
- protocol: '', // 协议 http:// 或者 https://
17
- endpoint: '', // 接入点域名 如 iam.api.ksyun.com
18
- path: '' // 自定义URL路径 如 /api/v1/xxx
16
+ protocol: '',
17
+ endpoint: 'iam.api.ksyun.com',
19
18
  },
20
19
  }
21
- let client = new Client(clientConfig)
20
+ let client = new IamClient(clientConfig)
22
21
 
23
22
  /**
24
23
  * client.request 参数
@@ -26,9 +25,9 @@ let client = new Client(clientConfig)
26
25
  * @param {object} data 参数
27
26
  */
28
27
 
29
- let apiAction = 'GetUser'
28
+ let apiAction = 'ListUsers'
30
29
  let data = {
31
- "UserName": "test14"
30
+ "MaxItems": 100
32
31
  }
33
32
 
34
33
  client.request(apiAction, data)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ksyun-sdk-node",
3
- "version": "1.5.8",
3
+ "version": "1.5.9",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -36,7 +36,8 @@ module.exports = class BaseClient {
36
36
  let region = this.region || this._baseConfig.config.credentials.region
37
37
  let headers = {
38
38
  ...(this._baseConfig.config.headers || {}),
39
- ...(apiConfig.config.headers || {})
39
+ ...(apiConfig.config.headers || {}),
40
+ ...(this.httpProfile.headers || {})
40
41
  }
41
42
 
42
43
  // 处理自定义path
package/example/res.js DELETED
@@ -1,44 +0,0 @@
1
- const kscSdk = require('../src/index.js')
2
-
3
- const Client = kscSdk.Resourcemanager.v20210320
4
- const clientConfig = {
5
- // 认证信息
6
- credential: {
7
- secretId: '',
8
- secretKey: '',
9
- },
10
- // 产品地域
11
- region: "cn-beijing-6",
12
- // 可选配置实例
13
- httpProfile: {
14
- method: '', // 请求方法 get 或者 post
15
- timeout: 60, // 请求超时时间秒
16
- protocol: 'http://', // 协议 http:// 或者 https://
17
- endpoint: '', // 接入点域名 如 iam.api.ksyun.com
18
- path: '' // 自定义URL路径 如 /api/v1/xxx
19
- },
20
- }
21
- let client = new Client(clientConfig)
22
-
23
- /**
24
- * client.request 参数
25
- * @param {string} apiAction 接口名
26
- * @param {object} data 参数
27
- */
28
-
29
- let apiAction = 'ListFolders'
30
- let data = {
31
- }
32
-
33
- client.request(apiAction, data)
34
- // .then(res => {
35
- // console.log(res)
36
- // return res
37
- // })
38
- .then(res => res.json())
39
- .then(data => {
40
- console.log(JSON.stringify(data))
41
- })
42
- .catch(err => {
43
- console.log(err)
44
- })