@phpsandbox/sdk 0.0.35 → 0.0.37

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
@@ -110,6 +110,7 @@ Each `NotebookInstance` exposes service clients:
110
110
  - `notebook.auth` (`Auth`)
111
111
  - `notebook.log` (`Log`)
112
112
  - `notebook.services` (`Services`)
113
+ - `notebook.mail` (`NotebookMail`)
113
114
 
114
115
  Notes:
115
116
 
@@ -208,6 +209,22 @@ const history = await notebook.git.log('main');
208
209
  console.log(history[0]);
209
210
  ```
210
211
 
212
+ ### Mail
213
+
214
+ ```ts
215
+ const state = await notebook.mail.status();
216
+
217
+ if (!state.enabled) {
218
+ await notebook.mail.enable();
219
+ }
220
+
221
+ const mails = await notebook.mail.list();
222
+ const mail = await notebook.mail.get(mails.data[0].hash);
223
+
224
+ await notebook.mail.delete(mail.hash);
225
+ await notebook.mail.disable();
226
+ ```
227
+
211
228
  ### Events
212
229
 
213
230
  ```ts
@@ -4971,6 +4971,8 @@ var NotebookApi = class {
4971
4971
  constructor(client) {
4972
4972
  this.client = client;
4973
4973
  this.secrets = new NotebookSecretApi(client);
4974
+ this.previewAuth = new NotebookPreviewAuthApi(client);
4975
+ this.mail = new NotebookMailApi(client);
4974
4976
  }
4975
4977
  async create(template, input = {}, init = true) {
4976
4978
  const response = await this.client.post("/notebook", { template, ...input });
@@ -5077,6 +5079,51 @@ var NotebookSecretApi = class {
5077
5079
  await this.client.delete(`/notebook/${id}/secrets/${encodeURIComponent(name)}`);
5078
5080
  }
5079
5081
  };
5082
+ var NotebookPreviewAuthApi = class {
5083
+ constructor(client) {
5084
+ this.client = client;
5085
+ }
5086
+ async get(id) {
5087
+ const response = await this.client.get(`/notebook/${id}/preview-auth`);
5088
+ return response.data;
5089
+ }
5090
+ async set(id, input) {
5091
+ const response = await this.client.put(`/notebook/${id}/preview-auth`, input);
5092
+ return response.data;
5093
+ }
5094
+ async delete(id) {
5095
+ await this.client.delete(`/notebook/${id}/preview-auth`);
5096
+ }
5097
+ };
5098
+ var NotebookMailApi = class {
5099
+ constructor(client) {
5100
+ this.client = client;
5101
+ }
5102
+ async status(id) {
5103
+ const response = await this.client.get(`/notebook/${id}/mail`);
5104
+ return response.data;
5105
+ }
5106
+ async enable(id) {
5107
+ const response = await this.client.put(`/notebook/${id}/mail`);
5108
+ return response.data;
5109
+ }
5110
+ async disable(id) {
5111
+ await this.client.delete(`/notebook/${id}/mail`);
5112
+ }
5113
+ async list(id, options = {}) {
5114
+ const response = await this.client.get(
5115
+ `/notebook/${id}/mails${formatQueryString(options)}`
5116
+ );
5117
+ return response.data;
5118
+ }
5119
+ async get(id, hash) {
5120
+ const response = await this.client.get(`/notebook/${id}/mails/${encodeURIComponent(hash)}`);
5121
+ return response.data;
5122
+ }
5123
+ async delete(id, hash) {
5124
+ await this.client.delete(`/notebook/${id}/mails/${encodeURIComponent(hash)}`);
5125
+ }
5126
+ };
5080
5127
  var _initPromise, _NotebookInstance_instances, init_fn;
5081
5128
  var NotebookInstance = class {
5082
5129
  constructor(data, client) {
@@ -5107,6 +5154,8 @@ var NotebookInstance = class {
5107
5154
  this.git = new Git(this);
5108
5155
  this.services = new Services(this);
5109
5156
  this.secrets = new NotebookSecrets(client, this.data.id);
5157
+ this.previewAuth = new NotebookPreviewAuth(client, this.data.id);
5158
+ this.mail = new NotebookMail(client, this.data.id);
5110
5159
  }
5111
5160
  async ready() {
5112
5161
  const terminalError = this.socket.getTerminalError();
@@ -5280,6 +5329,55 @@ var NotebookSecrets = class {
5280
5329
  return this.client.notebook.secrets.delete(this.notebookId, name);
5281
5330
  }
5282
5331
  };
5332
+ var NotebookPreviewAuth = class {
5333
+ constructor(client, notebookId) {
5334
+ this.client = client;
5335
+ this.notebookId = notebookId;
5336
+ }
5337
+ get() {
5338
+ return this.client.notebook.previewAuth.get(this.notebookId);
5339
+ }
5340
+ set(input) {
5341
+ return this.client.notebook.previewAuth.set(this.notebookId, input);
5342
+ }
5343
+ disable() {
5344
+ return this.client.notebook.previewAuth.delete(this.notebookId);
5345
+ }
5346
+ };
5347
+ var NotebookMail = class {
5348
+ constructor(client, notebookId) {
5349
+ this.client = client;
5350
+ this.notebookId = notebookId;
5351
+ }
5352
+ status() {
5353
+ return this.client.notebook.mail.status(this.notebookId);
5354
+ }
5355
+ enable() {
5356
+ return this.client.notebook.mail.enable(this.notebookId);
5357
+ }
5358
+ disable() {
5359
+ return this.client.notebook.mail.disable(this.notebookId);
5360
+ }
5361
+ list(options = {}) {
5362
+ return this.client.notebook.mail.list(this.notebookId, options);
5363
+ }
5364
+ get(hash) {
5365
+ return this.client.notebook.mail.get(this.notebookId, hash);
5366
+ }
5367
+ delete(hash) {
5368
+ return this.client.notebook.mail.delete(this.notebookId, hash);
5369
+ }
5370
+ };
5371
+ function formatQueryString(params) {
5372
+ const searchParams = new URLSearchParams();
5373
+ for (const [key, value] of Object.entries(params)) {
5374
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
5375
+ searchParams.set(key, String(value));
5376
+ }
5377
+ }
5378
+ const query = searchParams.toString();
5379
+ return query === "" ? "" : `?${query}`;
5380
+ }
5283
5381
  export {
5284
5382
  ApiError,
5285
5383
  Beacon,
@@ -5299,6 +5397,10 @@ export {
5299
5397
  NotebookApi,
5300
5398
  NotebookInitError,
5301
5399
  NotebookInstance,
5400
+ NotebookMail,
5401
+ NotebookMailApi,
5402
+ NotebookPreviewAuth,
5403
+ NotebookPreviewAuthApi,
5302
5404
  NotebookSecretApi,
5303
5405
  NotebookSecrets,
5304
5406
  NotebookState,