@roarkanalytics/sdk 0.1.0-alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +25 -0
- package/LICENSE +201 -0
- package/README.md +344 -0
- package/api-promise.d.mts +47 -0
- package/api-promise.d.mts.map +1 -0
- package/api-promise.d.ts +47 -0
- package/api-promise.d.ts.map +1 -0
- package/api-promise.js +84 -0
- package/api-promise.js.map +1 -0
- package/api-promise.mjs +80 -0
- package/api-promise.mjs.map +1 -0
- package/client.d.mts +186 -0
- package/client.d.mts.map +1 -0
- package/client.d.ts +186 -0
- package/client.d.ts.map +1 -0
- package/client.js +449 -0
- package/client.js.map +1 -0
- package/client.mjs +422 -0
- package/client.mjs.map +1 -0
- package/error.d.mts +47 -0
- package/error.d.mts.map +1 -0
- package/error.d.ts +47 -0
- package/error.d.ts.map +1 -0
- package/error.js +113 -0
- package/error.js.map +1 -0
- package/error.mjs +97 -0
- package/error.mjs.map +1 -0
- package/index.d.mts +6 -0
- package/index.d.mts.map +1 -0
- package/index.d.ts +6 -0
- package/index.d.ts.map +1 -0
- package/index.js +30 -0
- package/index.js.map +1 -0
- package/index.mjs +7 -0
- package/index.mjs.map +1 -0
- package/internal/builtin-types.d.mts +65 -0
- package/internal/builtin-types.d.mts.map +1 -0
- package/internal/builtin-types.d.ts +65 -0
- package/internal/builtin-types.d.ts.map +1 -0
- package/internal/builtin-types.js +4 -0
- package/internal/builtin-types.js.map +1 -0
- package/internal/builtin-types.mjs +3 -0
- package/internal/builtin-types.mjs.map +1 -0
- package/internal/detect-platform.d.mts +15 -0
- package/internal/detect-platform.d.mts.map +1 -0
- package/internal/detect-platform.d.ts +15 -0
- package/internal/detect-platform.d.ts.map +1 -0
- package/internal/detect-platform.js +162 -0
- package/internal/detect-platform.js.map +1 -0
- package/internal/detect-platform.mjs +157 -0
- package/internal/detect-platform.mjs.map +1 -0
- package/internal/errors.d.mts +3 -0
- package/internal/errors.d.mts.map +1 -0
- package/internal/errors.d.ts +3 -0
- package/internal/errors.d.ts.map +1 -0
- package/internal/errors.js +26 -0
- package/internal/errors.js.map +1 -0
- package/internal/errors.mjs +21 -0
- package/internal/errors.mjs.map +1 -0
- package/internal/headers.d.mts +21 -0
- package/internal/headers.d.mts.map +1 -0
- package/internal/headers.d.ts +21 -0
- package/internal/headers.d.ts.map +1 -0
- package/internal/headers.js +77 -0
- package/internal/headers.js.map +1 -0
- package/internal/headers.mjs +72 -0
- package/internal/headers.mjs.map +1 -0
- package/internal/parse.d.mts +10 -0
- package/internal/parse.d.mts.map +1 -0
- package/internal/parse.d.ts +10 -0
- package/internal/parse.d.ts.map +1 -0
- package/internal/parse.js +28 -0
- package/internal/parse.js.map +1 -0
- package/internal/parse.mjs +24 -0
- package/internal/parse.mjs.map +1 -0
- package/internal/polyfill/crypto.node.d.ts +10 -0
- package/internal/polyfill/crypto.node.js +11 -0
- package/internal/polyfill/crypto.node.mjs +2 -0
- package/internal/polyfill/file.node.d.ts +9 -0
- package/internal/polyfill/file.node.js +17 -0
- package/internal/polyfill/file.node.mjs +9 -0
- package/internal/request-options.d.mts +34 -0
- package/internal/request-options.d.mts.map +1 -0
- package/internal/request-options.d.ts +34 -0
- package/internal/request-options.d.ts.map +1 -0
- package/internal/request-options.js +39 -0
- package/internal/request-options.js.map +1 -0
- package/internal/request-options.mjs +34 -0
- package/internal/request-options.mjs.map +1 -0
- package/internal/shim-types.d.mts +28 -0
- package/internal/shim-types.d.ts +28 -0
- package/internal/shims.d.mts +61 -0
- package/internal/shims.d.mts.map +1 -0
- package/internal/shims.d.ts +61 -0
- package/internal/shims.d.ts.map +1 -0
- package/internal/shims.js +101 -0
- package/internal/shims.js.map +1 -0
- package/internal/shims.mjs +92 -0
- package/internal/shims.mjs.map +1 -0
- package/internal/types.d.mts +68 -0
- package/internal/types.d.mts.map +1 -0
- package/internal/types.d.ts +68 -0
- package/internal/types.d.ts.map +1 -0
- package/internal/types.js +4 -0
- package/internal/types.js.map +1 -0
- package/internal/types.mjs +3 -0
- package/internal/types.mjs.map +1 -0
- package/internal/uploads.d.mts +73 -0
- package/internal/uploads.d.mts.map +1 -0
- package/internal/uploads.d.ts +73 -0
- package/internal/uploads.d.ts.map +1 -0
- package/internal/uploads.js +208 -0
- package/internal/uploads.js.map +1 -0
- package/internal/uploads.mjs +200 -0
- package/internal/uploads.mjs.map +1 -0
- package/internal/utils/base64.d.mts +3 -0
- package/internal/utils/base64.d.mts.map +1 -0
- package/internal/utils/base64.d.ts +3 -0
- package/internal/utils/base64.d.ts.map +1 -0
- package/internal/utils/base64.js +33 -0
- package/internal/utils/base64.js.map +1 -0
- package/internal/utils/base64.mjs +28 -0
- package/internal/utils/base64.mjs.map +1 -0
- package/internal/utils/env.d.mts +9 -0
- package/internal/utils/env.d.mts.map +1 -0
- package/internal/utils/env.d.ts +9 -0
- package/internal/utils/env.d.ts.map +1 -0
- package/internal/utils/env.js +22 -0
- package/internal/utils/env.js.map +1 -0
- package/internal/utils/env.mjs +18 -0
- package/internal/utils/env.mjs.map +1 -0
- package/internal/utils/log.d.mts +4 -0
- package/internal/utils/log.d.mts.map +1 -0
- package/internal/utils/log.d.ts +4 -0
- package/internal/utils/log.d.ts.map +1 -0
- package/internal/utils/log.js +47 -0
- package/internal/utils/log.js.map +1 -0
- package/internal/utils/log.mjs +43 -0
- package/internal/utils/log.mjs.map +1 -0
- package/internal/utils/sleep.d.mts +2 -0
- package/internal/utils/sleep.d.mts.map +1 -0
- package/internal/utils/sleep.d.ts +2 -0
- package/internal/utils/sleep.d.ts.map +1 -0
- package/internal/utils/sleep.js +7 -0
- package/internal/utils/sleep.js.map +1 -0
- package/internal/utils/sleep.mjs +3 -0
- package/internal/utils/sleep.mjs.map +1 -0
- package/internal/utils/uuid.d.mts +5 -0
- package/internal/utils/uuid.d.mts.map +1 -0
- package/internal/utils/uuid.d.ts +5 -0
- package/internal/utils/uuid.d.ts.map +1 -0
- package/internal/utils/uuid.js +15 -0
- package/internal/utils/uuid.js.map +1 -0
- package/internal/utils/uuid.mjs +11 -0
- package/internal/utils/uuid.mjs.map +1 -0
- package/internal/utils/values.d.mts +15 -0
- package/internal/utils/values.d.mts.map +1 -0
- package/internal/utils/values.d.ts +15 -0
- package/internal/utils/values.d.ts.map +1 -0
- package/internal/utils/values.js +100 -0
- package/internal/utils/values.js.map +1 -0
- package/internal/utils/values.mjs +84 -0
- package/internal/utils/values.mjs.map +1 -0
- package/internal/utils.d.mts +7 -0
- package/internal/utils.d.mts.map +1 -0
- package/internal/utils.d.ts +7 -0
- package/internal/utils.d.ts.map +1 -0
- package/internal/utils.js +24 -0
- package/internal/utils.js.map +1 -0
- package/internal/utils.mjs +8 -0
- package/internal/utils.mjs.map +1 -0
- package/package.json +119 -0
- package/resource.d.mts +6 -0
- package/resource.d.mts.map +1 -0
- package/resource.d.ts +6 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +11 -0
- package/resource.js.map +1 -0
- package/resource.mjs +7 -0
- package/resource.mjs.map +1 -0
- package/resources/calls.d.mts +85 -0
- package/resources/calls.d.mts.map +1 -0
- package/resources/calls.d.ts +85 -0
- package/resources/calls.d.ts.map +1 -0
- package/resources/calls.js +15 -0
- package/resources/calls.js.map +1 -0
- package/resources/calls.mjs +11 -0
- package/resources/calls.mjs.map +1 -0
- package/resources/index.d.mts +2 -0
- package/resources/index.d.mts.map +1 -0
- package/resources/index.d.ts +2 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +7 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +3 -0
- package/resources/index.mjs.map +1 -0
- package/src/api-promise.ts +92 -0
- package/src/client.ts +646 -0
- package/src/error.ts +130 -0
- package/src/index.ts +22 -0
- package/src/internal/builtin-types.ts +79 -0
- package/src/internal/detect-platform.ts +196 -0
- package/src/internal/errors.ts +22 -0
- package/src/internal/headers.ts +96 -0
- package/src/internal/parse.ts +41 -0
- package/src/internal/polyfill/crypto.node.d.ts +10 -0
- package/src/internal/polyfill/crypto.node.js +11 -0
- package/src/internal/polyfill/crypto.node.mjs +2 -0
- package/src/internal/polyfill/file.node.d.ts +9 -0
- package/src/internal/polyfill/file.node.js +17 -0
- package/src/internal/polyfill/file.node.mjs +9 -0
- package/src/internal/request-options.ts +67 -0
- package/src/internal/shim-types.d.ts +28 -0
- package/src/internal/shims.ts +145 -0
- package/src/internal/types.ts +98 -0
- package/src/internal/uploads.ts +307 -0
- package/src/internal/utils/base64.ts +37 -0
- package/src/internal/utils/env.ts +18 -0
- package/src/internal/utils/log.ts +49 -0
- package/src/internal/utils/sleep.ts +3 -0
- package/src/internal/utils/uuid.ts +13 -0
- package/src/internal/utils/values.ts +94 -0
- package/src/internal/utils.ts +8 -0
- package/src/lib/.keep +4 -0
- package/src/resource.ts +11 -0
- package/src/resources/calls.ts +118 -0
- package/src/resources/index.ts +3 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +1 -0
- package/src/version.ts +1 -0
- package/uploads.d.mts +2 -0
- package/uploads.d.mts.map +1 -0
- package/uploads.d.ts +2 -0
- package/uploads.d.ts.map +1 -0
- package/uploads.js +6 -0
- package/uploads.js.map +1 -0
- package/uploads.mjs +2 -0
- package/uploads.mjs.map +1 -0
- package/version.d.mts +2 -0
- package/version.d.mts.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +5 -0
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- package/version.mjs.map +1 -0
package/CHANGELOG.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## 0.1.0-alpha.1 (2025-02-04)
|
4
|
+
|
5
|
+
Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/roarkhq/sdk-roark-analytics-node/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
|
6
|
+
|
7
|
+
### Features
|
8
|
+
|
9
|
+
* infra ([623be67](https://github.com/roarkhq/sdk-roark-analytics-node/commit/623be67bbf59dd58637f91e22695a1dd2d2ff573))
|
10
|
+
* update ([29aa2fd](https://github.com/roarkhq/sdk-roark-analytics-node/commit/29aa2fd9082574b81b3d13d95aa73220640f289c))
|
11
|
+
* update naming ([47805d8](https://github.com/roarkhq/sdk-roark-analytics-node/commit/47805d8e6d415a0ba893e1d1c1721a5353534e42))
|
12
|
+
|
13
|
+
|
14
|
+
### Chores
|
15
|
+
|
16
|
+
* go live ([#1](https://github.com/roarkhq/sdk-roark-analytics-node/issues/1)) ([cf06981](https://github.com/roarkhq/sdk-roark-analytics-node/commit/cf0698104a1500407147f051274319c0a86acb81))
|
17
|
+
* sync repo ([99b8ded](https://github.com/roarkhq/sdk-roark-analytics-node/commit/99b8ded280ad59dfc07d78970ea2afc7bd5c9a2a))
|
18
|
+
* update SDK settings ([#3](https://github.com/roarkhq/sdk-roark-analytics-node/issues/3)) ([69914ad](https://github.com/roarkhq/sdk-roark-analytics-node/commit/69914ad5f9e08dfbd858302dae447817f3422923))
|
19
|
+
|
20
|
+
|
21
|
+
### Documentation
|
22
|
+
|
23
|
+
* overhaul ([71eff8f](https://github.com/roarkhq/sdk-roark-analytics-node/commit/71eff8f544a2d9ab1ce0fa290e95b66b7a63a16c))
|
24
|
+
* update readme ([de6f98b](https://github.com/roarkhq/sdk-roark-analytics-node/commit/de6f98b7fca5ecf5ae161145103d36ba67c91d4b))
|
25
|
+
* use listen instead of live ([bb3e881](https://github.com/roarkhq/sdk-roark-analytics-node/commit/bb3e8814c9cc76f7f63c8c47ad38f91e01ba2201))
|
package/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright 2025 Petstore
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
@@ -0,0 +1,344 @@
|
|
1
|
+
# Petstore TypeScript API Library
|
2
|
+
|
3
|
+
[![NPM version](https://img.shields.io/npm/v/@roarkanalytics/sdk.svg)](https://npmjs.org/package/@roarkanalytics/sdk) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@roarkanalytics/sdk)
|
4
|
+
|
5
|
+
This library provides convenient access to the Petstore REST API from server-side TypeScript or JavaScript.
|
6
|
+
|
7
|
+
The REST API documentation can be found on [app.stainlessapi.com](https://app.stainlessapi.com/docs). The full API of this library can be found in [api.md](api.md).
|
8
|
+
|
9
|
+
It is generated with [Stainless](https://www.stainlessapi.com/).
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
```sh
|
14
|
+
npm install @roarkanalytics/sdk
|
15
|
+
```
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
The full API of this library can be found in [api.md](api.md).
|
20
|
+
|
21
|
+
<!-- prettier-ignore -->
|
22
|
+
```js
|
23
|
+
import Petstore from '@roarkanalytics/sdk';
|
24
|
+
|
25
|
+
const client = new Petstore({
|
26
|
+
bearerToken: process.env['ROARK_API_BEARER_TOKEN'], // This is the default and can be omitted
|
27
|
+
});
|
28
|
+
|
29
|
+
async function main() {
|
30
|
+
const call = await client.calls.create({ direction: 'INBOUND', startedAt: '2025-02-04T01:48:11.473Z' });
|
31
|
+
|
32
|
+
console.log(call.data);
|
33
|
+
}
|
34
|
+
|
35
|
+
main();
|
36
|
+
```
|
37
|
+
|
38
|
+
### Request & Response types
|
39
|
+
|
40
|
+
This library includes TypeScript definitions for all request params and response fields. You may import and use them like so:
|
41
|
+
|
42
|
+
<!-- prettier-ignore -->
|
43
|
+
```ts
|
44
|
+
import Petstore from '@roarkanalytics/sdk';
|
45
|
+
|
46
|
+
const client = new Petstore({
|
47
|
+
bearerToken: process.env['ROARK_API_BEARER_TOKEN'], // This is the default and can be omitted
|
48
|
+
});
|
49
|
+
|
50
|
+
async function main() {
|
51
|
+
const params: Petstore.CallCreateParams = { direction: 'INBOUND', startedAt: '2025-02-04T01:48:11.473Z' };
|
52
|
+
const call: Petstore.CallCreateResponse = await client.calls.create(params);
|
53
|
+
}
|
54
|
+
|
55
|
+
main();
|
56
|
+
```
|
57
|
+
|
58
|
+
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
|
59
|
+
|
60
|
+
## Handling errors
|
61
|
+
|
62
|
+
When the library is unable to connect to the API,
|
63
|
+
or if the API returns a non-success status code (i.e., 4xx or 5xx response),
|
64
|
+
a subclass of `APIError` will be thrown:
|
65
|
+
|
66
|
+
<!-- prettier-ignore -->
|
67
|
+
```ts
|
68
|
+
async function main() {
|
69
|
+
const call = await client.calls
|
70
|
+
.create({ direction: 'INBOUND', startedAt: '2025-02-04T01:48:11.473Z' })
|
71
|
+
.catch(async (err) => {
|
72
|
+
if (err instanceof Petstore.APIError) {
|
73
|
+
console.log(err.status); // 400
|
74
|
+
console.log(err.name); // BadRequestError
|
75
|
+
console.log(err.headers); // {server: 'nginx', ...}
|
76
|
+
} else {
|
77
|
+
throw err;
|
78
|
+
}
|
79
|
+
});
|
80
|
+
}
|
81
|
+
|
82
|
+
main();
|
83
|
+
```
|
84
|
+
|
85
|
+
Error codes are as followed:
|
86
|
+
|
87
|
+
| Status Code | Error Type |
|
88
|
+
| ----------- | -------------------------- |
|
89
|
+
| 400 | `BadRequestError` |
|
90
|
+
| 401 | `AuthenticationError` |
|
91
|
+
| 403 | `PermissionDeniedError` |
|
92
|
+
| 404 | `NotFoundError` |
|
93
|
+
| 422 | `UnprocessableEntityError` |
|
94
|
+
| 429 | `RateLimitError` |
|
95
|
+
| >=500 | `InternalServerError` |
|
96
|
+
| N/A | `APIConnectionError` |
|
97
|
+
|
98
|
+
### Retries
|
99
|
+
|
100
|
+
Certain errors will be automatically retried 2 times by default, with a short exponential backoff.
|
101
|
+
Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
|
102
|
+
429 Rate Limit, and >=500 Internal errors will all be retried by default.
|
103
|
+
|
104
|
+
You can use the `maxRetries` option to configure or disable this:
|
105
|
+
|
106
|
+
<!-- prettier-ignore -->
|
107
|
+
```js
|
108
|
+
// Configure the default for all requests:
|
109
|
+
const client = new Petstore({
|
110
|
+
maxRetries: 0, // default is 2
|
111
|
+
});
|
112
|
+
|
113
|
+
// Or, configure per-request:
|
114
|
+
await client.calls.create({ direction: 'INBOUND', startedAt: '2025-02-04T01:48:11.473Z' }, {
|
115
|
+
maxRetries: 5,
|
116
|
+
});
|
117
|
+
```
|
118
|
+
|
119
|
+
### Timeouts
|
120
|
+
|
121
|
+
Requests time out after 1 minute by default. You can configure this with a `timeout` option:
|
122
|
+
|
123
|
+
<!-- prettier-ignore -->
|
124
|
+
```ts
|
125
|
+
// Configure the default for all requests:
|
126
|
+
const client = new Petstore({
|
127
|
+
timeout: 20 * 1000, // 20 seconds (default is 1 minute)
|
128
|
+
});
|
129
|
+
|
130
|
+
// Override per-request:
|
131
|
+
await client.calls.create({ direction: 'INBOUND', startedAt: '2025-02-04T01:48:11.473Z' }, {
|
132
|
+
timeout: 5 * 1000,
|
133
|
+
});
|
134
|
+
```
|
135
|
+
|
136
|
+
On timeout, an `APIConnectionTimeoutError` is thrown.
|
137
|
+
|
138
|
+
Note that requests which time out will be [retried twice by default](#retries).
|
139
|
+
|
140
|
+
## Advanced Usage
|
141
|
+
|
142
|
+
### Accessing raw Response data (e.g., headers)
|
143
|
+
|
144
|
+
The "raw" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.
|
145
|
+
|
146
|
+
You can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.
|
147
|
+
|
148
|
+
<!-- prettier-ignore -->
|
149
|
+
```ts
|
150
|
+
const client = new Petstore();
|
151
|
+
|
152
|
+
const response = await client.calls
|
153
|
+
.create({ direction: 'INBOUND', startedAt: '2025-02-04T01:48:11.473Z' })
|
154
|
+
.asResponse();
|
155
|
+
console.log(response.headers.get('X-My-Header'));
|
156
|
+
console.log(response.statusText); // access the underlying Response object
|
157
|
+
|
158
|
+
const { data: call, response: raw } = await client.calls
|
159
|
+
.create({ direction: 'INBOUND', startedAt: '2025-02-04T01:48:11.473Z' })
|
160
|
+
.withResponse();
|
161
|
+
console.log(raw.headers.get('X-My-Header'));
|
162
|
+
console.log(call.data);
|
163
|
+
```
|
164
|
+
|
165
|
+
### Making custom/undocumented requests
|
166
|
+
|
167
|
+
This library is typed for convenient access to the documented API. If you need to access undocumented
|
168
|
+
endpoints, params, or response properties, the library can still be used.
|
169
|
+
|
170
|
+
#### Undocumented endpoints
|
171
|
+
|
172
|
+
To make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.
|
173
|
+
Options on the client, such as retries, will be respected when making these requests.
|
174
|
+
|
175
|
+
```ts
|
176
|
+
await client.post('/some/path', {
|
177
|
+
body: { some_prop: 'foo' },
|
178
|
+
query: { some_query_arg: 'bar' },
|
179
|
+
});
|
180
|
+
```
|
181
|
+
|
182
|
+
#### Undocumented request params
|
183
|
+
|
184
|
+
To make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented
|
185
|
+
parameter. This library doesn't validate at runtime that the request matches the type, so any extra values you
|
186
|
+
send will be sent as-is.
|
187
|
+
|
188
|
+
```ts
|
189
|
+
client.foo.create({
|
190
|
+
foo: 'my_param',
|
191
|
+
bar: 12,
|
192
|
+
// @ts-expect-error baz is not yet public
|
193
|
+
baz: 'undocumented option',
|
194
|
+
});
|
195
|
+
```
|
196
|
+
|
197
|
+
For requests with the `GET` verb, any extra params will be in the query, all other requests will send the
|
198
|
+
extra param in the body.
|
199
|
+
|
200
|
+
If you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request
|
201
|
+
options.
|
202
|
+
|
203
|
+
#### Undocumented response properties
|
204
|
+
|
205
|
+
To access undocumented response properties, you may access the response object with `// @ts-expect-error` on
|
206
|
+
the response object, or cast the response object to the requisite type. Like the request params, we do not
|
207
|
+
validate or strip extra properties from the response from the API.
|
208
|
+
|
209
|
+
### Customizing the fetch client
|
210
|
+
|
211
|
+
By default, this library expects a global `fetch` function is defined.
|
212
|
+
|
213
|
+
If you want to use a different `fetch` function, you can either polyfill the global:
|
214
|
+
|
215
|
+
```ts
|
216
|
+
import fetch from 'my-fetch';
|
217
|
+
|
218
|
+
globalThis.fetch = fetch;
|
219
|
+
```
|
220
|
+
|
221
|
+
Or pass it to the client:
|
222
|
+
|
223
|
+
```ts
|
224
|
+
import fetch from 'my-fetch';
|
225
|
+
|
226
|
+
const client = new Petstore({ fetch });
|
227
|
+
```
|
228
|
+
|
229
|
+
### Logging and middleware
|
230
|
+
|
231
|
+
You may also provide a custom `fetch` function when instantiating the client,
|
232
|
+
which can be used to inspect or alter the `Request` or `Response` before/after each request:
|
233
|
+
|
234
|
+
```ts
|
235
|
+
import { fetch } from 'undici'; // as one example
|
236
|
+
import Petstore from '@roarkanalytics/sdk';
|
237
|
+
|
238
|
+
const client = new Petstore({
|
239
|
+
fetch: async (url: RequestInfo, init?: RequestInit): Promise<Response> => {
|
240
|
+
console.log('About to make a request', url, init);
|
241
|
+
const response = await fetch(url, init);
|
242
|
+
console.log('Got response', response);
|
243
|
+
return response;
|
244
|
+
},
|
245
|
+
});
|
246
|
+
```
|
247
|
+
|
248
|
+
Note that if given a `PETSTORE_LOG=debug` environment variable, this library will log all requests and responses automatically.
|
249
|
+
This is intended for debugging purposes only and may change in the future without notice.
|
250
|
+
|
251
|
+
### Fetch options
|
252
|
+
|
253
|
+
If you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)
|
254
|
+
|
255
|
+
```ts
|
256
|
+
import Petstore from '@roarkanalytics/sdk';
|
257
|
+
|
258
|
+
const client = new Petstore({
|
259
|
+
fetchOptions: {
|
260
|
+
// `RequestInit` options
|
261
|
+
},
|
262
|
+
});
|
263
|
+
```
|
264
|
+
|
265
|
+
#### Configuring proxies
|
266
|
+
|
267
|
+
To modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy
|
268
|
+
options to requests:
|
269
|
+
|
270
|
+
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg" align="top" width="18" height="21"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>
|
271
|
+
|
272
|
+
```ts
|
273
|
+
import Petstore from '@roarkanalytics/sdk';
|
274
|
+
import * as undici from 'undici';
|
275
|
+
|
276
|
+
const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
|
277
|
+
const client = new Petstore({
|
278
|
+
fetchOptions: {
|
279
|
+
dispatcher: proxyAgent,
|
280
|
+
},
|
281
|
+
});
|
282
|
+
```
|
283
|
+
|
284
|
+
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg" align="top" width="18" height="21"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>
|
285
|
+
|
286
|
+
```ts
|
287
|
+
import Petstore from '@roarkanalytics/sdk';
|
288
|
+
|
289
|
+
const client = new Petstore({
|
290
|
+
fetchOptions: {
|
291
|
+
proxy: 'http://localhost:8888',
|
292
|
+
},
|
293
|
+
});
|
294
|
+
```
|
295
|
+
|
296
|
+
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg" align="top" width="18" height="21"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>
|
297
|
+
|
298
|
+
```ts
|
299
|
+
import Petstore from 'npm:@roarkanalytics/sdk';
|
300
|
+
|
301
|
+
const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
|
302
|
+
const client = new Petstore({
|
303
|
+
fetchOptions: {
|
304
|
+
client: httpClient,
|
305
|
+
},
|
306
|
+
});
|
307
|
+
```
|
308
|
+
|
309
|
+
## Frequently Asked Questions
|
310
|
+
|
311
|
+
## Semantic versioning
|
312
|
+
|
313
|
+
This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
|
314
|
+
|
315
|
+
1. Changes that only affect static types, without breaking runtime behavior.
|
316
|
+
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
|
317
|
+
3. Changes that we do not expect to impact the vast majority of users in practice.
|
318
|
+
|
319
|
+
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
|
320
|
+
|
321
|
+
We are keen for your feedback; please open an [issue](https://www.github.com/roarkhq/sdk-roark-analytics-node/issues) with questions, bugs, or suggestions.
|
322
|
+
|
323
|
+
## Requirements
|
324
|
+
|
325
|
+
TypeScript >= 4.9 is supported.
|
326
|
+
|
327
|
+
The following runtimes are supported:
|
328
|
+
|
329
|
+
- Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)
|
330
|
+
- Node.js 18 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
|
331
|
+
- Deno v1.28.0 or higher.
|
332
|
+
- Bun 1.0 or later.
|
333
|
+
- Cloudflare Workers.
|
334
|
+
- Vercel Edge Runtime.
|
335
|
+
- Jest 28 or greater with the `"node"` environment (`"jsdom"` is not supported at this time).
|
336
|
+
- Nitro v2.6 or greater.
|
337
|
+
|
338
|
+
Note that React Native is not supported at this time.
|
339
|
+
|
340
|
+
If you are interested in other runtime environments, please open or upvote an issue on GitHub.
|
341
|
+
|
342
|
+
## Contributing
|
343
|
+
|
344
|
+
See [the contributing documentation](./CONTRIBUTING.md).
|
@@ -0,0 +1,47 @@
|
|
1
|
+
|
2
|
+
import { type Petstore } from "./client.mjs";
|
3
|
+
import { type PromiseOrValue } from "./internal/types.mjs";
|
4
|
+
import { APIResponseProps } from "./internal/parse.mjs";
|
5
|
+
/**
|
6
|
+
* A subclass of `Promise` providing additional helper methods
|
7
|
+
* for interacting with the SDK.
|
8
|
+
*/
|
9
|
+
export declare class APIPromise<T> extends Promise<T> {
|
10
|
+
#private;
|
11
|
+
private responsePromise;
|
12
|
+
private parseResponse;
|
13
|
+
private parsedPromise;
|
14
|
+
constructor(client: Petstore, responsePromise: Promise<APIResponseProps>, parseResponse?: (client: Petstore, props: APIResponseProps) => PromiseOrValue<T>);
|
15
|
+
_thenUnwrap<U>(transform: (data: T, props: APIResponseProps) => U): APIPromise<U>;
|
16
|
+
/**
|
17
|
+
* Gets the raw `Response` instance instead of parsing the response
|
18
|
+
* data.
|
19
|
+
*
|
20
|
+
* If you want to parse the response body but still get the `Response`
|
21
|
+
* instance, you can use {@link withResponse()}.
|
22
|
+
*
|
23
|
+
* 👋 Getting the wrong TypeScript type for `Response`?
|
24
|
+
* Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]`
|
25
|
+
* to your `tsconfig.json`.
|
26
|
+
*/
|
27
|
+
asResponse(): Promise<Response>;
|
28
|
+
/**
|
29
|
+
* Gets the parsed response data and the raw `Response` instance.
|
30
|
+
*
|
31
|
+
* If you just want to get the raw `Response` instance without parsing it,
|
32
|
+
* you can use {@link asResponse()}.
|
33
|
+
*
|
34
|
+
* 👋 Getting the wrong TypeScript type for `Response`?
|
35
|
+
* Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]`
|
36
|
+
* to your `tsconfig.json`.
|
37
|
+
*/
|
38
|
+
withResponse(): Promise<{
|
39
|
+
data: T;
|
40
|
+
response: Response;
|
41
|
+
}>;
|
42
|
+
private parse;
|
43
|
+
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
|
44
|
+
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
|
45
|
+
finally(onfinally?: (() => void) | undefined | null): Promise<T>;
|
46
|
+
}
|
47
|
+
//# sourceMappingURL=api-promise.d.mts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"api-promise.d.mts","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":";OAEO,EAAE,KAAK,QAAQ,EAAE;OAEjB,EAAE,KAAK,cAAc,EAAE;OACvB,EAAE,gBAAgB,EAAwB;AAEjD;;;GAGG;AACH,qBAAa,UAAU,CAAC,CAAC,CAAE,SAAQ,OAAO,CAAC,CAAC,CAAC;;IAMzC,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,aAAa;IANvB,OAAO,CAAC,aAAa,CAAyB;gBAI5C,MAAM,EAAE,QAAQ,EACR,eAAe,EAAE,OAAO,CAAC,gBAAgB,CAAC,EAC1C,aAAa,GAAE,CACrB,MAAM,EAAE,QAAQ,EAChB,KAAK,EAAE,gBAAgB,KACpB,cAAc,CAAC,CAAC,CAAwB;IAW/C,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,gBAAgB,KAAK,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;IAMjF;;;;;;;;;;OAUG;IACH,UAAU,IAAI,OAAO,CAAC,QAAQ,CAAC;IAI/B;;;;;;;;;OASG;IACG,YAAY,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,CAAC,CAAC;QAAC,QAAQ,EAAE,QAAQ,CAAA;KAAE,CAAC;IAK9D,OAAO,CAAC,KAAK;IAOJ,IAAI,CAAC,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,KAAK,EAC1C,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,EACjF,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,GAClF,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAItB,KAAK,CAAC,OAAO,GAAG,KAAK,EAC5B,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,GAChF,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC;IAId,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;CAG1E"}
|
package/api-promise.d.ts
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
|
2
|
+
import { type Petstore } from "./client.js";
|
3
|
+
import { type PromiseOrValue } from "./internal/types.js";
|
4
|
+
import { APIResponseProps } from "./internal/parse.js";
|
5
|
+
/**
|
6
|
+
* A subclass of `Promise` providing additional helper methods
|
7
|
+
* for interacting with the SDK.
|
8
|
+
*/
|
9
|
+
export declare class APIPromise<T> extends Promise<T> {
|
10
|
+
#private;
|
11
|
+
private responsePromise;
|
12
|
+
private parseResponse;
|
13
|
+
private parsedPromise;
|
14
|
+
constructor(client: Petstore, responsePromise: Promise<APIResponseProps>, parseResponse?: (client: Petstore, props: APIResponseProps) => PromiseOrValue<T>);
|
15
|
+
_thenUnwrap<U>(transform: (data: T, props: APIResponseProps) => U): APIPromise<U>;
|
16
|
+
/**
|
17
|
+
* Gets the raw `Response` instance instead of parsing the response
|
18
|
+
* data.
|
19
|
+
*
|
20
|
+
* If you want to parse the response body but still get the `Response`
|
21
|
+
* instance, you can use {@link withResponse()}.
|
22
|
+
*
|
23
|
+
* 👋 Getting the wrong TypeScript type for `Response`?
|
24
|
+
* Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]`
|
25
|
+
* to your `tsconfig.json`.
|
26
|
+
*/
|
27
|
+
asResponse(): Promise<Response>;
|
28
|
+
/**
|
29
|
+
* Gets the parsed response data and the raw `Response` instance.
|
30
|
+
*
|
31
|
+
* If you just want to get the raw `Response` instance without parsing it,
|
32
|
+
* you can use {@link asResponse()}.
|
33
|
+
*
|
34
|
+
* 👋 Getting the wrong TypeScript type for `Response`?
|
35
|
+
* Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]`
|
36
|
+
* to your `tsconfig.json`.
|
37
|
+
*/
|
38
|
+
withResponse(): Promise<{
|
39
|
+
data: T;
|
40
|
+
response: Response;
|
41
|
+
}>;
|
42
|
+
private parse;
|
43
|
+
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
|
44
|
+
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
|
45
|
+
finally(onfinally?: (() => void) | undefined | null): Promise<T>;
|
46
|
+
}
|
47
|
+
//# sourceMappingURL=api-promise.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"api-promise.d.ts","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":";OAEO,EAAE,KAAK,QAAQ,EAAE;OAEjB,EAAE,KAAK,cAAc,EAAE;OACvB,EAAE,gBAAgB,EAAwB;AAEjD;;;GAGG;AACH,qBAAa,UAAU,CAAC,CAAC,CAAE,SAAQ,OAAO,CAAC,CAAC,CAAC;;IAMzC,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,aAAa;IANvB,OAAO,CAAC,aAAa,CAAyB;gBAI5C,MAAM,EAAE,QAAQ,EACR,eAAe,EAAE,OAAO,CAAC,gBAAgB,CAAC,EAC1C,aAAa,GAAE,CACrB,MAAM,EAAE,QAAQ,EAChB,KAAK,EAAE,gBAAgB,KACpB,cAAc,CAAC,CAAC,CAAwB;IAW/C,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,gBAAgB,KAAK,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;IAMjF;;;;;;;;;;OAUG;IACH,UAAU,IAAI,OAAO,CAAC,QAAQ,CAAC;IAI/B;;;;;;;;;OASG;IACG,YAAY,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,CAAC,CAAC;QAAC,QAAQ,EAAE,QAAQ,CAAA;KAAE,CAAC;IAK9D,OAAO,CAAC,KAAK;IAOJ,IAAI,CAAC,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,KAAK,EAC1C,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,EACjF,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,GAClF,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAItB,KAAK,CAAC,OAAO,GAAG,KAAK,EAC5B,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,GAChF,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC;IAId,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;CAG1E"}
|