node-cnb 1.2.13 → 1.4.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/README.md CHANGED
@@ -5,13 +5,13 @@
5
5
 
6
6
  node-cnb 是一个用于访问 [CNB API](https://api.cnb.cool/) 的 node 编写的 SDK。
7
7
 
8
- # 安装
8
+ ## 安装
9
9
 
10
10
  ```shell
11
11
  npm install node-cnb
12
12
  ```
13
13
 
14
- # 使用
14
+ ## 使用
15
15
 
16
16
  ```typescript
17
17
  import { getClient } from "node-cnb";
@@ -40,7 +40,7 @@ client.users.pinnedRepos.list({
40
40
  })
41
41
  ```
42
42
 
43
- # 方法路径
43
+ ## 方法路径
44
44
 
45
45
  方法路径为由如下几个元素组成:
46
46
 
@@ -52,6 +52,6 @@ client.users.pinnedRepos.list({
52
52
 
53
53
  `/{repo}/-/git/branches` 的路径下 get 请求的方法名为 `repo.git.branches.list`
54
54
 
55
- `'/{repo}/-/git/branches/{branch}'` 的路径下 get 请求方法名为 `repo.git.branches.get`
55
+ `/{repo}/-/git/branches/{branch}` 的路径下 get 请求方法名为 `repo.git.branches.get`
56
56
 
57
57
  对于此规则下方法路径仍然重复的 api,则单独定义在 [pathMethodMap.json](./pathMethodMap.json)
package/dist/paths.json CHANGED
@@ -2242,7 +2242,7 @@
2242
2242
  "BearerAuth": []
2243
2243
  }
2244
2244
  ],
2245
- "description": "访问令牌调用此接口需包含以下权限 \nregistry-package-delete:rw",
2245
+ "description": "访问令牌调用此接口需包含以下权限 \nrepo-registry-delete:rw",
2246
2246
  "consumes": null,
2247
2247
  "produces": [
2248
2248
  "application/vnd.cnb.api+json",
@@ -2686,72 +2686,6 @@
2686
2686
  "method": "get"
2687
2687
  }
2688
2688
  ],
