@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.
@@ -333,6 +333,8 @@ var PHPSandbox = (() => {
333
333
  NotebookApi: () => NotebookApi,
334
334
  NotebookInitError: () => NotebookInitError,
335
335
  NotebookInstance: () => NotebookInstance,
336
+ NotebookSecretApi: () => NotebookSecretApi,
337
+ NotebookSecrets: () => NotebookSecrets,
336
338
  NotebookState: () => NotebookState,
337
339
  PHPSandbox: () => PHPSandbox,
338
340
  PHPSandboxError: () => PHPSandboxError,
@@ -4610,6 +4612,7 @@ var PHPSandbox = (() => {
4610
4612
  var NotebookApi = class {
4611
4613
  constructor(client) {
4612
4614
  this.client = client;
4615
+ this.secrets = new NotebookSecretApi(client);
4613
4616
  }
4614
4617
  async create(template, input = {}, init = true) {
4615
4618
  const response = await this.client.post("/notebook", { template, ...input });
@@ -4684,11 +4687,32 @@ var PHPSandbox = (() => {
4684
4687
  if (!response.ok) {
4685
4688
  throw new ApiError(response, await response.text());
4686
4689
  }
4687
- return { data: await response.json() };
4690
+ if (response.status === 204) {
4691
+ return { data: void 0 };
4692
+ }
4693
+ const body = await response.text();
4694
+ return { data: body === "" ? void 0 : JSON.parse(body) };
4688
4695
  }
4689
4696
  };
4690
4697
  var PHPSandbox = class extends Client {
4691
4698
  };
4699
+ var NotebookSecretApi = class {
4700
+ constructor(client) {
4701
+ this.client = client;
4702
+ }
4703
+ async list(id) {
4704
+ const response = await this.client.get(`/notebook/${id}/secrets`);
4705
+ return response.data;
4706
+ }
4707
+ async set(id, name, input) {
4708
+ const payload = typeof input === "string" ? { value: input } : input;
4709
+ const response = await this.client.put(`/notebook/${id}/secrets/${encodeURIComponent(name)}`, payload);
4710
+ return response.data;
4711
+ }
4712
+ async delete(id, name) {
4713
+ await this.client.delete(`/notebook/${id}/secrets/${encodeURIComponent(name)}`);
4714
+ }
4715
+ };
4692
4716
  var _initPromise, _NotebookInstance_instances, init_fn;
4693
4717
  var NotebookInstance = class {
4694
4718
  constructor(data, client) {
@@ -4716,6 +4740,7 @@ var PHPSandbox = (() => {
4716
4740
  this.laravel = new Lravel(this);
4717
4741
  this.shell = new Shell(this);
4718
4742
  this.git = new Git(this);
4743
+ this.secrets = new NotebookSecrets(client, this.data.id);
4719
4744
  }
4720
4745
  async ready() {
4721
4746
  const ready = async () => {
@@ -4837,6 +4862,21 @@ var PHPSandbox = (() => {
4837
4862
  }));
4838
4863
  return __privateGet(this, _initPromise);
4839
4864
  };
4865
+ var NotebookSecrets = class {
4866
+ constructor(client, notebookId) {
4867
+ this.client = client;
4868
+ this.notebookId = notebookId;
4869
+ }
4870
+ list() {
4871
+ return this.client.notebook.secrets.list(this.notebookId);
4872
+ }
4873
+ set(name, input) {
4874
+ return this.client.notebook.secrets.set(this.notebookId, name, input);
4875
+ }
4876
+ delete(name) {
4877
+ return this.client.notebook.secrets.delete(this.notebookId, name);
4878
+ }
4879
+ };
4840
4880
  return __toCommonJS(index_exports);
4841
4881
  })();
4842
4882
  /*! Bundled license information: