@phpsandbox/sdk 0.3.4 → 0.3.5
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 +19 -0
- package/dist/browser/phpsandbox-sdk.esm.js +40 -8
- package/dist/browser/phpsandbox-sdk.esm.min.js +8 -8
- package/dist/browser/phpsandbox-sdk.iife.js +40 -8
- package/dist/browser/phpsandbox-sdk.iife.min.js +6 -6
- package/dist/errors/index.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/servers.d.ts +30 -2
- package/dist/servers.js +33 -6
- package/package.json +1 -1
|
@@ -19715,6 +19715,15 @@ ${JSON.stringify(metadata, null, 2)}` : "";
|
|
|
19715
19715
|
constructor(client) {
|
|
19716
19716
|
this.client = client;
|
|
19717
19717
|
}
|
|
19718
|
+
async inspectInvitation(id, token) {
|
|
19719
|
+
return (await this.client.post(`/platform/server-invitations/${encodeURIComponent(id)}/inspect`, { token })).data;
|
|
19720
|
+
}
|
|
19721
|
+
async acceptInvitation(id, token) {
|
|
19722
|
+
return (await this.client.post(`/platform/server-invitations/${encodeURIComponent(id)}/accept`, { token })).data;
|
|
19723
|
+
}
|
|
19724
|
+
async declineInvitation(id, token) {
|
|
19725
|
+
return (await this.client.post(`/platform/server-invitations/${encodeURIComponent(id)}/decline`, { token })).data;
|
|
19726
|
+
}
|
|
19718
19727
|
async list(options = {}) {
|
|
19719
19728
|
const query = options.page === void 0 ? "" : `?${new URLSearchParams({ page: String(options.page) }).toString()}`;
|
|
19720
19729
|
return this.client.get(`/servers${query}`);
|
|
@@ -19740,17 +19749,40 @@ ${JSON.stringify(metadata, null, 2)}` : "";
|
|
|
19740
19749
|
const query = options.page === void 0 ? "" : `?${new URLSearchParams({ page: String(options.page) }).toString()}`;
|
|
19741
19750
|
return this.client.get(`/servers/${encodeURIComponent(this.data.id)}/members${query}`);
|
|
19742
19751
|
}
|
|
19743
|
-
async share(
|
|
19744
|
-
|
|
19745
|
-
|
|
19746
|
-
|
|
19747
|
-
|
|
19752
|
+
async share(target) {
|
|
19753
|
+
if (target.email !== void 0) {
|
|
19754
|
+
return (await this.client.post(`/platform/servers/${encodeURIComponent(this.data.id)}/invitations`, {
|
|
19755
|
+
email: target.email,
|
|
19756
|
+
requestId: target.requestId ?? crypto.randomUUID()
|
|
19757
|
+
})).data;
|
|
19758
|
+
}
|
|
19759
|
+
const body = { organizationId: target.organizationId, requestId: target.requestId };
|
|
19760
|
+
return (await this.client.post(`/servers/${encodeURIComponent(this.data.id)}/members`, body)).data;
|
|
19748
19761
|
}
|
|
19749
19762
|
async revokeAccess(memberId) {
|
|
19750
19763
|
await this.client.delete(
|
|
19751
19764
|
`/servers/${encodeURIComponent(this.data.id)}/members/${encodeURIComponent(String(memberId))}`
|
|
19752
19765
|
);
|
|
19753
19766
|
}
|
|
19767
|
+
async invitations(options = {}) {
|
|
19768
|
+
const query = options.page === void 0 ? "" : `?${new URLSearchParams({ page: String(options.page) }).toString()}`;
|
|
19769
|
+
return this.client.get(`/platform/servers/${encodeURIComponent(this.data.id)}/invitations${query}`);
|
|
19770
|
+
}
|
|
19771
|
+
async cancelInvitation(id) {
|
|
19772
|
+
const response = await this.client.delete(
|
|
19773
|
+
`/platform/servers/${encodeURIComponent(this.data.id)}/invitations/${encodeURIComponent(id)}`
|
|
19774
|
+
);
|
|
19775
|
+
if (response.data === void 0) {
|
|
19776
|
+
throw new PHPSandboxError("Missing invitation cancellation response.");
|
|
19777
|
+
}
|
|
19778
|
+
return response.data;
|
|
19779
|
+
}
|
|
19780
|
+
async resendInvitation(id) {
|
|
19781
|
+
return (await this.client.post(
|
|
19782
|
+
`/platform/servers/${encodeURIComponent(this.data.id)}/invitations/${encodeURIComponent(id)}/resend`,
|
|
19783
|
+
{}
|
|
19784
|
+
)).data;
|
|
19785
|
+
}
|
|
19754
19786
|
refresh() {
|
|
19755
19787
|
return this.client.servers.get(this.data.id);
|
|
19756
19788
|
}
|
|
@@ -20289,7 +20321,7 @@ ${JSON.stringify(metadata, null, 2)}` : "";
|
|
|
20289
20321
|
})
|
|
20290
20322
|
);
|
|
20291
20323
|
if (!response.ok) {
|
|
20292
|
-
throw await responseError(response);
|
|
20324
|
+
throw await responseError(response, path.startsWith("/platform/") ? "platform" : "core");
|
|
20293
20325
|
}
|
|
20294
20326
|
if (response.status === 204) {
|
|
20295
20327
|
return { data: void 0 };
|
|
@@ -20322,10 +20354,10 @@ ${JSON.stringify(metadata, null, 2)}` : "";
|
|
|
20322
20354
|
}
|
|
20323
20355
|
}
|
|
20324
20356
|
};
|
|
20325
|
-
async function responseError(response) {
|
|
20357
|
+
async function responseError(response, source = "core") {
|
|
20326
20358
|
const body = await response.text();
|
|
20327
20359
|
try {
|
|
20328
|
-
return remoteError(
|
|
20360
|
+
return remoteError(source, errorPayload(body === "" ? void 0 : JSON.parse(body)), response);
|
|
20329
20361
|
} catch {
|
|
20330
20362
|
return new TransportError(
|
|
20331
20363
|
`PHPSandbox API returned an invalid error response (HTTP ${response.status}).`,
|