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