2022-10-30 16:28:14 +08:00
|
|
|
<script>
|
|
|
|
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";
|
|
|
|
|
2023-08-15 02:20:49 +08:00
|
|
|
export let collection;
|
2022-10-30 16:28:14 +08:00
|
|
|
|
|
|
|
let responseTab = 204;
|
|
|
|
let responses = [];
|
|
|
|
|
|
|
|
$: backendAbsUrl = CommonHelper.getApiExampleUrl(ApiClient.baseUrl);
|
|
|
|
|
|
|
|
$: responses = [
|
|
|
|
{
|
|
|
|
code: 204,
|
|
|
|
body: "null",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
code: 400,
|
|
|
|
body: `
|
|
|
|
{
|
|
|
|
"code": 400,
|
|
|
|
"message": "Failed to authenticate.",
|
|
|
|
"data": {
|
|
|
|
"email": {
|
|
|
|
"code": "validation_required",
|
|
|
|
"message": "Missing required value."
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<h3 class="m-b-sm">Request verification ({collection.name})</h3>
|
|
|
|
<div class="content txt-lg m-b-sm">
|
|
|
|
<p>Sends <strong>{collection.name}</strong> verification email request.</p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<SdkTabs
|
|
|
|
js={`
|
|
|
|
import PocketBase from 'pocketbase';
|
|
|
|
|
|
|
|
const pb = new PocketBase('${backendAbsUrl}');
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
await pb.collection('${collection?.name}').requestVerification('test@example.com');
|
|
|
|
`}
|
|
|
|
dart={`
|
|
|
|
import 'package:pocketbase/pocketbase.dart';
|
|
|
|
|
|
|
|
final pb = PocketBase('${backendAbsUrl}');
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
await pb.collection('${collection?.name}').requestVerification('test@example.com');
|
|
|
|
`}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<h6 class="m-b-xs">API details</h6>
|
|
|
|
<div class="alert alert-success">
|
|
|
|
<strong class="label label-primary">POST</strong>
|
|
|
|
<div class="content">
|
|
|
|
<p>
|
2022-12-22 01:17:05 +08:00
|
|
|
/api/collections/<strong>{collection.name}</strong>/request-verification
|
2022-10-30 16:28:14 +08:00
|
|
|
</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>email</span>
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<span class="label">String</span>
|
|
|
|
</td>
|
|
|
|
<td>The auth record email address to send the verification request (if exists).</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>
|