You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @param {string} [opts.baseURL=process.env['DROIDRUN_CLOUD_BASE_URL'] ?? https://api.droidrun.ai/v1] - Override the default base URL for the API.
146
151
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
147
152
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
@@ -153,16 +158,23 @@ export class DroidrunCloud {
153
158
constructor({
154
159
baseURL =readEnv('DROIDRUN_CLOUD_BASE_URL'),
155
160
apiKey =readEnv('DROIDRUN_CLOUD_API_KEY'),
161
+
bearer =readEnv('DROIDRUN_CLOUD_BEARER_TOKEN'),
156
162
...opts
157
163
}: ClientOptions={}){
158
164
if(apiKey===undefined){
159
165
thrownewErrors.DroidrunCloudError(
160
166
"The DROIDRUN_CLOUD_API_KEY environment variable is missing or empty; either provide it, or instantiate the DroidrunCloud client with an apiKey option, like new DroidrunCloud({ apiKey: 'My API Key' }).",
161
167
);
162
168
}
169
+
if(bearer===undefined){
170
+
thrownewErrors.DroidrunCloudError(
171
+
"The DROIDRUN_CLOUD_BEARER_TOKEN environment variable is missing or empty; either provide it, or instantiate the DroidrunCloud client with an bearer option, like new DroidrunCloud({ bearer: 'My Bearer' }).",
172
+
);
173
+
}
163
174
164
175
constoptions: ClientOptions={
165
176
apiKey,
177
+
bearer,
166
178
...opts,
167
179
baseURL: baseURL||`https://api.droidrun.ai/v1`,
168
180
};
@@ -185,6 +197,7 @@ export class DroidrunCloud {
185
197
this._options=options;
186
198
187
199
this.apiKey=apiKey;
200
+
this.bearer=bearer;
188
201
}
189
202
190
203
/**
@@ -201,6 +214,7 @@ export class DroidrunCloud {
201
214
fetch: this.fetch,
202
215
fetchOptions: this.fetchOptions,
203
216
apiKey: this.apiKey,
217
+
bearer: this.bearer,
204
218
...options,
205
219
});
206
220
returnclient;
@@ -221,24 +235,8 @@ export class DroidrunCloud {
221
235
return;
222
236
}
223
237
224
-
/**
225
-
* Basic re-implementation of `qs.stringify` for primitive types.
`Cannot stringify type ${typeofvalue}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
Copyright (c) 2014, Nathan LaFreniere and other [contributors](https://github.com/puruvj/neoqs/graphs/contributors) All rights reserved.
4
+
5
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6
+
7
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8
+
9
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10
+
11
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12
+
13
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This is a vendored version of [neoqs](https://github.com/PuruVJ/neoqs) which is a TypeScript rewrite of [qs](https://github.com/ljharb/qs), a query string library.
0 commit comments