2689
- "repo.contributor.trend.list": [
2690
- {
2691
- "security": [
2692
- {
2693
- "BearerAuth": []
2694
- }
2695
- ],
2696
- "description": "访问令牌调用此接口需包含以下权限 \nrepo-code:r",
2697
- "consumes": null,
2698
- "produces": [
2699
- "application/vnd.cnb.web+json"
2700
- ],
2701
- "tags": [
2702
- "RepoContributor"
2703
- ],
2704
- "summary": "查询仓库贡献者前 100 名的详细趋势数据",
2705
- "parameters": [
2706
- {
2707
- "description": "slug",
2708
- "in": "path",
2709
- "name": "repo",
2710
- "required": true,
2711
- "type": "string"
2712
- },
2713
- {
2714
- "default": 14,
2715
- "description": "limit, 0~100",
2716
- "in": "query",
2717
- "name": "limit",
2718
- "type": "integer"
2719
- },
2720
- {
2721
- "default": false,
2722
- "description": "exclude_external_users, true|false",
2723
- "in": "query",
2724
- "name": "exclude_external_users",
2725
- "type": "boolean"
2726
- }
2727
- ],
2728
- "responses": {
2729
- "200": {
2730
- "description": "OK",
2731
- "schema": {
2732
- "items": {
2733
- "$ref": "#/definitions/web.RepoContribTrend"
2734
- },
2735
- "type": "array"
2736
- }
2737
- },
2738
- "404": {
2739
- "description": "Not Found",
2740
- "schema": {
2741
- "$ref": "#/definitions/die.WebError"
2742
- }
2743
- },
2744
- "500": {
2745
- "description": "Internal Server Error",
2746
- "schema": {
2747
- "$ref": "#/definitions/die.WebError"
2748
- }
2749
- }
2750
- },
2751
- "path": "/{repo}/-/contributor/trend",
2752
- "method": "get"
2753
- }
2754
- ],
2755
2689
  "repo.files.get": [
2756
2690
  {
2757
2691
  "security": [
@@ -4758,16 +4692,14 @@
4758
4692
  },
4759
4693
  "path": "/{repo}/-/issues",
4760
4694
  "method": "get"
4761
- }
4762
- ],
4763
- "repo.issues.post": [
4695
+ },
4764
4696
  {
4765
4697
  "security": [
4766
4698
  {
4767
4699
  "BearerAuth": []
4768
4700
  }
4769
4701
  ],
4770
- "description": "访问令牌调用此接口需包含以下权限 \nrepo-notes:rw",
4702
+ "description": "访问令牌调用此接口需包含以下权限 \nrepo-notes:r",
4771
4703
  "consumes": null,
4772
4704
  "produces": [
4773
4705
  "application/json",
@@ -4776,7 +4708,7 @@
4776
4708
  "tags": [
4777
4709
  "Issues"
4778
4710
  ],
4779
- "summary": "创建一个 Issue",
4711
+ "summary": "查询指定的 Issues",
4780
4712
  "parameters": [
4781
4713
  {
4782
4714
  "description": "repo",
@@ -4786,20 +4718,21 @@
4786
4718
  "type": "string"
4787
4719
  },
4788
4720
  {
4789
- "description": "Post Issue Form",
4790
- "in": "body",
4791
- "name": "post_issue_form",
4721
+ "description": "issue number",
4722
+ "in": "path",
4723
+ "name": "number",
4792
4724
  "required": true,
4793
- "schema": {
4794
- "$ref": "#/definitions/api.PostIssueForm"
4795
- }
4725
+ "type": "integer"
4796
4726
  }
4797
4727
  ],
4798
4728
  "responses": {
4799
- "201": {
4800
- "description": "Created",
4729
+ "200": {
4730
+ "description": "OK",
4801
4731
  "schema": {
4802
- "$ref": "#/definitions/api.IssueDetail"
4732
+ "items": {
4733
+ "$ref": "#/definitions/api.IssueDetail"
4734
+ },
4735
+ "type": "array"
4803
4736
  }
4804
4737
  },
4805
4738
  "404": {
@@ -4815,18 +4748,18 @@
4815
4748
  }
4816
4749
  }
4817
4750
  },
4818
- "path": "/{repo}/-/issues",
4819
- "method": "post"
4751
+ "path": "/{repo}/-/issues/{number}",
4752
+ "method": "get"
4820
4753
  }
4821
4754
  ],
