@scaleway/sdk 2.0.0-alpha.13 → 2.0.0-alpha.15

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 (215) hide show
  1. package/dist/api/account/index.js +4 -0
  2. package/dist/api/account/v2/api.gen.js +147 -0
  3. package/dist/api/account/v2/index.gen.js +4 -0
  4. package/dist/api/account/v2/marshalling.gen.js +39 -0
  5. package/dist/api/account/v3/api.gen.js +129 -0
  6. package/dist/api/account/v3/index.gen.js +6 -0
  7. package/dist/api/account/v3/marshalling.gen.js +39 -0
  8. package/dist/api/account/v3/validation-rules.gen.js +39 -0
  9. package/dist/api/applesilicon/index.js +2 -0
  10. package/dist/api/applesilicon/v1alpha1/api.gen.js +220 -0
  11. package/dist/api/applesilicon/v1alpha1/content.gen.js +7 -0
  12. package/dist/api/applesilicon/v1alpha1/index.gen.js +5 -0
  13. package/dist/api/applesilicon/v1alpha1/marshalling.gen.js +113 -0
  14. package/dist/api/baremetal/index.js +2 -0
  15. package/dist/api/baremetal/v1/api.gen.js +523 -0
  16. package/dist/api/baremetal/v1/api.utils.js +27 -0
  17. package/dist/api/baremetal/v1/content.gen.js +13 -0
  18. package/dist/api/baremetal/v1/index.js +5 -0
  19. package/dist/api/baremetal/v1/marshalling.gen.js +406 -0
  20. package/dist/api/baremetal/v1/validation-rules.gen.js +109 -0
  21. package/dist/api/billing/index.js +2 -0
  22. package/dist/api/billing/v2alpha1/api.gen.js +80 -0
  23. package/dist/api/billing/v2alpha1/index.gen.js +4 -0
  24. package/dist/api/billing/v2alpha1/marshalling.gen.js +53 -0
  25. package/dist/api/block/index.js +2 -0
  26. package/dist/api/block/v1alpha1/api.gen.js +249 -0
  27. package/dist/api/block/v1alpha1/content.gen.js +13 -0
  28. package/dist/api/block/v1alpha1/index.gen.js +7 -0
  29. package/dist/api/block/v1alpha1/marshalling.gen.js +182 -0
  30. package/dist/api/block/v1alpha1/validation-rules.gen.js +52 -0
  31. package/dist/api/cockpit/index.js +2 -0
  32. package/dist/api/cockpit/v1beta1/api.gen.js +543 -0
  33. package/dist/api/cockpit/v1beta1/content.gen.js +7 -0
  34. package/dist/api/cockpit/v1beta1/index.gen.js +5 -0
  35. package/dist/api/cockpit/v1beta1/marshalling.gen.js +271 -0
  36. package/dist/api/container/index.js +2 -0
  37. package/dist/api/container/v1beta1/api.gen.js +549 -0
  38. package/dist/api/container/v1beta1/content.gen.js +22 -0
  39. package/dist/api/container/v1beta1/index.gen.js +7 -0
  40. package/dist/api/container/v1beta1/marshalling.gen.js +358 -0
  41. package/dist/api/container/v1beta1/validation-rules.gen.js +44 -0
  42. package/dist/api/document_db/index.js +2 -0
  43. package/dist/api/document_db/v1beta1/api.gen.js +830 -0
  44. package/dist/api/document_db/v1beta1/content.gen.js +19 -0
  45. package/dist/api/document_db/v1beta1/index.gen.js +7 -0
  46. package/dist/api/document_db/v1beta1/marshalling.gen.js +636 -0
  47. package/dist/api/document_db/v1beta1/validation-rules.gen.js +10 -0
  48. package/dist/api/domain/index.js +2 -0
  49. package/dist/api/domain/v2beta1/api.gen.js +867 -0
  50. package/dist/api/domain/v2beta1/content.gen.js +28 -0
  51. package/dist/api/domain/v2beta1/index.gen.js +5 -0
  52. package/dist/api/domain/v2beta1/marshalling.gen.js +1172 -0
  53. package/dist/api/flexibleip/index.js +2 -0
  54. package/dist/api/flexibleip/v1alpha1/api.gen.js +195 -0
  55. package/dist/api/flexibleip/v1alpha1/content.gen.js +10 -0
  56. package/dist/api/flexibleip/v1alpha1/index.gen.js +7 -0
  57. package/dist/api/flexibleip/v1alpha1/marshalling.gen.js +97 -0
  58. package/dist/api/flexibleip/v1alpha1/validation-rules.gen.js +14 -0
  59. package/dist/api/function/index.js +2 -0
  60. package/dist/api/function/v1beta1/api.gen.js +560 -0
  61. package/dist/api/function/v1beta1/content.gen.js +22 -0
  62. package/dist/api/function/v1beta1/index.gen.js +7 -0
  63. package/dist/api/function/v1beta1/marshalling.gen.js +396 -0
  64. package/dist/api/function/v1beta1/validation-rules.gen.js +44 -0
  65. package/dist/api/iam/index.js +2 -0
  66. package/dist/api/iam/v1alpha1/api.gen.js +783 -0
  67. package/dist/api/iam/v1alpha1/index.gen.js +6 -0
  68. package/dist/api/iam/v1alpha1/marshalling.gen.js +384 -0
  69. package/dist/api/iam/v1alpha1/validation-rules.gen.js +207 -0
  70. package/dist/api/instance/index.js +2 -0
  71. package/dist/api/instance/v1/api.gen.js +1003 -0
  72. package/dist/api/instance/v1/api.utils.js +369 -0
  73. package/dist/api/instance/v1/content.gen.js +31 -0
  74. package/dist/api/instance/v1/index.js +2 -0
  75. package/dist/api/instance/v1/marshalling.gen.js +1415 -0
  76. package/dist/api/instance/v1/marshalling.utils.js +63 -0
  77. package/dist/api/iot/index.js +2 -0
  78. package/dist/api/iot/v1/api.gen.js +573 -0
  79. package/dist/api/iot/v1/content.gen.js +7 -0
  80. package/dist/api/iot/v1/index.gen.js +5 -0
  81. package/dist/api/iot/v1/marshalling.gen.js +439 -0
  82. package/dist/api/ipam/index.js +2 -0
  83. package/dist/api/ipam/v1/api.gen.js +113 -0
  84. package/dist/api/ipam/v1/index.gen.js +6 -0
  85. package/dist/api/ipam/v1/marshalling.gen.js +77 -0
  86. package/dist/api/ipam/v1/validation-rules.gen.js +11 -0
  87. package/dist/api/ipfs/index.js +2 -0
  88. package/dist/api/ipfs/v1alpha1/api.gen.js +314 -0
  89. package/dist/api/ipfs/v1alpha1/content.gen.js +10 -0
  90. package/dist/api/ipfs/v1alpha1/index.gen.js +5 -0
  91. package/dist/api/ipfs/v1alpha1/marshalling.gen.js +180 -0
  92. package/dist/api/k8s/index.js +2 -0
  93. package/dist/api/k8s/v1/api.gen.js +454 -0
  94. package/dist/api/k8s/v1/api.utils.js +13 -0
  95. package/dist/api/k8s/v1/content.gen.js +13 -0
  96. package/dist/api/k8s/v1/index.js +4 -0
  97. package/dist/api/k8s/v1/marshalling.gen.js +421 -0
  98. package/dist/api/k8s/v1/validation-rules.gen.js +101 -0
  99. package/dist/api/lb/index.js +2 -0
  100. package/dist/api/lb/v1/api.gen.js +1669 -0
  101. package/dist/api/lb/v1/api.utils.js +81 -0
  102. package/dist/api/lb/v1/content.gen.js +16 -0
  103. package/dist/api/lb/v1/index.js +2 -0
  104. package/dist/api/lb/v1/marshalling.gen.js +1039 -0
  105. package/dist/api/marketplace/index.js +4 -0
  106. package/dist/api/marketplace/v1/api.gen.js +60 -0
  107. package/dist/api/marketplace/v1/index.gen.js +4 -0
  108. package/dist/api/marketplace/v1/marshalling.gen.js +92 -0
  109. package/dist/api/marketplace/v2/api.gen.js +162 -0
  110. package/dist/api/marketplace/v2/index.gen.js +4 -0
  111. package/dist/api/marketplace/v2/marshalling.gen.js +94 -0
  112. package/dist/api/mnq/index.js +4 -0
  113. package/dist/api/mnq/v1alpha1/api.gen.js +197 -0
  114. package/dist/api/mnq/v1alpha1/index.gen.js +4 -0
  115. package/dist/api/mnq/v1alpha1/marshalling.gen.js +126 -0
  116. package/dist/api/mnq/v1beta1/api.gen.js +529 -0
  117. package/dist/api/mnq/v1beta1/index.gen.js +6 -0
  118. package/dist/api/mnq/v1beta1/marshalling.gen.js +212 -0
  119. package/dist/api/mnq/v1beta1/validation-rules.gen.js +77 -0
  120. package/dist/api/rdb/index.js +2 -0
  121. package/dist/api/rdb/v1/api.gen.js +972 -0
  122. package/dist/api/rdb/v1/content.gen.js +22 -0
  123. package/dist/api/rdb/v1/index.gen.js +7 -0
  124. package/dist/api/rdb/v1/marshalling.gen.js +694 -0
  125. package/dist/api/rdb/v1/validation-rules.gen.js +10 -0
  126. package/dist/api/redis/index.js +2 -0
  127. package/dist/api/redis/v1/api.gen.js +389 -0
  128. package/dist/api/redis/v1/content.gen.js +7 -0
  129. package/dist/api/redis/v1/index.gen.js +5 -0
  130. package/dist/api/redis/v1/marshalling.gen.js +283 -0
  131. package/dist/api/registry/index.js +2 -0
  132. package/dist/api/registry/v1/api.gen.js +252 -0
  133. package/dist/api/registry/v1/content.gen.js +13 -0
  134. package/dist/api/registry/v1/index.gen.js +5 -0
  135. package/dist/api/registry/v1/marshalling.gen.js +108 -0
  136. package/dist/api/secret/index.js +2 -0
  137. package/dist/api/secret/v1alpha1/api.gen.js +415 -0
  138. package/dist/api/secret/v1alpha1/index.gen.js +4 -0
  139. package/dist/api/secret/v1alpha1/marshalling.gen.js +150 -0
  140. package/dist/api/tem/index.js +2 -0
  141. package/dist/api/tem/v1alpha1/api.gen.js +229 -0
  142. package/dist/api/tem/v1alpha1/content.gen.js +10 -0
  143. package/dist/api/tem/v1alpha1/index.gen.js +5 -0
  144. package/dist/api/tem/v1alpha1/marshalling.gen.js +168 -0
  145. package/dist/api/test/index.js +2 -0
  146. package/dist/api/test/v1/api.gen.js +152 -0
  147. package/dist/api/test/v1/content.gen.js +7 -0
  148. package/dist/api/test/v1/index.gen.js +5 -0
  149. package/dist/api/test/v1/marshalling.gen.js +81 -0
  150. package/dist/api/vpc/index.js +4 -0
  151. package/dist/api/vpc/v1/api.gen.js +110 -0
  152. package/dist/api/vpc/v1/index.gen.js +4 -0
  153. package/dist/api/vpc/v1/marshalling.gen.js +44 -0
  154. package/dist/api/vpc/v2/api.gen.js +276 -0
  155. package/dist/api/vpc/v2/index.gen.js +4 -0
  156. package/dist/api/vpc/v2/marshalling.gen.js +137 -0
  157. package/dist/api/vpcgw/index.js +2 -0
  158. package/dist/api/vpcgw/v1/api.gen.js +669 -0
  159. package/dist/api/vpcgw/v1/content.gen.js +10 -0
  160. package/dist/api/vpcgw/v1/index.gen.js +5 -0
  161. package/dist/api/vpcgw/v1/marshalling.gen.js +359 -0
  162. package/dist/api/webhosting/index.js +2 -0
  163. package/dist/api/webhosting/v1alpha1/api.gen.js +158 -0
  164. package/dist/api/webhosting/v1alpha1/content.gen.js +7 -0
  165. package/dist/api/webhosting/v1alpha1/index.gen.js +7 -0
  166. package/dist/api/webhosting/v1alpha1/marshalling.gen.js +146 -0
  167. package/dist/api/webhosting/v1alpha1/validation-rules.gen.js +14 -0
  168. package/dist/helpers/is-browser.js +5 -0
  169. package/dist/helpers/is-response.js +10 -0
  170. package/dist/helpers/json.js +11 -0
  171. package/dist/helpers/marshalling.js +130 -0
  172. package/dist/index.cjs +26484 -0
  173. package/dist/index.d.ts +31184 -0
  174. package/dist/index.js +71 -0
  175. package/dist/internal/async/interval-retrier.js +105 -0
  176. package/dist/internal/async/sleep.js +13 -0
  177. package/dist/internal/interceptors/composer.js +46 -0
  178. package/dist/internal/interceptors/helpers.js +32 -0
  179. package/dist/internal/logger/console-logger.js +38 -0
  180. package/dist/internal/logger/index.js +41 -0
  181. package/dist/internal/logger/level-resolver.js +13 -0
  182. package/dist/internal/validations/string-validation.js +38 -0
  183. package/dist/node_modules/.pnpm/@scaleway_random-name@4.0.2/node_modules/@scaleway/random-name/dist/index.js +13 -0
  184. package/dist/scw/api.js +12 -0
  185. package/dist/scw/auth.js +68 -0
  186. package/dist/scw/client-ini-factory.js +174 -0
  187. package/dist/scw/client-ini-profile.js +54 -0
  188. package/dist/scw/client-settings.js +78 -0
  189. package/dist/scw/client.js +98 -0
  190. package/dist/scw/constants.js +4 -0
  191. package/dist/scw/custom-marshalling.js +131 -0
  192. package/dist/scw/errors/error-parser.js +107 -0
  193. package/dist/scw/errors/non-standard/invalid-request-mapper.js +36 -0
  194. package/dist/scw/errors/non-standard/unknown-resource-mapper.js +27 -0
  195. package/dist/scw/errors/scw-error.js +66 -0
  196. package/dist/scw/errors/standard/already-exists-error.js +26 -0
  197. package/dist/scw/errors/standard/denied-authentication-error.js +52 -0
  198. package/dist/scw/errors/standard/index.js +13 -0
  199. package/dist/scw/errors/standard/invalid-arguments-error.js +67 -0
  200. package/dist/scw/errors/standard/out-of-stock-error.js +22 -0
  201. package/dist/scw/errors/standard/permissions-denied-error.js +48 -0
  202. package/dist/scw/errors/standard/precondition-failed-error.js +42 -0
  203. package/dist/scw/errors/standard/quotas-exceeded-error.js +68 -0
  204. package/dist/scw/errors/standard/resource-expired-error.js +26 -0
  205. package/dist/scw/errors/standard/resource-locked-error.js +25 -0
  206. package/dist/scw/errors/standard/resource-not-found-error.js +25 -0
  207. package/dist/scw/errors/standard/too-many-requests-error.js +70 -0
  208. package/dist/scw/errors/standard/transient-state-error.js +26 -0
  209. package/dist/scw/errors/types.js +23 -0
  210. package/dist/scw/fetch/build-fetcher.js +72 -0
  211. package/dist/scw/fetch/http-dumper.js +54 -0
  212. package/dist/scw/fetch/http-interceptors.js +99 -0
  213. package/dist/scw/fetch/resource-paginator.js +84 -0
  214. package/dist/scw/fetch/response-parser.js +72 -0
  215. package/package.json +2 -2
