@igniter-js/caller 0.1.1 → 0.1.3
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/dist/index.d.mts +165 -26
- package/dist/index.d.ts +165 -26
- package/dist/index.js +7 -57
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -57
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1308,94 +1308,44 @@ var _IgniterCaller = class _IgniterCaller {
|
|
|
1308
1308
|
};
|
|
1309
1309
|
}
|
|
1310
1310
|
/**
|
|
1311
|
-
*
|
|
1312
|
-
*
|
|
1313
|
-
* @param url Optional URL for the request. Can also be set via `.url()`.
|
|
1314
|
-
*
|
|
1315
|
-
* @example
|
|
1316
|
-
* ```ts
|
|
1317
|
-
* // With URL directly
|
|
1318
|
-
* const result = await api.get('/users').execute()
|
|
1319
|
-
*
|
|
1320
|
-
* // With URL via method
|
|
1321
|
-
* const result = await api.get().url('/users').execute()
|
|
1322
|
-
* ```
|
|
1311
|
+
* Resolves the full URL path by prepending baseURL if needed.
|
|
1323
1312
|
*/
|
|
1313
|
+
resolveSchemaPath(url) {
|
|
1314
|
+
if (this.baseURL && !url.startsWith("http")) {
|
|
1315
|
+
return `${this.baseURL}${url}`;
|
|
1316
|
+
}
|
|
1317
|
+
return url;
|
|
1318
|
+
}
|
|
1324
1319
|
get(url) {
|
|
1325
1320
|
const builder = new IgniterCallerRequestBuilder(this.createBuilderParams());
|
|
1326
1321
|
builder._setMethod("GET");
|
|
1327
1322
|
if (url) builder._setUrl(url);
|
|
1328
1323
|
return builder;
|
|
1329
1324
|
}
|
|
1330
|
-
/**
|
|
1331
|
-
* Creates a POST request.
|
|
1332
|
-
*
|
|
1333
|
-
* @param url Optional URL for the request. Can also be set via `.url()`.
|
|
1334
|
-
*
|
|
1335
|
-
* @example
|
|
1336
|
-
* ```ts
|
|
1337
|
-
* const result = await api.post('/users').body({ name: 'John' }).execute()
|
|
1338
|
-
* ```
|
|
1339
|
-
*/
|
|
1340
1325
|
post(url) {
|
|
1341
1326
|
const builder = new IgniterCallerRequestBuilder(this.createBuilderParams());
|
|
1342
1327
|
builder._setMethod("POST");
|
|
1343
1328
|
if (url) builder._setUrl(url);
|
|
1344
1329
|
return builder;
|
|
1345
1330
|
}
|
|
1346
|
-
/**
|
|
1347
|
-
* Creates a PUT request.
|
|
1348
|
-
*
|
|
1349
|
-
* @param url Optional URL for the request. Can also be set via `.url()`.
|
|
1350
|
-
*
|
|
1351
|
-
* @example
|
|
1352
|
-
* ```ts
|
|
1353
|
-
* const result = await api.put('/users/1').body({ name: 'Jane' }).execute()
|
|
1354
|
-
* ```
|
|
1355
|
-
*/
|
|
1356
1331
|
put(url) {
|
|
1357
1332
|
const builder = new IgniterCallerRequestBuilder(this.createBuilderParams());
|
|
1358
1333
|
builder._setMethod("PUT");
|
|
1359
1334
|
if (url) builder._setUrl(url);
|
|
1360
1335
|
return builder;
|
|
1361
1336
|
}
|
|
1362
|
-
/**
|
|
1363
|
-
* Creates a PATCH request.
|
|
1364
|
-
*
|
|
1365
|
-
* @param url Optional URL for the request. Can also be set via `.url()`.
|
|
1366
|
-
*
|
|
1367
|
-
* @example
|
|
1368
|
-
* ```ts
|
|
1369
|
-
* const result = await api.patch('/users/1').body({ name: 'Jane' }).execute()
|
|
1370
|
-
* ```
|
|
1371
|
-
*/
|
|
1372
1337
|
patch(url) {
|
|
1373
1338
|
const builder = new IgniterCallerRequestBuilder(this.createBuilderParams());
|
|
1374
1339
|
builder._setMethod("PATCH");
|
|
1375
1340
|
if (url) builder._setUrl(url);
|
|
1376
1341
|
return builder;
|
|
1377
1342
|
}
|
|
1378
|
-
/**
|
|
1379
|
-
* Creates a DELETE request.
|
|
1380
|
-
*
|
|
1381
|
-
* @param url Optional URL for the request. Can also be set via `.url()`.
|
|
1382
|
-
*
|
|
1383
|
-
* @example
|
|
1384
|
-
* ```ts
|
|
1385
|
-
* const result = await api.delete('/users/1').execute()
|
|
1386
|
-
* ```
|
|
1387
|
-
*/
|
|
1388
1343
|
delete(url) {
|
|
1389
1344
|
const builder = new IgniterCallerRequestBuilder(this.createBuilderParams());
|
|
1390
1345
|
builder._setMethod("DELETE");
|
|
1391
1346
|
if (url) builder._setUrl(url);
|
|
1392
1347
|
return builder;
|
|
1393
1348
|
}
|
|
1394
|
-
/**
|
|
1395
|
-
* Creates a HEAD request.
|
|
1396
|
-
*
|
|
1397
|
-
* @param url Optional URL for the request. Can also be set via `.url()`.
|
|
1398
|
-
*/
|
|
1399
1349
|
head(url) {
|
|
1400
1350
|
const builder = new IgniterCallerRequestBuilder(this.createBuilderParams());
|
|
1401
1351
|
builder._setMethod("HEAD");
|