@phpsandbox/sdk 0.6.0-canary.1 → 0.6.0-canary.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/README.md CHANGED
@@ -378,6 +378,9 @@ await notebook.mail.disable();
378
378
  ### Feedback
379
379
 
380
380
  ```ts
381
+ // Feedback uses the same API token as the rest of the SDK.
382
+ // You can also address it directly with client.feedback.forProject(projectId)
383
+ // or client.feedback.forNotebook(notebookId), without fetching a notebook.
381
384
  await notebook.feedback.configure({
382
385
  widget: {
383
386
  targets: ['preview', 'publication'],
@@ -20560,9 +20560,9 @@ function runtimeAbort(options) {
20560
20560
 
20561
20561
  // src/feedback.ts
20562
20562
  var Feedback = class {
20563
- constructor(client, notebookId) {
20563
+ constructor(client, identifier) {
20564
20564
  this.client = client;
20565
- this.notebookId = notebookId;
20565
+ this.identifier = identifier;
20566
20566
  }
20567
20567
  async configure(input) {
20568
20568
  const response = await this.client.put(this.path("/configuration"), input);
@@ -20572,8 +20572,8 @@ var Feedback = class {
20572
20572
  const response = await this.client.get(this.path("/configuration"));
20573
20573
  return response.data;
20574
20574
  }
20575
- async submit(input) {
20576
- const response = await this.client.post(this.path(), input);
20575
+ async submit(input, options = {}) {
20576
+ const response = await this.client.post(this.path(), input, options);
20577
20577
  return response.data;
20578
20578
  }
20579
20579
  async list(options = {}) {
@@ -20594,7 +20594,18 @@ var Feedback = class {
20594
20594
  return response.data;
20595
20595
  }
20596
20596
  path(suffix = "") {
20597
- return `/notebook/${this.notebookId}/feedback${suffix}`;
20597
+ return `/platform/projects/${encodeURIComponent(this.identifier)}/feedback${suffix}`;
20598
+ }
20599
+ };
20600
+ var FeedbackApi = class {
20601
+ constructor(client) {
20602
+ this.client = client;
20603
+ }
20604
+ forProject(projectId) {
20605
+ return new Feedback(this.client, projectId);
20606
+ }
20607
+ forNotebook(notebookId) {
20608
+ return new Feedback(this.client, notebookId);
20598
20609
  }
20599
20610
  };
20600
20611
 
@@ -20755,6 +20766,7 @@ var ClientImplementation = class {
20755
20766
  this.integrations = new IntegrationApi(this);
20756
20767
  this.payments = new PaymentsApi(this);
20757
20768
  this.customers = new CustomersApi(this);
20769
+ this.feedback = new FeedbackApi(this);
20758
20770
  this.options = { ...options };
20759
20771
  this.runtimeTransportValue = runtimeTransport;
20760
20772
  this.baseUrl = normalizeApiBaseUrl(url2);
@@ -20773,8 +20785,13 @@ var ClientImplementation = class {
20773
20785
  get(path) {
20774
20786
  return this.requireData(this.makeRequest("GET", path));
20775
20787
  }
20776
- post(path, body) {
20777
- return this.requireData(this.makeRequest("POST", path, { body: body === void 0 ? void 0 : JSON.stringify(body) }));
20788
+ post(path, body, options = {}) {
20789
+ return this.requireData(
20790
+ this.makeRequest("POST", path, {
20791
+ body: body === void 0 ? void 0 : JSON.stringify(body),
20792
+ headers: options.idempotencyKey === void 0 ? void 0 : { "Idempotency-Key": options.idempotencyKey }
20793
+ })
20794
+ );
20778
20795
  }
20779
20796
  delete(path) {
20780
20797
  return this.makeRequest("DELETE", path);
@@ -20827,11 +20844,15 @@ var ClientImplementation = class {
20827
20844
  return { ...response, data: response.data };
20828
20845
  }
20829
20846
  async makeRequest(method, path, init) {
20847
+ const headers = new Headers(init?.headers);
20848
+ for (const [name, value] of Object.entries(this.headers)) {
20849
+ headers.set(name, value);
20850
+ }
20830
20851
  const response = await this.fetchResponse(
20831
20852
  authenticatedRequest(new URL(path.replace(/^\//, ""), this.baseUrl), {
20832
20853
  method,
20833
20854
  ...init,
20834
- headers: this.headers
20855
+ headers
20835
20856
  })
20836
20857
  );
20837
20858
  if (!response.ok) {
@@ -20897,6 +20918,7 @@ var PHPSandbox = class _PHPSandbox {
20897
20918
  this.integrations = client.integrations;
20898
20919
  this.payments = client.payments;
20899
20920
  this.customers = client.customers;
20921
+ this.feedback = client.feedback;
20900
20922
  }
20901
20923
  async whoami() {
20902
20924
  const { data } = await this.client.get("/auth/whoami");
@@ -21309,6 +21331,8 @@ export {
21309
21331
  CustomerRuntime,
21310
21332
  CustomersApi,
21311
21333
  DEFAULT_PAYMENT_CALLBACK_PATH,
21334
+ Feedback,
21335
+ FeedbackApi,
21312
21336
  FileChangeFilter,
21313
21337
  FileChangeType,
21314
21338
  FileType,