@@ -0,0 +1,314 @@
1
+ import { waitForResource } from '../../../internal/async/interval-retrier.js';
2
+ import { API as API$1 } from '../../../scw/api.js';
3
+ import { validatePathParam, urlParams } from '../../../helpers/marshalling.js';
4
+ import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
5
+ import { PIN_TRANSIENT_STATUSES, NAME_TRANSIENT_STATUSES } from './content.gen.js';
6
+ import { marshalCreateVolumeRequest, unmarshalVolume, unmarshalListVolumesResponse, marshalUpdateVolumeRequest, marshalCreatePinByURLRequest, unmarshalPin, marshalCreatePinByCIDRequest, marshalReplacePinRequest, unmarshalReplacePinResponse, unmarshalListPinsResponse, marshalIpnsApiCreateNameRequest, unmarshalName, unmarshalListNamesResponse, marshalIpnsApiUpdateNameRequest, unmarshalExportKeyNameResponse, marshalIpnsApiImportKeyNameRequest } from './marshalling.gen.js';
7
+
8
+ // This file was automatically generated. DO NOT EDIT.
9
+ // If you have any remark or suggestion do not hesitate to open an issue.
10
+ const jsonContentHeaders = {
11
+ 'Content-Type': 'application/json; charset=utf-8'
12
+ };
13
+
14
+ /** IPFS Pinning service API. */
15
+ class API extends API$1 {
16
+ /** Lists the available regions of the API. */
17
+ static LOCALITIES = ['fr-par', 'nl-ams', 'pl-waw'];
18
+
19
+ /**
20
+ * Create a new volume. Create a new volume from a Project ID. Volume is
21
+ * identified by an ID and used to host pin references. Volume is personal (at
22
+ * least to your organization) even if IPFS blocks and CID are available to
23
+ * anyone. Should be the first command you made because every pin must be
24
+ * attached to a volume.
25
+ *
26
+ * @param request - The request {@link CreateVolumeRequest}
27
+ * @returns A Promise of Volume
28
+ */
29
+ createVolume = request => this.client.fetch({
30
+ body: JSON.stringify(marshalCreateVolumeRequest(request, this.client.settings)),
31
+ headers: jsonContentHeaders,
32
+ method: 'POST',
33
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/volumes`
34
+ }, unmarshalVolume);
35
+
36
+ /**
37
+ * Get information about a volume. Retrieve information about a specific
38
+ * volume.
39
+ *
40
+ * @param request - The request {@link GetVolumeRequest}
41
+ * @returns A Promise of Volume
42
+ */
43
+ getVolume = request => this.client.fetch({
44
+ method: 'GET',
45
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/volumes/${validatePathParam('volumeId', request.volumeId)}`
46
+ }, unmarshalVolume);
47
+ pageOfListVolumes = (() => {
48
+ var _this = this;
49
+ return function (request) {
50
+ if (request === void 0) {
51
+ request = {};
52
+ }
53
+ return _this.client.fetch({
54
+ method: 'GET',
55
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/volumes`,
56
+ urlParams: urlParams(['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId ?? _this.client.settings.defaultProjectId])
57
+ }, unmarshalListVolumesResponse);
58
+ };
59
+ })();
60
+
61
+ /**
62
+ * List all volumes by a Project ID. Retrieve information about all volumes
63
+ * from a Project ID.
64
+ *
65
+ * @param request - The request {@link ListVolumesRequest}
66
+ * @returns A Promise of ListVolumesResponse
67
+ */
68
+ listVolumes = (() => {
69
+ var _this2 = this;
70
+ return function (request) {
71
+ if (request === void 0) {
72
+ request = {};
73
+ }
74
+ return enrichForPagination('volumes', _this2.pageOfListVolumes, request);
75
+ };
76
+ })();
77
+
78
+ /**
79
+ * Update volume information. Update volume information (tag, name...).
80
+ *
81
+ * @param request - The request {@link UpdateVolumeRequest}
82
+ * @returns A Promise of Volume
83
+ */
84
+ updateVolume = request => this.client.fetch({
85
+ body: JSON.stringify(marshalUpdateVolumeRequest(request, this.client.settings)),
86
+ headers: jsonContentHeaders,
87
+ method: 'PATCH',
88
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/volumes/${validatePathParam('volumeId', request.volumeId)}`
89
+ }, unmarshalVolume);
90
+
91
+ /**
92
+ * Delete an existing volume. Delete a volume by its ID and every pin attached
93
+ * to this volume. This process can take a while to conclude, depending on the
94
+ * size of your pinned content.
95
+ *
96
+ * @param request - The request {@link DeleteVolumeRequest}
97
+ */
98
+ deleteVolume = request => this.client.fetch({
99
+ method: 'DELETE',
100
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/volumes/${validatePathParam('volumeId', request.volumeId)}`
101
+ });
102
+
103
+ /**
104
+ * Create a pin by URL. Will fetch and store the content pointed by the
105
+ * provided URL. The content must be available on the public IPFS network. The
106
+ * content (IPFS blocks) will be host by the pinning service until pin
107
+ * deletion. From that point, any other IPFS peer can fetch and host your
108
+ * content: Make sure to pin public or encrypted content. Many pin requests
109
+ * (from different users) can target the same CID. A pin is defined by its ID
110
+ * (UUID), its status (queued, pinning, pinned or failed) and target CID.
111
+ *
112
+ * @param request - The request {@link CreatePinByURLRequest}
113
+ * @returns A Promise of Pin
114
+ */
115
+ createPinByURL = request => this.client.fetch({
116
+ body: JSON.stringify(marshalCreatePinByURLRequest(request, this.client.settings)),
117
+ headers: jsonContentHeaders,
118
+ method: 'POST',
119
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/pins/create-by-url`
120
+ }, unmarshalPin);
121
+
122
+ /**
123
+ * Create a pin by CID. Will fetch and store the content pointed by the
124
+ * provided CID. The content must be available on the public IPFS network. The
125
+ * content (IPFS blocks) will be host by the pinning service until pin
126
+ * deletion. From that point, any other IPFS peer can fetch and host your
127
+ * content: Make sure to pin public or encrypted content. Many pin requests
128
+ * (from different users) can target the same CID. A pin is defined by its ID
129
+ * (UUID), its status (queued, pinning, pinned or failed) and target CID.
130
+ *
131
+ * @param request - The request {@link CreatePinByCIDRequest}
132
+ * @returns A Promise of Pin
133
+ */
134
+ createPinByCID = request => this.client.fetch({
135
+ body: JSON.stringify(marshalCreatePinByCIDRequest(request, this.client.settings)),
136
+ headers: jsonContentHeaders,
137
+ method: 'POST',
138
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/pins/create-by-cid`
139
+ }, unmarshalPin);
140
+ replacePin = request => this.client.fetch({
141
+ body: JSON.stringify(marshalReplacePinRequest(request, this.client.settings)),
142
+ headers: jsonContentHeaders,
143
+ method: 'POST',
144
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/pins/${validatePathParam('pinId', request.pinId)}/replace`
145
+ }, unmarshalReplacePinResponse);
146
+
147
+ /**
148
+ * Get pin information. Retrieve information about the provided **pin ID**,
149
+ * such as status, last modification, and CID.
150
+ *
151
+ * @param request - The request {@link GetPinRequest}
152
+ * @returns A Promise of Pin
153
+ */
154
+ getPin = request => this.client.fetch({
155
+ method: 'GET',
156
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/pins/${validatePathParam('pinId', request.pinId)}`,
157
+ urlParams: urlParams(['volume_id', request.volumeId])
158
+ }, unmarshalPin);
159
+
160
+ /**
161
+ * Waits for {@link Pin} to be in a final state.
162
+ *
163
+ * @param request - The request {@link GetPinRequest}
164
+ * @param options - The waiting options
165
+ * @returns A Promise of Pin
166
+ */
167
+ waitForPin = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!PIN_TRANSIENT_STATUSES.includes(res.status))), this.getPin, request, options);
168
+ pageOfListPins = request => this.client.fetch({
169
+ method: 'GET',
170
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/pins`,
171
+ urlParams: urlParams(['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['project_id', request.projectId], ['status', request.status], ['volume_id', request.volumeId])
172
+ }, unmarshalListPinsResponse);
173
+
174
+ /**
175
+ * List all pins within a volume. Retrieve information about all pins within a
176
+ * volume.
177
+ *
178
+ * @param request - The request {@link ListPinsRequest}
179
+ * @returns A Promise of ListPinsResponse
180
+ */
181
+ listPins = request => enrichForPagination('pins', this.pageOfListPins, request);
182
+
183
+ /**
184
+ * Create an unpin request. An unpin request means that you no longer own the
185
+ * content. This content can therefore be removed and no longer provided on
186
+ * the IPFS network.
187
+ *
188
+ * @param request - The request {@link DeletePinRequest}
189
+ */
190
+ deletePin = request => this.client.fetch({
191
+ method: 'DELETE',
192
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/pins/${validatePathParam('pinId', request.pinId)}`,
193
+ urlParams: urlParams(['volume_id', request.volumeId])
194
+ });
195
+ }
196
+
197
+ /** IPFS Naming service API. */
198
+ class IpnsAPI extends API$1 {
199
+ /** Lists the available regions of the API. */
200
+ static LOCALITIES = ['fr-par', 'nl-ams', 'pl-waw'];
201
+
202
+ /**
203
+ * Create a new name. You can use the `ipns key` command to list and generate
204
+ * more names and their respective keys.
205
+ *
206
+ * @param request - The request {@link IpnsApiCreateNameRequest}
207
+ * @returns A Promise of Name
208
+ */
209
+ createName = request => this.client.fetch({
210
+ body: JSON.stringify(marshalIpnsApiCreateNameRequest(request, this.client.settings)),
211
+ headers: jsonContentHeaders,
212
+ method: 'POST',
213
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/names`
214
+ }, unmarshalName);
215
+
216
+ /**
217
+ * Get information about a name. Retrieve information about a specific name.
218
+ *
219
+ * @param request - The request {@link IpnsApiGetNameRequest}
220
+ * @returns A Promise of Name
221
+ */
222
+ getName = request => this.client.fetch({
223
+ method: 'GET',
224
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/names/${validatePathParam('nameId', request.nameId)}`
225
+ }, unmarshalName);
226
+
227
+ /**
228
+ * Waits for {@link Name} to be in a final state.
229
+ *
230
+ * @param request - The request {@link IpnsApiGetNameRequest}
231
+ * @param options - The waiting options
232
+ * @returns A Promise of Name
233
+ */
234
+ waitForName = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!NAME_TRANSIENT_STATUSES.includes(res.status))), this.getName, request, options);
235
+
236
+ /**
237
+ * Delete an existing name. Delete a name by its ID.
238
+ *
239
+ * @param request - The request {@link IpnsApiDeleteNameRequest}
240
+ */
241
+ deleteName = request => this.client.fetch({
242
+ method: 'DELETE',
243
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/names/${validatePathParam('nameId', request.nameId)}`
244
+ });
245
+ pageOfListNames = (() => {
246
+ var _this3 = this;
247
+ return function (request) {
248
+ if (request === void 0) {
249
+ request = {};
250
+ }
251
+ return _this3.client.fetch({
252
+ method: 'GET',
253
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? _this3.client.settings.defaultRegion)}/names`,
254
+ urlParams: urlParams(['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this3.client.settings.defaultPageSize], ['project_id', request.projectId])
255
+ }, unmarshalListNamesResponse);
256
+ };
257
+ })();
258
+
259
+ /**
260
+ * List all names by a Project ID. Retrieve information about all names from a
261
+ * Project ID.
262
+ *
263
+ * @param request - The request {@link IpnsApiListNamesRequest}
264
+ * @returns A Promise of ListNamesResponse
265
+ */
266
+ listNames = (() => {
267
+ var _this4 = this;
268
+ return function (request) {
269
+ if (request === void 0) {
270
+ request = {};
271
+ }
272
+ return enrichForPagination('names', _this4.pageOfListNames, request);
273
+ };
274
+ })();
275
+
276
+ /**
277
+ * Update name information. Update name information (CID, tag, name...).
278
+ *
279
+ * @param request - The request {@link IpnsApiUpdateNameRequest}
280
+ * @returns A Promise of Name
281
+ */
282
+ updateName = request => this.client.fetch({
283
+ body: JSON.stringify(marshalIpnsApiUpdateNameRequest(request, this.client.settings)),
284
+ headers: jsonContentHeaders,
285
+ method: 'PATCH',
286
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/names/${validatePathParam('nameId', request.nameId)}`
287
+ }, unmarshalName);
288
+
289
+ /**
290
+ * Export your private key. Export a private key by its ID.
291
+ *
292
+ * @param request - The request {@link IpnsApiExportKeyNameRequest}
293
+ * @returns A Promise of ExportKeyNameResponse
294
+ */
295
+ exportKeyName = request => this.client.fetch({
296
+ method: 'GET',
297
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/names/${validatePathParam('nameId', request.nameId)}/export-key`
298
+ }, unmarshalExportKeyNameResponse);
299
+
300
+ /**
301
+ * Import your private key. Import a private key.
302
+ *
303
+ * @param request - The request {@link IpnsApiImportKeyNameRequest}
304
+ * @returns A Promise of Name
305
+ */
306
+ importKeyName = request => this.client.fetch({
307
+ body: JSON.stringify(marshalIpnsApiImportKeyNameRequest(request, this.client.settings)),
308
+ headers: jsonContentHeaders,
309
+ method: 'POST',
310
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/names/import-key`
311
+ }, unmarshalName);
312
+ }
313
+
314
+ export { API, IpnsAPI };
@@ -0,0 +1,10 @@
1
+ // This file was automatically generated. DO NOT EDIT.
2
+ // If you have any remark or suggestion do not hesitate to open an issue.
3
+
4
+ /** Lists transient statutes of the enum {@link NameStatus}. */
5
+ const NAME_TRANSIENT_STATUSES = ['queued', 'publishing'];
6
+
7
+ /** Lists transient statutes of the enum {@link PinStatus}. */
8
+ const PIN_TRANSIENT_STATUSES = ['queued', 'pinning'];
9
+
10
+ export { NAME_TRANSIENT_STATUSES, PIN_TRANSIENT_STATUSES };
@@ -0,0 +1,5 @@
1
+ export { API, IpnsAPI } from './api.gen.js';
2
+ export { NAME_TRANSIENT_STATUSES, PIN_TRANSIENT_STATUSES } from './content.gen.js';
3
+
4
+ // This file was automatically generated. DO NOT EDIT.
5
+ // If you have any remark or suggestion do not hesitate to open an issue.
@@ -0,0 +1,180 @@
1
+ import { isJSONObject } from '../../../helpers/json.js';
2
+ import { unmarshalDate, unmarshalArrayOfObject } from '../../../helpers/marshalling.js';
3
+
4
+ // This file was automatically generated. DO NOT EDIT.
5
+ // If you have any remark or suggestion do not hesitate to open an issue.
6
+ const unmarshalName = data => {
7
+ if (!isJSONObject(data)) {
8
+ throw new TypeError(`Unmarshalling the type 'Name' failed as data isn't a dictionary.`);
9
+ }
10
+ return {
11
+ createdAt: unmarshalDate(data.created_at),
12
+ key: data.key,
13
+ name: data.name,
14
+ nameId: data.name_id,
15
+ projectId: data.project_id,
16
+ region: data.region,
17
+ status: data.status,
18
+ tags: data.tags,
19
+ updatedAt: unmarshalDate(data.updated_at),
20
+ value: data.value
21
+ };
22
+ };
23
+ const unmarshalPinCIDMeta = data => {
24
+ if (!isJSONObject(data)) {
25
+ throw new TypeError(`Unmarshalling the type 'PinCIDMeta' failed as data isn't a dictionary.`);
26
+ }
27
+ return {
28
+ id: data.id
29
+ };
30
+ };
31
+ const unmarshalPinCID = data => {
32
+ if (!isJSONObject(data)) {
33
+ throw new TypeError(`Unmarshalling the type 'PinCID' failed as data isn't a dictionary.`);
34
+ }
35
+ return {
36
+ cid: data.cid,
37
+ meta: data.meta ? unmarshalPinCIDMeta(data.meta) : undefined,
38
+ name: data.name,
39
+ origins: data.origins
40
+ };
41
+ };
42
+ const unmarshalPinInfo = data => {
43
+ if (!isJSONObject(data)) {
44
+ throw new TypeError(`Unmarshalling the type 'PinInfo' failed as data isn't a dictionary.`);
45
+ }
46
+ return {
47
+ id: data.id,
48
+ progress: data.progress,
49
+ size: data.size,
50
+ statusDetails: data.status_details,
51
+ url: data.url
52
+ };
53
+ };
54
+ const unmarshalPin = data => {
55
+ if (!isJSONObject(data)) {
56
+ throw new TypeError(`Unmarshalling the type 'Pin' failed as data isn't a dictionary.`);
57
+ }
58
+ return {
59
+ cid: data.cid ? unmarshalPinCID(data.cid) : undefined,
60
+ createdAt: unmarshalDate(data.created_at),
61
+ delegates: data.delegates,
62
+ info: data.info ? unmarshalPinInfo(data.info) : undefined,
63
+ pinId: data.pin_id,
64
+ status: data.status
65
+ };
66
+ };
67
+ const unmarshalVolume = data => {
68
+ if (!isJSONObject(data)) {
69
+ throw new TypeError(`Unmarshalling the type 'Volume' failed as data isn't a dictionary.`);
70
+ }
71
+ return {
72
+ countPin: data.count_pin,
73
+ createdAt: unmarshalDate(data.created_at),
74
+ id: data.id,
75
+ name: data.name,
76
+ projectId: data.project_id,
77
+ region: data.region,
78
+ size: data.size,
79
+ tags: data.tags,
80
+ updatedAt: unmarshalDate(data.updated_at)
81
+ };
82
+ };
83
+ const unmarshalExportKeyNameResponse = data => {
84
+ if (!isJSONObject(data)) {
85
+ throw new TypeError(`Unmarshalling the type 'ExportKeyNameResponse' failed as data isn't a dictionary.`);
86
+ }
87
+ return {
88
+ createdAt: unmarshalDate(data.created_at),
89
+ nameId: data.name_id,
90
+ privateKey: data.private_key,
91
+ projectId: data.project_id,
92
+ publicKey: data.public_key,
93
+ updatedAt: unmarshalDate(data.updated_at)
94
+ };
95
+ };
96
+ const unmarshalListNamesResponse = data => {
97
+ if (!isJSONObject(data)) {
98
+ throw new TypeError(`Unmarshalling the type 'ListNamesResponse' failed as data isn't a dictionary.`);
99
+ }
100
+ return {
101
+ names: unmarshalArrayOfObject(data.names, unmarshalName),
102
+ totalCount: data.total_count
103
+ };
104
+ };
105
+ const unmarshalListPinsResponse = data => {
106
+ if (!isJSONObject(data)) {
107
+ throw new TypeError(`Unmarshalling the type 'ListPinsResponse' failed as data isn't a dictionary.`);
108
+ }
109
+ return {
110
+ pins: unmarshalArrayOfObject(data.pins, unmarshalPin),
111
+ totalCount: data.total_count
112
+ };
113
+ };
114
+ const unmarshalListVolumesResponse = data => {
115
+ if (!isJSONObject(data)) {
116
+ throw new TypeError(`Unmarshalling the type 'ListVolumesResponse' failed as data isn't a dictionary.`);
117
+ }
118
+ return {
119
+ totalCount: data.total_count,
120
+ volumes: unmarshalArrayOfObject(data.volumes, unmarshalVolume)
121
+ };
122
+ };
123
+ const unmarshalReplacePinResponse = data => {
124
+ if (!isJSONObject(data)) {
125
+ throw new TypeError(`Unmarshalling the type 'ReplacePinResponse' failed as data isn't a dictionary.`);
126
+ }
127
+ return {
128
+ pin: data.pin ? unmarshalPin(data.pin) : undefined
129
+ };
130
+ };
131
+ const marshalPinOptions = (request, defaults) => ({
132
+ replication_count: request.replicationCount,
133
+ required_zones: request.requiredZones
134
+ });
135
+ const marshalCreatePinByCIDRequest = (request, defaults) => ({
136
+ cid: request.cid,
137
+ name: request.name,
138
+ origins: request.origins,
139
+ pin_options: request.pinOptions !== undefined ? marshalPinOptions(request.pinOptions) : undefined,
140
+ volume_id: request.volumeId
141
+ });
142
+ const marshalCreatePinByURLRequest = (request, defaults) => ({
143
+ name: request.name,
144
+ pin_options: request.pinOptions !== undefined ? marshalPinOptions(request.pinOptions) : undefined,
145
+ url: request.url,
146
+ volume_id: request.volumeId
147
+ });
148
+ const marshalCreateVolumeRequest = (request, defaults) => ({
149
+ name: request.name,
150
+ project_id: request.projectId ?? defaults.defaultProjectId
151
+ });
152
+ const marshalIpnsApiCreateNameRequest = (request, defaults) => ({
153
+ name: request.name,
154
+ project_id: request.projectId ?? defaults.defaultProjectId,
155
+ value: request.value
156
+ });
157
+ const marshalIpnsApiImportKeyNameRequest = (request, defaults) => ({
158
+ name: request.name,
159
+ private_key: request.privateKey,
160
+ project_id: request.projectId ?? defaults.defaultProjectId,
161
+ value: request.value
162
+ });
163
+ const marshalIpnsApiUpdateNameRequest = (request, defaults) => ({
164
+ name: request.name,
165
+ tags: request.tags,
166
+ value: request.value
167
+ });
168
+ const marshalReplacePinRequest = (request, defaults) => ({
169
+ cid: request.cid,
170
+ name: request.name,
171
+ origins: request.origins,
172
+ pin_options: request.pinOptions !== undefined ? marshalPinOptions(request.pinOptions) : undefined,
173
+ volume_id: request.volumeId
174
+ });
175
+ const marshalUpdateVolumeRequest = (request, defaults) => ({
176
+ name: request.name,
177
+ tags: request.tags
178
+ });
179
+
180
+ export { marshalCreatePinByCIDRequest, marshalCreatePinByURLRequest, marshalCreateVolumeRequest, marshalIpnsApiCreateNameRequest, marshalIpnsApiImportKeyNameRequest, marshalIpnsApiUpdateNameRequest, marshalReplacePinRequest, marshalUpdateVolumeRequest, unmarshalExportKeyNameResponse, unmarshalListNamesResponse, unmarshalListPinsResponse, unmarshalListVolumesResponse, unmarshalName, unmarshalPin, unmarshalReplacePinResponse, unmarshalVolume };
@@ -0,0 +1,2 @@
1
+ import * as index from './v1/index.js';
2
+ export { index as v1 };