feat(examples): worked example for apis blocks
This commit is contained in:
@@ -1084,6 +1084,7 @@
|
|||||||
"BackoffStrategy",
|
"BackoffStrategy",
|
||||||
"Bucket",
|
"Bucket",
|
||||||
"BudgetViolation",
|
"BudgetViolation",
|
||||||
|
"BuiltApiRequest",
|
||||||
"Bulkhead",
|
"Bulkhead",
|
||||||
"BulkheadOptions",
|
"BulkheadOptions",
|
||||||
"CSRF_COOKIE",
|
"CSRF_COOKIE",
|
||||||
@@ -1204,6 +1205,7 @@
|
|||||||
"UploadScanner",
|
"UploadScanner",
|
||||||
"assertTenantAccess",
|
"assertTenantAccess",
|
||||||
"bridgeRealtime",
|
"bridgeRealtime",
|
||||||
|
"buildApiRequest",
|
||||||
"cacheControl",
|
"cacheControl",
|
||||||
"checkPerformanceBudgets",
|
"checkPerformanceBudgets",
|
||||||
"collectUploads",
|
"collectUploads",
|
||||||
@@ -1229,6 +1231,7 @@
|
|||||||
"escapeHtml",
|
"escapeHtml",
|
||||||
"etag",
|
"etag",
|
||||||
"executionContextFromHttp",
|
"executionContextFromHttp",
|
||||||
|
"getRequestContext",
|
||||||
"getUser",
|
"getUser",
|
||||||
"hashPassword",
|
"hashPassword",
|
||||||
"isRoomDefinition",
|
"isRoomDefinition",
|
||||||
@@ -1260,9 +1263,11 @@
|
|||||||
"requestId",
|
"requestId",
|
||||||
"requestLogger",
|
"requestLogger",
|
||||||
"requireAuth",
|
"requireAuth",
|
||||||
|
"requireRequestContext",
|
||||||
"requireTenant",
|
"requireTenant",
|
||||||
"resilientCall",
|
"resilientCall",
|
||||||
"resolveRequestUrl",
|
"resolveRequestUrl",
|
||||||
|
"runWithRequestContext",
|
||||||
"sanitizeFilename",
|
"sanitizeFilename",
|
||||||
"saveUpload",
|
"saveUpload",
|
||||||
"saveUploadSecure",
|
"saveUploadSecure",
|
||||||
@@ -1465,6 +1470,7 @@
|
|||||||
"startServer",
|
"startServer",
|
||||||
"toRequest",
|
"toRequest",
|
||||||
"validateRpcCsrf",
|
"validateRpcCsrf",
|
||||||
|
"withServerFnRequestContext",
|
||||||
"writeResponse"
|
"writeResponse"
|
||||||
],
|
],
|
||||||
"./serve-entry": []
|
"./serve-entry": []
|
||||||
@@ -2782,6 +2788,7 @@
|
|||||||
"parseStructuredImports",
|
"parseStructuredImports",
|
||||||
"positionAt",
|
"positionAt",
|
||||||
"runtimeTypeOf",
|
"runtimeTypeOf",
|
||||||
|
"skipLiteralOrComment",
|
||||||
"sliceSource",
|
"sliceSource",
|
||||||
"stripRuntimeFunctionModifiers",
|
"stripRuntimeFunctionModifiers",
|
||||||
"supportsSyntaxFeature",
|
"supportsSyntaxFeature",
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ page ApiBlockDemo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
load server serverSearch {
|
||||||
|
const users = await api.searchDirectory({ name: "a" })
|
||||||
|
return { names: users.map((user) => user.name).join(", ") }
|
||||||
|
}
|
||||||
|
|
||||||
functions {
|
functions {
|
||||||
client async function search(): Promise<void> {
|
client async function search(): Promise<void> {
|
||||||
const users = await api.searchDirectory({ name: nameFilter })
|
const users = await api.searchDirectory({ name: nameFilter })
|
||||||
@@ -33,6 +38,12 @@ page ApiBlockDemo {
|
|||||||
<button @click="search()">Search</button>
|
<button @click="search()">Search</button>
|
||||||
<p class="found" data-text="found">{found}</p>
|
<p class="found" data-text="found">{found}</p>
|
||||||
<p class="failed" data-text="failed">{failed}</p>
|
<p class="failed" data-text="failed">{failed}</p>
|
||||||
|
<Async source="serverSearch">
|
||||||
|
<Loading><p class="server-found">Loading…</p></Loading>
|
||||||
|
<Success data="serverSearch"><p class="server-found">{serverSearch.names}</p></Success>
|
||||||
|
<Error error="error"><p class="server-found">Failed: {error.message}</p></Error>
|
||||||
|
</Async>
|
||||||
|
<p class="bound" api="searchDirectory({ name: 'a' })">loading</p>
|
||||||
</main>
|
</main>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user