2022-10-30 16:28:14 +08:00
|
|
|
<script>
|
|
|
|
import { Collection } from "pocketbase";
|
|
|
|
import ApiClient from "@/utils/ApiClient";
|
|
|
|
import CommonHelper from "@/utils/CommonHelper";
|
|
|
|
import CodeBlock from "@/components/base/CodeBlock.svelte";
|
|
|
|
import SdkTabs from "@/components/collections/docs/SdkTabs.svelte";
|
|
|
|
|
|
|
|
export let collection = new Collection();
|
|
|
|
|
2022-11-09 02:53:31 +08:00
|
|
|
let responseTab = 204;
|
2022-10-30 16:28:14 +08:00
|
|
|
let responses = [];
|
|
|
|
|
|
|
|
$: backendAbsUrl = CommonHelper.getApiExampleUrl(ApiClient.baseUrl);
|
|
|
|
|
|
|
|
$: responses = [
|
|
|
|
{
|
2022-11-09 02:53:31 +08:00
|
|
|
code: 204,
|
|
|
|
body: "null",
|
2022-10-30 16:28:14 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
code: 400,
|
|
|
|
body: `
|
|
|
|
{
|
|
|
|
"code": 400,
|
|
|
|
"message": "Failed to authenticate.",
|
|
|
|
"data": {
|
|
|
|
"token": {
|
|
|
|
"code": "validation_required",
|
|
|
|
"message": "Missing required value."
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<h3 class="m-b-sm">Confirm verification ({collection.name})</h3>
|
|
|
|
<div class="content txt-lg m-b-sm">
|
|
|
|
<p>Confirms <strong>{collection.name}</strong> account verification request.</p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<SdkTabs
|
|
|
|
js={`
|
|
|
|
import PocketBase from 'pocketbase';
|
|
|
|
|
|
|
|
const pb = new PocketBase('${backendAbsUrl}');
|
|
|
|
|
|
|
|
...
|
|
|
|
|
2022-11-09 02:53:31 +08:00
|
|
|
await pb.collection('${collection?.name}').confirmVerification('TOKEN');
|
2022-10-30 16:28:14 +08:00
|
|
|
`}
|
|
|
|
dart={`
|
|
|
|
import 'package:pocketbase/pocketbase.dart';
|
|
|
|
|
|
|
|
final pb = PocketBase('${backendAbsUrl}');
|
|
|
|
|
|
|
|
...
|
|
|
|
|
2022-11-09 02:53:31 +08:00
|
|
|
await pb.collection('${collection?.name}').confirmVerification('TOKEN');
|
2022-10-30 16:28:14 +08:00
|
|
|
`}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<h6 class="m-b-xs">API details</h6>
|
|
|
|
<div class="alert alert-success">
|
|
|
|
<strong class="label label-primary">POST</strong>
|
|
|
|
<div class="content">
|
|
|
|
<p>
|
|
|
|
/api/collections/<strong>{collection.name}</strong>/confirm-verification
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="section-title">Body Parameters</div>
|
|
|
|
<table class="table-compact table-border m-b-base">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Param</th>
|
|
|
|
<th>Type</th>
|
|
|
|
<th width="50%">Description</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<div class="inline-flex">
|
|
|
|
<span class="label label-success">Required</span>
|
|
|
|
<span>token</span>
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<span class="label">String</span>
|
|
|
|
</td>
|
|
|
|
<td>The token from the verification request email.</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<div class="section-title">Query parameters</div>
|
|
|
|
<table class="table-compact table-border m-b-base">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Param</th>
|
|
|
|
<th>Type</th>
|
|
|
|
<th width="60%">Description</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>expand</td>
|
|
|
|
<td>
|
|
|
|
<span class="label">String</span>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
Auto expand record relations. Ex.:
|
|
|
|
<CodeBlock content={`?expand=relField1,relField2.subRelField`} />
|
|
|
|
Supports up to 6-levels depth nested relations expansion. <br />
|
|
|
|
The expanded relations will be appended to the record under the
|
|
|
|
<code>expand</code> property (eg. <code>{`"expand": {"relField1": {...}, ...}`}</code>).
|
|
|
|
<br />
|
|
|
|
Only the relations to which the account has permissions to <strong>view</strong> will be expanded.
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<div class="section-title">Responses</div>
|
|
|
|
<div class="tabs">
|
|
|
|
<div class="tabs-header compact left">
|
|
|
|
{#each responses as response (response.code)}
|
|
|
|
<button
|
|
|
|
class="tab-item"
|
|
|
|
class:active={responseTab === response.code}
|
|
|
|
on:click={() => (responseTab = response.code)}
|
|
|
|
>
|
|
|
|
{response.code}
|
|
|
|
</button>
|
|
|
|
{/each}
|
|
|
|
</div>
|
|
|
|
<div class="tabs-content">
|
|
|
|
{#each responses as response (response.code)}
|
|
|
|
<div class="tab-item" class:active={responseTab === response.code}>
|
|
|
|
<CodeBlock content={response.body} />
|
|
|
|
</div>
|
|
|
|
{/each}
|
|
|
|
</div>
|
|
|
|
</div>
|