Maintainers
Pricing
Enterprise
More
More
Documentation
Try Live
Rankings
Install
Blog
Docs7
Ask
New
Add Docs
Khanh Docs
https://github.com/hckhanh/docs
Admin
Documentation for Khanh's open source libraries, published at docs.khanh.id.
Tokens:
1,057,129
Snippets:
6,417
Trust Score:
8.8
Update:
1 month ago
Context
Chat
Benchmark
Latest
Show doc for...
Code
Info
Show Results
Tokens:
Raw
Copy
Link
Tokens:
Raw
Copy
Link
================ LIBRARY RULES ================ - The published site is https://docs.khanh.id. - Each library is its own product. Pages start at /<library>/overview. - Use only the APIs and fields written on the pages for that library. ================ CODE SNIPPETS ================ ### Quick Example: With what-the-fetch Source: https://github.com/hckhanh/docs/blob/main/what-the-fetch/overview.mdx Shows how to define an API schema with Zod and create a type-safe fetch client using createFetch. The schema declares GET /users/:id and POST /users endpoints with inferred methods. Use this as the starting point for building a typed API client. ```typescript import { createFetch } from 'what-the-fetch'; import { z } from 'zod'; // Define API schema once (methods inferred automatically) const api = { '/users/:id': { // GET (no body) params: z.object({ id: z.number() }), query: z.object({ fields: z.string().optional() }), response: z.object({ id: z.number(), name: z.string(), email: z.string() }) }, '/users': { // POST (has body) body: z.object({ name: z.string(), email: z.string() }), response: z.object({ id: z.number(), name: z.string() }) } }; const apiFetch = createFetch(api, 'https://api.example.com'); ``` </Tab> <Tab title= ``` -------------------------------- ### Installation: npm, bun, pnpm Source: https://github.com/hckhanh/docs/blob/main/format-prompt/overview.mdx Commands to install format-prompt using npm, bun, or pnpm. ```bash npm install format-prompt # or bun add format-prompt # or pnpm add format-prompt ``` -------------------------------- ### Install fast-url with deno (jsr) Source: https://github.com/hckhanh/docs/blob/main/fast-url/getting-started.mdx Install fast-url from JSR using deno. ```bash deno add jsr:@hckhanh/fast-url ``` -------------------------------- ### Install what-the-fetch with yarn Source: https://github.com/hckhanh/docs/blob/main/what-the-fetch/getting-started.mdx Use this command to install what-the-fetch with the yarn package manager. ```bash yarn add what-the-fetch ``` -------------------------------- ### Install what-the-fetch with bun Source: https://github.com/hckhanh/docs/blob/main/what-the-fetch/getting-started.mdx Use this command to install what-the-fetch with the bun package manager. ```bash bun add what-the-fetch ``` -------------------------------- ### Install what-the-fetch with deno (jsr) Source: https://github.com/hckhanh/docs/blob/main/what-the-fetch/getting-started.mdx Use this command to install what-the-fetch from the jsr registry using deno. ```bash deno add jsr:@hckhanh/what-the-fetch ``` -------------------------------- ### Install what-the-fetch with npm Source: https://github.com/hckhanh/docs/blob/main/what-the-fetch/getting-started.mdx Use this command to install what-the-fetch with the npm package manager. ```bash npm install what-the-fetch ``` -------------------------------- ### Install what-the-fetch with pnpm Source: https://github.com/hckhanh/docs/blob/main/what-the-fetch/getting-started.mdx Use this command to install what-the-fetch with the pnpm package manager. ```bash pnpm add what-the-fetch ``` -------------------------------- ### Install fast-url with bun Source: https://github.com/hckhanh/docs/blob/main/fast-url/getting-started.mdx Install fast-url using the bun package manager. ```bash bun add fast-url ``` -------------------------------- ### Install fast-url with npm Source: https://github.com/hckhanh/docs/blob/main/fast-url/getting-started.mdx Install fast-url using the npm package manager. ```bash npm install fast-url ``` -------------------------------- ### Install format-prompt with npm, bun, pnpm, or yarn Source: https://github.com/hckhanh/docs/blob/main/format-prompt/getting-started.mdx Install the package using your preferred package manager. Choose one command based on your environment. ```bash # npm npm install format-prompt # bun bun add format-prompt # pnpm pnpm add format-prompt # yarn yarn add format-prompt ``` -------------------------------- ### GET /users Source: https://github.com/hckhanh/docs/blob/main/what-the-fetch/api-reference.mdx Example of a GET request with query parameters using the createFetch API. ```APIDOC ## GET /users ### Description Fetches a list of users with optional query parameters for pagination and sorting. ### Method GET ### Endpoint /users ### Parameters #### Query Parameters - **limit** (number) - Optional - Maximum number of users to return. - **offset** (number) - Optional - Number of users to skip. - **sort** (string) - Optional - Field to sort by. ### Request Example ```typescript const api = { "/users": { query: z.object({ limit: z.number().optional(), offset: z.number().optional(), sort: z.string().optional(), }), response: z.array( z.object({ id: z.number(), name: z.string(), }), ), }, } const apiFetch = createFetch(api, "https://api.example.com") const users = await apiFetch("/users", { query: { limit: 10, offset: 0, sort: "name" }, }) // GET https://api.example.com/users?limit=10&offset=0&sort=name ``` ### Response #### Success Response (200) - **id** (number) - The user's ID. - **name** (string) - The user's name. #### Response Example ```json [ { "id": 1, "name": "John Doe" } ] ``` ``` -------------------------------- ### Install fast-url with yarn Source: https://github.com/hckhanh/docs/blob/main/fast-url/getting-started.mdx Install fast-url using the yarn package manager. ```bash yarn add fast-url ``` -------------------------------- ### Install fast-url with pnpm Source: https://github.com/hckhanh/docs/blob/main/fast-url/getting-started.mdx Install fast-url using the pnpm package manager. ```bash pnpm add fast-url ``` -------------------------------- ### Install vn-number with npm Source: https://github.com/hckhanh/docs/blob/main/vn-number/overview.mdx Installs the vn-number package using npm. ```bash npm install vn-number ``` -------------------------------- ### Install @hckhanh/ja4 with npm and JSR Source: https://github.com/hckhanh/docs/blob/main/ja4/overview.mdx Install the package using either npm or JSR. The npm command installs the package, while the JSR command uses npx to add it as a dependency. ```sh # npm npm install @hckhanh/ja4 # JSR npx jsr add @hckhanh/ja4 ``` -------------------------------- ### Install Valibot schema validation library Source: https://github.com/hckhanh/docs/blob/main/what-the-fetch/getting-started.mdx Install Valibot, a schema validation library that implements Standard Schema, required for what-the-fetch. ```bash npm install valibot ``` -------------------------------- ### Create SettingsExperimental resource Source: https://github.com/hckhanh/docs/blob/main/pulumi-any-terraform/providers/portainer/resources/settings-experimental.mdx Creates a new portainer.SettingsExperimental resource with only required arguments set. The example uses an empty argument object; any other value is an option or example written in the SDK description. ```ts import * as portainer from "pulumi-portainer" const resource = new portainer.SettingsExperimental("settingsExperimental", {}) ``` -------------------------------- ### join() usage examples Source: https://github.com/hckhanh/docs/blob/main/fast-url/api-reference.mdx Examples of the join() function: URL path joining, different separators, query string joining, handling empty strings, and multiple character separators. ```javascript import { join } from "fast-url" // URL path joining const url1 = join("http://api.example.com/", "/", "/users") console.log(url1) // → 'http://api.example.com/users' // Works with different separators const url2 = join("http://api.example.com", "/", "users") console.log(url2) // → 'http://api.example.com/users' // Query string joining const query1 = join("name=John", "&", "&age=30") console.log(query1) // → 'name=John&age=30' // Handles empty strings const url3 = join("", "/", "users") console.log(url3) // → 'users' const url4 = join("http://api.example.com", "/", "") console.log(url4) // → 'http://api.example.com' // Multiple character separators const text = join("Hello", ", ", ", World") console.log(text) // → 'Hello, World' ``` -------------------------------- ### GET /users/:id Source: https://github.com/hckhanh/docs/blob/main/what-the-fetch/api-reference.mdx Example of a GET request with path parameters using the createFetch API. ```APIDOC ## GET /users/:id ### Description Fetches a user by their ID using a path parameter. ### Method GET ### Endpoint /users/:id ### Parameters #### Path Parameters - **id** (number) - Required - The user's ID. ### Request Example ```typescript const api = { "/users/:id": { params: z.object({ id: z.number() }), response: z.object({ id: z.number(), name: z.string(), email: z.string(), }), }, } const apiFetch = createFetch(api, "https://api.example.com") const user = await apiFetch("/users/:id", { params: { id: 123 }, }) // GET https://api.example.com/users/123 ``` ### Response #### Success Response (200) - **id** (number) - The user's ID. - **name** (string) - The user's name. - **email** (string) - The user's email. #### Response Example ```json { "id": 123, "name": "John Doe", "email": "john@example.com" } ``` ``` -------------------------------- ### GET /users/:id/posts Source: https://github.com/hckhanh/docs/blob/main/what-the-fetch/api-reference.mdx Example of a GET request with both path and query parameters using the createFetch API. ```APIDOC ## GET /users/:id/posts ### Description Fetches posts for a specific user, with optional query parameters for pagination and filtering. ### Method GET ### Endpoint /users/:id/posts ### Parameters #### Path Parameters - **id** (number) - Required - The user's ID. #### Query Parameters - **limit** (number) - Optional - Maximum number of posts to return. - **published** (boolean) - Optional - Filter by published status. ### Request Example ```typescript const api = { "/users/:id/posts": { params: z.object({ id: z.number() }), query: z.object({ limit: z.number().optional(), published: z.boolean().optional(), }), response: z.array( z.object({ id: z.number(), title: z.string(), }), ), }, } const apiFetch = createFetch(api, "https://api.example.com") const posts = await apiFetch("/users/:id/posts", { params: { id: 123 }, query: { limit: 10, published: true }, }) // GET https://api.example.com/users/123/posts?limit=10&published=true ``` ### Response #### Success Response (200) - **id** (number) - The post's ID. - **title** (string) - The post's title. #### Response Example ```json [ { "id": 1, "title": "Hello World" } ] ``` ``` -------------------------------- ### GET /users/:id (with custom headers and options) Source: https://github.com/hckhanh/docs/blob/main/what-the-fetch/api-reference.mdx Example of a GET request with custom headers and fetch options using the createFetch API. ```APIDOC ## GET /users/:id (with custom headers and options) ### Description Fetches a user by ID while allowing custom headers and fetch options. ### Method GET ### Endpoint /users/:id ### Parameters #### Path Parameters - **id** (number) - Required - The user's ID. #### Headers - **Authorization** (string) - Optional - Bearer token for authentication. - **X-Custom-Header** (string) - Optional - Custom header value. #### Options - **cache** (string) - Optional - Cache mode (e.g., "no-cache"). - **signal** (AbortSignal) - Optional - Abort signal for request cancellation. ### Request Example ```typescript const api = { "/users/:id": { params: z.object({ id: z.number() }), response: z.object({ id: z.number(), name: z.string() }), }, } const apiFetch = createFetch(api, "https://api.example.com") const user = await apiFetch( "/users/:id", { params: { id: 123 } }, { headers: { Authorization: "Bearer token", "X-Custom-Header": "value", }, cache: "no-cache", signal: abortController.signal, }, ) ``` ### Response #### Success Response (200) - **id** (number) - The user's ID. - **name** (string) - The user's name. #### Response Example ```json { "id": 123, "name": "John Doe" } ``` ``` -------------------------------- ### @GET/users, @get/posts, @GeT/comments Source: https://github.com/hckhanh/docs/blob/main/what-the-fetch/api-reference.mdx Shows that method prefixes are case-insensitive and converted to uppercase. All examples are treated as GET requests. ```APIDOC ## @GET/users, @get/posts, @GeT/comments ### Description Method prefixes are case-insensitive and converted to uppercase. All of these are treated as GET requests. ### Method GET ### Endpoint /users, /posts, /comments ### Parameters None ### Request Example None ### Response #### Success Response (200) No response schema specified. #### Response Example None ``` -------------------------------- ### Using HTTP Methods with @method Prefix Source: https://github.com/hckhanh/docs/blob/main/what-the-fetch/getting-started.mdx Define an API schema with automatic method inference and explicit @method prefixes for GET, PUT, PATCH, and DELETE. The example shows equivalent GET calls and explicit method calls. ```typescript const api = { // Automatic inference - these are equivalent "/users/:id": { // Uses GET (no body) params: z.object({ id: z.number() }), response: z.object({ id: z.number(), name: z.string() }), }, "@get/users/:id": { // Explicit GET - same as above params: z.object({ id: z.number() }), response: z.object({ id: z.number(), name: z.string() }), }, // POST is inferred when body is present "/users": { // Uses POST (has body) body: z.object({ name: z.string(), email: z.string().email() }), response: z.object({ id: z.number(), name: z.string() }), }, // Explicit methods for other HTTP verbs "@put/users/:id": { params: z.object({ id: z.number() }), body: z.object({ name: z.string() }), response: z.object({ id: z.number(), name: z.string() }), }, "@patch/users/:id": { params: z.object({ id: z.number() }), body: z.object({ name: z.string().optional() }), response: z.object({ id: z.number(), name: z.string() }), }, "@delete/users/:id": { params: z.object({ id: z.number() }), response: z.object({ success: z.boolean() }), }, } const apiFetch = createFetch(api, "https://api.example.com") // These two are equivalent - both use GET const user1 = await apiFetch("/users/:id", { params: { id: 123 } }) const user2 = await apiFetch("@get/users/:id", { params: { id: 123 } }) // POST inferred from body const created = await apiFetch("/users", { body: { name: "John", email: "john@example.com" }, }) // Explicit methods await apiFetch("@put/users/:id", { params: { id: 123 }, body: { name: "Jane" }, }) await apiFetch("@patch/users/:id", { params: { id: 123 }, body: { name: "Jane Doe" }, }) await apiFetch("@delete/users/:id", { params: { id: 123 } }) ``` -------------------------------- ### ApiSchema example with Zod Source: https://github.com/hckhanh/docs/blob/main/what-the-fetch/api-reference.mdx Example of an ApiSchema using Zod schemas. It defines a parameterized path /users/:id with params, query, and response schemas, and a /users path with query and response schemas. The comment indicates that /users is a GET request for listing users with pagination. ```typescript import { z } from "zod" const api: ApiSchema = { "/users/:id": { params: z.object({ id: z.number() }), query: z.object({ fields: z.string().optional() }), response: z.object({ id: z.number(), name: z.string() }), }, "/users": { // GET /users - List users with pagination query: z.object({ limit: z.number().optional(), offset: z.number().optional(), }), response: z.array(z.object({ id: z.number(), name: z.string() })), }, } ``` -------------------------------- ### Create a Rotating resource with pulumi-time Source: https://github.com/hckhanh/docs/blob/main/pulumi-any-terraform/providers/time/resources/rotating.mdx Creates a new time.Rotating resource with no required arguments. The example shows the minimal TypeScript setup for instantiating the resource. ```ts import * as time from "pulumi-time" const resource = new time.Rotating("rotating", {}) ``` -------------------------------- ### Create ProjectSettings with pulumi-posthog Source: https://github.com/hckhanh/docs/blob/main/pulumi-any-terraform/providers/posthog/resources/project-settings.mdx Creates a ProjectSettings resource with only required arguments. The resource name is "projectSettings" and no arguments are set. ```ts import * as posthog from "pulumi-posthog" const resource = new posthog.ProjectSettings("projectSettings", {}) ``` -------------------------------- ### Create a Store resource with pulumi-openfga Source: https://github.com/hckhanh/docs/blob/main/pulumi-any-terraform/providers/openfga/resources/store.mdx Use this TypeScript example to create a new openfga.Store resource. Only required arguments are set; a string in angle brackets stands in for any argument. The resource name is 'store' and no arguments are passed. ```typescript import * as openfga from "pulumi-openfga" const resource = new openfga.Store("store", {}) ``` -------------------------------- ### posthog:index/projectSettings:ProjectSettings Source: https://github.com/hckhanh/docs/blob/main/pulumi-any-terraform/providers/posthog/resources/project-settings.mdx Documentation for the ProjectSettings Pulumi resource, including its type, an example instantiation, and its configurable arguments. ```APIDOC ## posthog:index/projectSettings:ProjectSettings ### Description Resource ProjectSettings in pulumi-posthog. This resource manages project settings for a PostHog project. ### Pulumi Type `posthog:index/projectSettings:ProjectSettings` ### Example ```ts import * as posthog from "pulumi-posthog" const resource = new posthog.ProjectSettings("projectSettings", {}) ``` ### Arguments | Property | Type | Required | Description | | --- | --- | --- | --- | | `anonymizeIps` | `boolean` | no | Whether to discard the client IP address at ingestion (shown in PostHog as **Discard client IP data**). Enabling this degrades IP-based event matching for destinations that rely on it (for example Meta Conversions API), since `$ip` is never stored. | | `appUrls` | `string[]` | no | The project's authorized domains — shown in PostHog settings as **Web analytics domains** (and used as the toolbar's Authorized URLs). These are the domains tracked in web analytics and where the toolbar is enabled. Maps to the team `appUrls` field. Wildcards are not allowed; order is preserved. | | `autocaptureExceptionsOptIn` | `boolean` | no | Whether exception autocapture is enabled. | ``` -------------------------------- ### buildkite.OrganizationPipelineSettings Source: https://github.com/hckhanh/docs/blob/main/pulumi-any-terraform/providers/buildkite/resources/organization-pipeline-settings.mdx Creates a new OrganizationPipelineSettings resource in Pulumi. The example shows the minimal required arguments. ```APIDOC ## buildkite.OrganizationPipelineSettings ### Description Creates a new OrganizationPipelineSettings resource in Pulumi. The example shows the minimal required arguments. ### Pulumi Type `buildkite:index/organizationPipelineSettings:OrganizationPipelineSettings` ### Example ```ts import * as buildkite from "pulumi-buildkite" const resource = new buildkite.OrganizationPipelineSettings( "organizationPipelineSettings", {}, ) ``` ``` -------------------------------- ### Path Parameters Example Source: https://github.com/hckhanh/docs/blob/main/fast-url/getting-started.mdx Replace placeholders in a URL path with actual values using createUrl. The output is logged to the console. ```javascript import { createUrl } from "fast-url" const userId = 123 const url = createUrl("https://api.example.com", "/users/:id", { id: userId }) console.log(url) // → 'https://api.example.com/users/123' ``` -------------------------------- ### Create OpenAmtDevicesFeatures resource Source: https://github.com/hckhanh/docs/blob/main/pulumi-any-terraform/providers/portainer/resources/open-amt-devices-features.mdx Creates a new OpenAmtDevicesFeatures resource with required arguments `deviceId` and `environmentId`. The example uses placeholder values (0) and imports the `pulumi-portainer` package. ```ts import * as portainer from "pulumi-portainer" const resource = new portainer.OpenAmtDevicesFeatures( "openAmtDevicesFeatures", { deviceId: 0, environmentId: 0, }, ) ``` -------------------------------- ### createFetch() - Building a Complete API Client Source: https://github.com/hckhanh/docs/blob/main/what-the-fetch/api-reference.mdx Demonstrates building a complete API client class using createFetch with shared authentication headers and typed methods for CRUD operations. ```APIDOC ## createFetch() - Building a Complete API Client ### Description Build a complete API client class that uses createFetch with shared authentication headers and provides typed methods for common operations like listing, fetching, creating, and updating resources. ### Method createFetch ### Endpoint createFetch(api, baseUrl, sharedOptions) ### Parameters #### API Schema - **"/users"** (object) - Required - Endpoint for listing users with query parameters and response schema. - **"/users/:id"** (object) - Required - Endpoint for getting a user by ID. - **"/users/create"** (object) - Required - Endpoint for creating a new user. - **"/users/:id/update"** (object) - Required - Endpoint for updating a user. #### Shared Options - **headers** (object) - Optional - Headers to include in all requests, e.g., Authorization. ### Request Example ```typescript const api = { "/users": { query: z.object({ page: z.number().optional(), limit: z.number().optional(), }), response: z.object({ users: z.array(z.object({ id: z.number(), name: z.string() })), total: z.number(), }), }, "/users/:id": { params: z.object({ id: z.number() }), response: z.object({ id: z.number(), name: z.string(), email: z.string(), createdAt: z.string() }), }, "/users/create": { body: z.object({ name: z.string().min(3), email: z.string().email(), password: z.string().min(8) }), response: z.object({ id: z.number(), name: z.string(), email: z.string() }), }, "/users/:id/update": { params: z.object({ id: z.number() }), body: z.object({ name: z.string().min(3).optional(), email: z.string().email().optional() }), response: z.object({ id: z.number(), name: z.string(), email: z.string() }), }, } as const class APIClient { private fetch constructor(baseUrl: string, apiKey: string) { this.fetch = createFetch(api, baseUrl, { headers: { Authorization: `Bearer ${apiKey}` }, }) } async getUsers(page = 1, limit = 10) { return this.fetch("/users", { query: { page, limit } }) } async getUser(id: number) { return this.fetch("/users/:id", { params: { id } }) } async createUser(data: { name: string; email: string; password: string }) { return this.fetch("/users/create", { body: data }) } async updateUser(id: number, data: { name?: string; email?: string }) { return this.fetch("/users/:id/update", { params: { id }, body: data }) } } ``` ### Response #### Success Response Returns a fetch function that validates requests and responses against the defined schemas. #### Response Example ```typescript const client = new APIClient("https://api.example.com", "your-api-key") const users = await client.getUsers(1, 20) const user = await client.getUser(123) ``` ``` -------------------------------- ### ComputeContainerAppContainerStartupProbe (input) Source: https://github.com/hckhanh/docs/blob/main/pulumi-any-terraform/providers/bunnynet/resources/compute-container-app.mdx Input object for startup probe configuration. Contains thresholds, delays, and probe type for container startup health checks. ```APIDOC ## ComputeContainerAppContainerStartupProbe (input) ### Description Input object for startup probe configuration. Contains thresholds, delays, and probe type for container startup health checks. ### Fields - **failureThreshold** (number) - Optional - The number of failed probes to consider the container unhealthy. - **grpcs** (ComputeContainerAppContainerStartupProbeGrpc (input)[]) - Optional - gRPC-specific configurations. - **https** (ComputeContainerAppContainerStartupProbeHttp (input)[]) - Optional - HTTP-specific configurations. - **initialDelay** (number) - Optional - The amount of time in seconds after the container is started to wait before the first probe is sent. - **period** (number) - Optional - The amount of time in seconds between each probe. - **port** (number) - Required - The port within the container the probe will connect to. - **successThreshold** (number) - Optional - The number of successful probes to consider the container healthy. - **timeout** (number) - Optional - The amount of time in seconds the probe will wait for a response before considering it a failure. - **type** (string) - Required - Options: `grpc`, `http`, `tcp` ``` -------------------------------- ### Install vn-number with deno (jsr) Source: https://github.com/hckhanh/docs/blob/main/vn-number/overview.mdx Installs the vn-number package using deno from the jsr registry. ```bash deno add jsr:@hckhanh/vn-number ``` -------------------------------- ### DynamicSecretKubernetes Source: https://github.com/hckhanh/docs/blob/main/pulumi-any-terraform/providers/infisical/resources/dynamic-secret-kubernetes.mdx Documentation for the DynamicSecretKubernetes Pulumi resource, including its arguments and an example. ```APIDOC ## Resource: DynamicSecretKubernetes ### Description Creates a Kubernetes dynamic secret in Infisical using the Pulumi provider. This resource manages the lifecycle of a dynamic secret, including its configuration, TTL settings, and metadata. ### Pulumi Type `infisical:index/dynamicSecretKubernetes:DynamicSecretKubernetes` ### Example ```ts import * as infisical from "pulumi-infisical" const resource = new infisical.DynamicSecretKubernetes( "dynamicSecretKubernetes", { configuration: { authMethod: "<authMethod>", credentialType: "<credentialType>", }, defaultTtl: "<defaultTtl>", environmentSlug: "<environmentSlug>", path: "<path>", projectSlug: "<projectSlug>", }, ) ``` ### Arguments | Property | Type | Required | Description | | --- | --- | --- | --- | | `configuration` | `DynamicSecretKubernetesConfiguration (input)` | yes | The configuration of the dynamic secret | | `defaultTtl` | `string` | yes | The default TTL that will be applied for all the leases. | | `environmentSlug` | `string` | yes | The slug of the environment to create the dynamic secret in. | | `maxTtl` | `string` | no | The maximum limit a TTL can be leased or renewed for. | | `metadatas` | `DynamicSecretKubernetesMetadata (input)[]` | no | The metadata associated with this dynamic secret | | `name` | `string` | no | The name of the dynamic secret. | | `path` | `string` | yes | The path to create the dynamic secret in. | | `projectSlug` | `string` | yes | The slug of the project to create dynamic secret in. | | `usernameTemplate` | `string` | no | The username template of the dynamic secret | ``` -------------------------------- ### Combined Path and Query Parameters Example Source: https://github.com/hckhanh/docs/blob/main/fast-url/getting-started.mdx Mix path substitution with query parameters using createUrl. The output is logged to the console. ```javascript import { createUrl } from "fast-url" const url = createUrl("https://api.example.com", "/users/:id/posts", { id: 123, limit: 10, published: true, }) console.log(url) // → 'https://api.example.com/users/123/posts?limit=10&published=true' ``` -------------------------------- ### Install ArkType schema validation library Source: https://github.com/hckhanh/docs/blob/main/what-the-fetch/getting-started.mdx Install ArkType, a schema validation library that implements Standard Schema, required for what-the-fetch. ```bash npm install arktype ``` -------------------------------- ### Create ComputeContainerApp Source: https://github.com/hckhanh/docs/blob/main/pulumi-any-terraform/providers/bunnynet/resources/compute-container-app.mdx Example of creating a ComputeContainerApp resource with required arguments. ```APIDOC ## Create ComputeContainerApp ### Description Creates a new ComputeContainerApp resource in the pulumi-bunnynet provider. This resource manages a container application with configurable regions, autoscaling, containers, and volumes. ### Method Create ### Endpoint `new bunnynet.ComputeContainerApp(name, args, opts)` ### Parameters #### Arguments - `autoscalingMax` (number) - Optional - The maximum number of instances that will be provisioned per active region. - `autoscalingMin` (number) - Optional - The minimum number of instances that will be provisioned per active region. - `containers` (ComputeContainerAppContainer (input)[]) - Optional - Defines a container for the application. - `name` (string) - Optional - The name of the application. - `regionsAlloweds` (string[]) - Required - The regions that will be dynamically provisionable based on the user latency. - `regionsMaxAllowed` (number) - Optional - The maximum amount of regions to be deployed at any given time. - `regionsRequireds` (string[]) - Required - The regions that will be statically provisioned and will always be running and available to users. - `version` (number) - Optional - (no description provided) - `volumes` (ComputeContainerAppVolume (input)[]) - Optional - Defines a persistent volume to be used by the application. ### Request Example ```ts import * as bunnynet from "pulumi-bunnynet" const resource = new bunnynet.ComputeContainerApp("computeContainerApp", { regionsAlloweds: ["<regionsAlloweds>"], regionsRequireds: ["<regionsRequireds>"], }) ``` ### Response Returns a new ComputeContainerApp resource instance. ``` -------------------------------- ### createFetch() Source: https://github.com/hckhanh/docs/blob/main/what-the-fetch/api-reference.mdx Documentation for the createFetch function, including its signature, parameters, return type, and a usage example. ```APIDOC ## `createFetch()` ### Description Creates a type-safe fetch function for your API. ### Signature ```typescript function createFetch<Schema extends ApiSchema>( apis: Schema, baseUrl: string, sharedInit?: RequestInit, ): <Path extends ApiPath<Schema>>( path: Path, options?: FetchOptions<Schema, Path>, init?: RequestInit, ) => Promise<ApiData<Schema, Path, "response">> ``` ### Parameters - `apis` (Schema) - Required - An object mapping API paths to their schema definitions. - `baseUrl` (string) - Required - The base URL for all API requests. - `sharedInit` (RequestInit) - Optional - Shared [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/RequestInit) options that will be merged with per-request options. ### Returns A typed fetch function that accepts: - `path` (Path) - The API path (must be a key from your schema). - `options` (FetchOptions<Schema, Path>) - Optional - Request options (params, query, body) based on the path's schema. - `init` (RequestInit) - Optional - Per-request [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/RequestInit) to customize the fetch request (merged with sharedInit). ### Example ```typescript import { createFetch } from "what-the-fetch" import { z } from "zod" const api = { "/users/:id": { params: z.object({ id: z.number() }), query: z.object({ fields: z.string().optional() }), response: z.object({ id: z.number(), name: z.string(), email: z.string(), }), }, } const apiFetch = createFetch(api, "https://api.example.com") const user = await apiFetch("/users/:id", { params: { id: 123 }, query: { fields: "name,email" }, }) // user is typed as { id: number; name: string; email: string } ``` ``` -------------------------------- ### Install Zod schema validation library Source: https://github.com/hckhanh/docs/blob/main/what-the-fetch/getting-started.mdx Install Zod, a schema validation library that implements Standard Schema, required for what-the-fetch. ```bash npm install zod ``` -------------------------------- ### Install vn-number with yarn Source: https://github.com/hckhanh/docs/blob/main/vn-number/overview.mdx Installs the vn-number package using the yarn package manager. Use this command in a project that uses yarn. ```bash yarn add vn-number ``` -------------------------------- ### getKubernetesApplication Source: https://github.com/hckhanh/docs/blob/main/pulumi-any-terraform/providers/portainer/functions/get-kubernetes-application.mdx Documentation for the getKubernetesApplication function in the pulumi-portainer SDK, including arguments, result fields, and an example invocation. ```APIDOC ## portainer:index/getKubernetesApplication:getKubernetesApplication ### Description Invokes the `getKubernetesApplication` function from the pulumi-portainer SDK to retrieve details about a Kubernetes application. This function is called directly by users to fetch application information based on the provided arguments. ### Invoke Token `portainer:index/getKubernetesApplication:getKubernetesApplication` ### Arguments | Property | Type | Required | Description | | -------------- | -------- | -------- | ----------- | | `endpointId` | `number` | yes | | | `id` | `string` | no | | | `name` | `string` | yes | | | `namespace` | `string` | yes | | | `resourceType` | `string` | no | | ### Result | Property | Type | Always present | Description | | ------------------ | --------------------------- | -------------- | ----------- | | `applicationOwner` | `string` | yes | | | `applicationType` | `string` | yes | | | `creationDate` | `string` | yes | | | `deploymentType` | `string` | yes | | | `details` | `string` | yes | | | `endpointId` | `number` | yes | | | `id` | `string` | yes | | | `image` | `string` | yes | | | `kind` | `string` | yes | | | `labels` | `{ [key: string]: string }` | yes | | | `loadBalancerIp` | `string` | yes | | | `name` | `string` | yes | | | `namespace` | `string` | yes | | | `resourceType` | `string` | no | | | `runningPods` | `number` | yes | | | `serviceName` | `string` | yes | | | `serviceType` | `string` | yes | | | `stackId` | `string` | yes | | | `stackName` | `string` | yes | | | `status` | `string` | yes | | | `totalPods` | `number` | yes | | | `uid` | `string` | yes | | ### Example ```ts import * as portainer from "pulumi-portainer" const result = await portainer.getKubernetesApplication({ endpointId: 0, name: "<name>", namespace: "<namespace>", }) ``` `getKubernetesApplicationOutput` accepts Input values and returns `Output` of the same result. ``` -------------------------------- ### new betteruptime.IncomingWebhook() Source: https://github.com/hckhanh/docs/blob/main/pulumi-any-terraform/providers/better-uptime/resources/incoming-webhook.mdx Creates a new IncomingWebhook resource with the specified configuration. ```APIDOC ## new betteruptime.IncomingWebhook() ### Description Creates a new IncomingWebhook resource with the specified configuration. ### Method Constructor ### Endpoint `new betteruptime.IncomingWebhook(name, args, opts)` ### Parameters #### Arguments - **acknowledgedAlertIdField** (IncomingWebhookAcknowledgedAlertIdField (input)) - Optional - When acknowledging an incident, how to extract an alert id, a unique alert identifier which will be used to acknowledge and resolve incidents. - **acknowledgedRuleType** (string) - Required - Should an incident be acknowledged for all webhooks, those satisfying all acknowledged_rules, or those satisfying any of them. Valid values are unused, all, or any - **acknowledgedRules** (IncomingWebhookAcknowledgedRule (input)[]) - Optional - An array of rules to match to acknowledge an incident. - **call** (boolean) - Optional - Whether to call when a new incident is created. - **causeField** (IncomingWebhookCauseField (input)) - Optional - A field describing how to extract an incident cause, used as a short description shared with the team member on-call. - **criticalAlert** (boolean) - Optional - Whether to send a critical push notification that ignores the mute switch and Do not Disturb mode when a new incident is created. - **email** (boolean) - Optional - Whether to send an email when a new incident is created. - **name** (string) - Optional - The name of this incoming webhook. - **otherAcknowledgedFields** (IncomingWebhookOtherAcknowledgedField (input)[]) - Optional - An array of additional fields, which will be extracted when acknowledging an incident. - **otherResolvedFields** (IncomingWebhookOtherResolvedField (input)[]) - Optional - An array of additional fields, which will be extracted when resolving an incident. - **otherStartedFields** (IncomingWebhookOtherStartedField (input)[]) - Optional - An array of additional fields, which will be extracted when starting an incident. - **paused** (boolean) - Optional - Set to true to pause monitoring - we won't notify you about downtime. Set to false to resume monitoring. - **policyId** (string) - Optional - ID of the escalation policy associated with the incoming webhook. - **resolvedAlertIdField** (IncomingWebhookResolvedAlertIdField (input)) - Optional - When resolving an incident, how to extract an alert id, a unique alert identifier which will be used to acknowledge and resolve incidents. - **resolvedRuleType** (string) - Required - Should an incident be resolved for all webhooks, those satisfying all resolved_rules, or those satisfying any of them. Valid values are unused, all, or any. - **resolvedRules** (IncomingWebhookResolvedRule (input)[]) - Optional - An array of rules to match to resolve an incident. - **sms** (boolean) - Optional - Whether to send an SMS when a new incident is created. - **startedAlertIdField** (IncomingWebhookStartedAlertIdField (input)) - Optional - When starting an incident, how to extract an alert id, a unique alert identifier which will be used to acknowledge and resolve incidents. - **startedRuleType** (string) - Required - Should an incident be started for all webhooks, those satisfying all started_rules, or those satisfying any of them. Valid values are unused, all, or any. - **startedRules** (IncomingWebhookStartedRule (input)[]) - Optional - An array of rules to match to start an incident. - **teamName** (string) - Optional - The name of the team associated with the incoming webhook. - **webhookType** (string) - Optional - The type of the webhook. ### Request Example ```typescript import * as betteruptime from "pulumi-better-uptime" const resource = new betteruptime.IncomingWebhook("incomingWebhook", { acknowledgedRuleType: "<acknowledgedRuleType>", resolvedRuleType: "<resolvedRuleType>", startedRuleType: "<startedRuleType>", }) ``` ### Response #### Success Response (200) - **id** (string) - The ID of the created IncomingWebhook resource. #### Response Example ```json { "id": "string" } ``` ``` -------------------------------- ### getDockerVolume example Source: https://github.com/hckhanh/docs/blob/main/pulumi-any-terraform/providers/portainer/functions/get-docker-volume.mdx Calls the getDockerVolume function with the required arguments endpointId and name. The example uses TypeScript and imports the pulumi-portainer package. ```ts import * as portainer from "pulumi-portainer" const result = await portainer.getDockerVolume({ endpointId: 0, name: "<name>", }) ``` -------------------------------- ### Create AppConnectionBitbucket with TypeScript Source: https://github.com/hckhanh/docs/blob/main/pulumi-any-terraform/providers/infisical/resources/app-connection-bitbucket.mdx Creates a new infisical.AppConnectionBitbucket resource. Only required arguments are set; strings in angle brackets stand in for argument values. The example sets the credentials (apiToken and email) and method arguments. ```ts import * as infisical from "pulumi-infisical" const resource = new infisical.AppConnectionBitbucket( "appConnectionBitbucket", { credentials: { apiToken: "<apiToken>", email: "<email>", }, method: "<method>", }, ) ``` -------------------------------- ### getSshKey TypeScript example Source: https://github.com/hckhanh/docs/blob/main/pulumi-any-terraform/providers/teamcity/functions/get-ssh-key.mdx Invokes the teamcity.getSshKey function with required arguments name and projectId. The example uses TypeScript and imports the pulumi-teamcity module. ```ts import * as teamcity from "pulumi-teamcity" const result = await teamcity.getSshKey({ name: "<name>", projectId: "<projectId>", }) ``` -------------------------------- ### getDockerSecret TypeScript example Source: https://github.com/hckhanh/docs/blob/main/pulumi-any-terraform/providers/portainer/functions/get-docker-secret.mdx Invokes the portainer.getDockerSecret function with the required arguments endpointId and name. The example uses TypeScript and imports the pulumi-portainer package. ```ts import * as portainer from "pulumi-portainer" const result = await portainer.getDockerSecret({ endpointId: 0, name: "<name>", }) ``` -------------------------------- ### Method Prefix with Path Parameters Source: https://github.com/hckhanh/docs/blob/main/what-the-fetch/api-reference.mdx Shows how method prefixes combine with path parameters in a typed API definition. The example defines an api object with a @put/users/:userId/posts/:postId endpoint, creates a fetch client, and calls it with params and body. The resulting request is PUT https://api.example.com/users/123/posts/456. ```typescript const api = { "@put/users/:userId/posts/:postId": { params: z.object({ userId: z.number(), postId: z.number(), }), body: z.object({ title: z.string(), content: z.string() }), response: z.object({ success: z.boolean() }), }, } const apiFetch = createFetch(api, "https://api.example.com") await apiFetch("@put/users/:userId/posts/:postId", { params: { userId: 123, postId: 456 }, body: { title: "Updated", content: "New content" }, }) // PUT https://api.example.com/users/123/posts/456 ``` ```typescript const api = { "@GET/users": {/* ... */}, "@get/posts": {/* ... */}, "@GeT/comments": {/* ... */}, } // All are treated as GET ``` -------------------------------- ### Create IncomingWebhook with betteruptime.IncomingWebhook Source: https://github.com/hckhanh/docs/blob/main/pulumi-any-terraform/providers/better-uptime/resources/incoming-webhook.mdx Creates a new IncomingWebhook resource using the pulumi-better-uptime SDK. Only required arguments are set; strings in angle brackets are placeholders for actual values. The example shows the required acknowledgedRuleType, resolvedRuleType, and startedRuleType arguments. ```ts import * as betteruptime from "pulumi-better-uptime" const resource = new betteruptime.IncomingWebhook("incomingWebhook", { acknowledgedRuleType: "<acknowledgedRuleType>", resolvedRuleType: "<resolvedRuleType>", startedRuleType: "<startedRuleType>", }) ``` -------------------------------- ### Install vn-number with pnpm Source: https://github.com/hckhanh/docs/blob/main/vn-number/overview.mdx Installs the vn-number package using the pnpm package manager. Use this command in a project that uses pnpm as its package manager. ```bash pnpm add vn-number ``` -------------------------------- ### Install vn-number with bun Source: https://github.com/hckhanh/docs/blob/main/vn-number/overview.mdx Installs the vn-number package using the bun package manager. Use this command in a project that uses bun as its package manager. ```bash bun add vn-number ``` -------------------------------- ### createUrl() usage example Source: https://github.com/hckhanh/docs/blob/main/fast-url/api-reference.mdx Imports createUrl from fast-url and builds a URL by substituting the :id path parameter. Any unused params are appended as a query string. ```javascript import { createUrl } from "fast-url" const url = createUrl("http://api.example.com/users/:id", { id: 42, active: true, page: 2 }) ``` -------------------------------- ### Create a PipelineSchedule with required arguments Source: https://github.com/hckhanh/docs/blob/main/pulumi-any-terraform/providers/buildkite/resources/pipeline-schedule.mdx This example creates a PipelineSchedule resource using the pulumi-buildkite provider. Only required arguments are set; strings in angle brackets are placeholders for actual values. ```ts import * as buildkite from "pulumi-buildkite" const resource = new buildkite.PipelineSchedule("pipelineSchedule", { branch: "<branch>", cronline: "<cronline>", label: "<label>", pipelineId: "<pipelineId>", }) ``` -------------------------------- ### posthog.Experiment Source: https://github.com/hckhanh/docs/blob/main/pulumi-any-terraform/providers/posthog/resources/experiment.mdx Creates a new Experiment resource in pulumi-posthog. The example shows the minimal required arguments. ```APIDOC ## posthog.Experiment ### Description Creates a new Experiment resource in pulumi-posthog. ### Pulumi Type `posthog:index/experiment:Experiment` ### Example ```ts import * as posthog from "pulumi-posthog" const resource = new posthog.Experiment("experiment", { featureFlagKey: "featureFlagKey", }) ``` ### Arguments | Property | Type | Required | Description | | --- | --- | --- | --- | | `allowUnknownEvents` | `boolean` | no | Opt-in bypass of the API validation that rejects metrics referencing not-yet-ingested events. Sent on every write (so a draft with such a metric can still be launched/edited); config-only, not read back from the API. | | `description` | `string` | no | Experiment description. | ``` -------------------------------- ### getRole TypeScript example Source: https://github.com/hckhanh/docs/blob/main/pulumi-any-terraform/providers/better-uptime/functions/get-role.mdx Calls the getRole function with the required name argument. The example uses a placeholder string for the name and returns a promise with the result. ```ts import * as betteruptime from "pulumi-better-uptime" const result = await betteruptime.getRole({ name: "<name>", }) ```