4822
- "repo.issues.get": [
4755
+ "repo.issues.post": [
4823
4756
  {
4824
4757
  "security": [
4825
4758
  {
4826
4759
  "BearerAuth": []
4827
4760
  }
4828
4761
  ],
4829
- "description": "访问令牌调用此接口需包含以下权限 \nrepo-notes:r",
4762
+ "description": "访问令牌调用此接口需包含以下权限 \nrepo-notes:rw",
4830
4763
  "consumes": null,
4831
4764
  "produces": [
4832
4765
  "application/json",
@@ -4835,7 +4768,7 @@
4835
4768
  "tags": [
4836
4769
  "Issues"
4837
4770
  ],
4838
- "summary": "查询指定的 Issues",
4771
+ "summary": "创建一个 Issue",
4839
4772
  "parameters": [
4840
4773
  {
4841
4774
  "description": "repo",
@@ -4845,16 +4778,18 @@
4845
4778
  "type": "string"
4846
4779
  },
4847
4780
  {
4848
- "description": "issue number",
4849
- "in": "path",
4850
- "name": "number",
4781
+ "description": "Post Issue Form",
4782
+ "in": "body",
4783
+ "name": "post_issue_form",
4851
4784
  "required": true,
4852
- "type": "integer"
4785
+ "schema": {
4786
+ "$ref": "#/definitions/api.PostIssueForm"
4787
+ }
4853
4788
  }
4854
4789
  ],
4855
4790
  "responses": {
4856
- "200": {
4857
- "description": "OK",
4791
+ "201": {
4792
+ "description": "Created",
4858
4793
  "schema": {
4859
4794
  "$ref": "#/definitions/api.IssueDetail"
4860
4795
  }
@@ -4872,8 +4807,8 @@
4872
4807
  }
4873
4808
  }
4874
4809
  },
4875
- "path": "/{repo}/-/issues/{number}",
4876
- "method": "get"
4810
+ "path": "/{repo}/-/issues",
4811
+ "method": "post"
4877
4812
  }
4878
4813
  ],
4879
4814
  "repo.issues.patch": [
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "node-cnb",
3
- "version": "1.2.13",
3
+ "version": "1.4.0",
4
4
  "description": "node sdk for cnb open api",
5
5
  "main": "dist/index.js",
6
6
  "typings": "./src/index.d.ts",
7
7
  "scripts": {
8
8
  "test": "echo \"Error: no test specified\" && exit 1",
9
9
  "build": "node build.js && tsc && cp src/*.json dist/",
10
+ "sync-swagger": "wget -O openapi_swagger.json https://api.cnb.cool/swagger.json",
10
11
  "release": "standard-version && git push --follow-tags origin main"
11
12
  },
12
13
  "repository": {
package/src/client.d.ts CHANGED
@@ -17,7 +17,6 @@ import {
17
17
  DtoBuildLogsResult,
18
18
  DtoBuildResult,
19
19
  DtoBuildStatusResult,
20
- WebRepoContribTrend,
21
20
  DtoForks,
22
21
  ApiBranch,
23
22
  ApiBranchDetail,
@@ -371,16 +370,6 @@ export interface Client {
371
370
  };
372
371
  };
373
372
 
374
- contributor: {
375
- trend: {
376
- list: (params: {
377
- repo: string;
378
- limit?: number;
379
- exclude_external_users?: boolean;
380
- }) => Promise<WebRepoContribTrend[]>;
381
- };
382
- };
383
-
384
373
  files: {
385
374
  get: (params: {
386
375
  repo: string;
@@ -600,11 +589,6 @@ export interface Client {
600
589
 
601
590
  post: (params: { repo: string; post_issue_form: any }) => Promise<any>;
602
591
 
603
- get: (params: {
604
- repo: string;
605
- number: number;
606
- }) => Promise<ApiIssueDetail>;
607
-
608
592
  patch: (params: {
609
593
  repo: string;
610
594
  number: number;
package/src/types.d.ts CHANGED
@@ -764,27 +764,20 @@ export type DtoBoolResponse = {
764
764
  };
765
765
 
766
766
  export type DtoBudget = {
767
- /**单位:核时*/
768
- charge_type_ci: number;
769
767
  charge_type_ci_policy: number;
770
768
 
771
769
  /**ci价格,单位:分*/
772
770
  charge_type_ci_price: number;
773
- charge_type_dev: number;
774
771
  charge_type_dev_policy: number;
775
772
 
776
773
  /**开发价格,单位:分*/
777
774
  charge_type_dev_price: number;
778
775
 
779
- /**单位:Gib*/
780
- charge_type_git: number;
781
-
782
776
  /**折扣,没折扣是100*/
783
777
  charge_type_git_policy: number;
784
778
 
785
779
  /**git存储价格,单位:分*/
786
780
  charge_type_git_price: number;
787
- charge_type_object: number;
788
781
  charge_type_object_policy: number;
789
782
 
790
783
  /**对象存储价格,单位:分*/
@@ -792,14 +785,11 @@ export type DtoBudget = {
792
785
 
793
786
  /**预算单名称*/
794
787
  name: string;
795
- status: DtoBudgetSts;
796
788
 
797
789
  /**云账号id*/
798
790
  uin: string;
799
791
  };
800
792
 
801
- export type DtoBudgetSts = number;
802
-
803
793
  export type DtoBuildLogsResult = {
804
794
  /**构建数据列表*/
805
795
  data: DtoLogInfo[];
@@ -3312,10 +3302,6 @@ export type WebRepository = {
3312
3302
  ssh_clone_url: string;
3313
3303
  };
3314
3304
 
3315
- export type WebResource = {
3316
- type: string;
3317
- };
3318
-
3319
3305
  export type WebSignature = {
3320
3306
  date: string;
3321
3307
  email: string;
@@ -3579,7 +3565,6 @@ export type WebapiPullRequestNumber = {
3579
3565
  };
3580
3566
 
3581
3567
  export type WebapiPullRequestReviewId = {
3582
- comment_ids: string[];
3583
3568
  review_id: string;
3584
3569
  };
3585
3570