@phpsandbox/sdk 0.0.24 → 0.0.26

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.
@@ -4570,6 +4570,7 @@ var ApiError = class extends Error {
4570
4570
  var NotebookApi = class {
4571
4571
  constructor(client) {
4572
4572
  this.client = client;
4573
+ this.secrets = new NotebookSecretApi(client);
4573
4574
  }
4574
4575
  async create(template, input = {}, init = true) {
4575
4576
  const response = await this.client.post("/notebook", { template, ...input });
@@ -4644,11 +4645,32 @@ var Client = class {
4644
4645
  if (!response.ok) {
4645
4646
  throw new ApiError(response, await response.text());
4646
4647
  }
4647
- return { data: await response.json() };
4648
+ if (response.status === 204) {
4649
+ return { data: void 0 };
4650
+ }
4651
+ const body = await response.text();
4652
+ return { data: body === "" ? void 0 : JSON.parse(body) };
4648
4653
  }
4649
4654
  };
4650
4655
  var PHPSandbox = class extends Client {
4651
4656
  };
4657
+ var NotebookSecretApi = class {
4658
+ constructor(client) {
4659
+ this.client = client;
4660
+ }
4661
+ async list(id) {
4662
+ const response = await this.client.get(`/notebook/${id}/secrets`);
4663
+ return response.data;
4664
+ }
4665
+ async set(id, name, input) {
4666
+ const payload = typeof input === "string" ? { value: input } : input;
4667
+ const response = await this.client.put(`/notebook/${id}/secrets/${encodeURIComponent(name)}`, payload);
4668
+ return response.data;
4669
+ }
4670
+ async delete(id, name) {
4671
+ await this.client.delete(`/notebook/${id}/secrets/${encodeURIComponent(name)}`);
4672
+ }
4673
+ };
4652
4674
  var _initPromise, _NotebookInstance_instances, init_fn;
4653
4675
  var NotebookInstance = class {
4654
4676
  constructor(data, client) {
@@ -4676,6 +4698,7 @@ var NotebookInstance = class {
4676
4698
  this.laravel = new Lravel(this);
4677
4699
  this.shell = new Shell(this);
4678
4700
  this.git = new Git(this);
4701
+ this.secrets = new NotebookSecrets(client, this.data.id);
4679
4702
  }
4680
4703
  async ready() {
4681
4704
  const ready = async () => {
@@ -4797,6 +4820,21 @@ init_fn = function() {
4797
4820
  }));
4798
4821
  return __privateGet(this, _initPromise);
4799
4822
  };
4823
+ var NotebookSecrets = class {
4824
+ constructor(client, notebookId) {
4825
+ this.client = client;
4826
+ this.notebookId = notebookId;
4827
+ }
4828
+ list() {
4829
+ return this.client.notebook.secrets.list(this.notebookId);
4830
+ }
4831
+ set(name, input) {
4832
+ return this.client.notebook.secrets.set(this.notebookId, name, input);
4833
+ }
4834
+ delete(name) {
4835
+ return this.client.notebook.secrets.delete(this.notebookId, name);
4836
+ }
4837
+ };
4800
4838
  export {
4801
4839
  ApiError,
4802
4840
  Beacon,
@@ -4816,6 +4854,8 @@ export {
4816
4854
  NotebookApi,
4817
4855
  NotebookInitError,
4818
4856
  NotebookInstance,
4857
+ NotebookSecretApi,
4858
+ NotebookSecrets,
4819
4859
  NotebookState,
4820
4860
  PHPSandbox,
4821
4861
  PHPSandboxError,