### Load Dotenv Configuration with require() for env-var Source: https://github.com/evanshortiss/env-var/blob/master/EXAMPLE.md This example illustrates how to load environment variables from a `.env` file using `dotenv.config()` before `env-var` accesses them. It's the standard way to integrate `dotenv` by requiring it at the top of your script. ```js // Read in the .env file require('dotenv').config() // Read the MY_VAR entry that dotenv created const env = require('env-var') const myVar = env.get('MY_VAR').asString() ``` -------------------------------- ### Define Example Value for Environment Variable Source: https://github.com/evanshortiss/env-var/blob/master/API.md The `example()` method allows developers to provide a valid example value for an environment variable. This example is included in error messages when a required variable is missing or incorrectly set, aiding in diagnosis. ```js const env = require('env-var') const ADMIN_EMAIL = env.get('ADMIN_EMAIL') .required() .example('admin@example.com') .asString() ``` ```APIDOC variable.example(value: string): variable value: A string representing an example of a valid value for the environment variable. Returns: The 'variable' object for chaining. ``` -------------------------------- ### Install env-var with npm Source: https://github.com/evanshortiss/env-var/blob/master/README.md Command to install the env-var package using npm. ```shell npm install env-var ``` -------------------------------- ### Install env-var with yarn Source: https://github.com/evanshortiss/env-var/blob/master/README.md Command to install the env-var package using yarn. ```shell yarn add env-var ``` -------------------------------- ### env-var Module API Structure Overview Source: https://github.com/evanshortiss/env-var/blob/master/API.md This section outlines the hierarchical structure of the `env-var` module's API, listing its main functions and the methods available on the `variable` object returned by `get()`. ```APIDOC module (env-var) from(values, extraAccessors, logger) get(varname) variable example(string) default(defaultValue: string) required(isRequired = true) covertFromBase64() asArray(delimiter: string) asBool() asBoolStrict() asEmailString() asEnum(validValues: string) asFloat() asFloatNegative() asFloatPositive() asInt() asIntNegative() asIntPositive() asJson() asJsonArray() asJsonObject() asPortNumber() asRegExp(flags: string) asString() asUrlObject() asUrlString() EnvVarError() accessors ``` -------------------------------- ### Use the new custom environment variable accessor Source: https://github.com/evanshortiss/env-var/blob/master/CONTRIBUTING.md Example of how to use the newly added custom accessor function `asNumberZero` to retrieve and validate an environment variable. ```JavaScript // Uses your new function to ensure the SOME_NUMBER is the integer 0 env.get('SOME_NUMBER').asNumberZero() ``` -------------------------------- ### Preload Dotenv Configuration via Node CLI Arguments Source: https://github.com/evanshortiss/env-var/blob/master/EXAMPLE.md This snippet shows how to preload `dotenv` using the `node -r dotenv/config` CLI flag. This method loads environment variables from `.env` before your script executes, making them available to `env-var` without an explicit `require('dotenv').config()` call in the script itself. ```js // This is just a regular node script, but we started it using the command // "node -r dotenv/config your_script.js" via the terminal. This tells node // to load our variables using dotenv before running the rest of our script! // Read the MY_VAR entry that dotenv created const env = require('env-var') const myVar = env.get('MY_VAR').asString() ``` -------------------------------- ### Configure env-var with Pino for Custom Logging Source: https://github.com/evanshortiss/env-var/blob/master/EXAMPLE.md This snippet demonstrates how to integrate a custom logger, specifically Pino, with `env-var`. It shows how to pass a custom logging function to `env-var`'s `from` method to capture and process log messages, allowing for filtered or custom formatted output. ```js const pino = require('pino')() const customLogger = (varname, str) => { // varname is the name of the variable being read, e.g "API_KEY" // str is the log message, e.g "verifying variable value is not empty" log.trace(`env-var log (${varname}): ${str}`) } const { from } = require('env-var') const env = from(process.env, {}, customLogger) const API_KEY = env.get('API_KEY').required().asString() ``` -------------------------------- ### Custom Accessor with Additional Arguments in JavaScript Source: https://github.com/evanshortiss/env-var/blob/master/API.md This JavaScript example extends the 'asEmail' accessor to accept an optional 'requiredDomain' argument. It demonstrates how to pass additional parameters to custom accessors when they are invoked, allowing for more flexible validation logic, such as ensuring an email belongs to a specific domain. ```JavaScript const { from } = require('env-var') // Environment variable that we will use for this example: process.env.ADMIN = 'admin@example.com' // Add an accessor named 'asEmail' that verifies that the value is a // valid-looking email address. // // Note that the accessor function also accepts an optional second // parameter `requiredDomain` which can be provided when the accessor is // invoked (see below). const env = from(process.env, { asEmail: (value, requiredDomain) => { const split = String(value).split('@') // Validating email addresses is hard. if (split.length !== 2) { throw new Error('must contain exactly one "@"') } if (requiredDomain && (split[1] !== requiredDomain)) { throw new Error(`must end with @${requiredDomain}`) } return value } }) // We specified 'asEmail' as the name for the accessor above, so now // we can call `asEmail()` like any other accessor. // // `env-var` will provide the first argument for the accessor function // (`value`), but we declared a second argument `requiredDomain`, which // we can provide when we invoke the accessor. // Calling the accessor without additional parameters accepts an email // address with any domain. let validEmail = env.get('ADMIN').asEmail() // If we specify a parameter, then the email address must end with the // domain we specified. let invalidEmail = env.get('ADMIN').asEmail('github.com') ``` -------------------------------- ### Retrieve Environment Variables with env-var.get() Source: https://github.com/evanshortiss/env-var/blob/master/API.md The `get()` function retrieves environment variables. It can read a specific variable by name or, if no argument is passed, return the entire `process.env` object. The returned `variable` object provides methods for validation and access. ```js const env = require('env-var') // #1 - Read the requested variable and parse it to a positive integer const limit = env.get('MAX_CONNECTIONS').asIntPositive() // #2 - Returns the entire process.env object const allVars = env.get() ``` ```APIDOC get(varname?: string): variable | Object varname: Optional. The name of the environment variable to retrieve. Returns: A 'variable' object if 'varname' is provided, otherwise the entire 'process.env' object. ``` -------------------------------- ### Define and Use a Basic Custom Accessor in JavaScript Source: https://github.com/evanshortiss/env-var/blob/master/API.md This JavaScript example shows how to define a custom 'asEmail' accessor using 'env-var's 'from()' method. The accessor validates if an environment variable's value looks like a valid email address by checking for a single '@' symbol. It demonstrates how to attach and then invoke the custom accessor on an environment variable. ```JavaScript const { from } = require('env-var') // Environment variable that we will use for this example: process.env.ADMIN = 'admin@example.com' // Add an accessor named 'asEmail' that verifies that the value is a // valid-looking email address. const env = from(process.env, { asEmail: (value) => { const split = String(value).split('@') // Validating email addresses is hard. if (split.length !== 2) { throw new Error('must contain exactly one "@"') } return value } }) // We specified 'asEmail' as the name for the accessor above, so now // we can call `asEmail()` like any other accessor. let validEmail = env.get('ADMIN').asEmail() ``` -------------------------------- ### Define a new environment variable accessor module Source: https://github.com/evanshortiss/env-var/blob/master/CONTRIBUTING.md Example structure for a new accessor module in `lib/accessors`. It validates if an environment variable is an integer and equals zero. Custom logic should be placed within this function. ```JavaScript /** * Validate that the environment value is an integer and equals zero. * This is a strange example, but hopefully demonstrates the idea. * @param {String} environmentValue this is the string from process.env */ module.exports = function numberZero (environmentValue) { // Your custom code should go here...below code is an example const val = parseInt(environmentValue) if (val === 0) { return ret; } else { throw new Error('should be zero') } } ``` -------------------------------- ### Accessing Environment Variables in Node.js (JavaScript) Source: https://github.com/evanshortiss/env-var/blob/master/README.md Demonstrates how to retrieve and validate environment variables in a Node.js JavaScript application using env-var. It shows examples for required string variables with base64 decoding and optional port numbers with default values. ```javascript const env = require('env-var'); // Or using module import syntax: // import env from 'env-var' const PASSWORD = env.get('DB_PASSWORD') // Throws an error if the DB_PASSWORD variable is not set (optional) .required() // Decode DB_PASSWORD from base64 to a utf8 string (optional) .convertFromBase64() // Call asString (or other APIs) to get the variable value (required) .asString(); // Read in a port (checks that PORT is in the range 0 to 65535) // Alternatively, use a default value of 5432 if PORT is not defined const PORT = env.get('PORT').default('5432').asPortNumber() ``` -------------------------------- ### Define Custom Accessor with ExtensionFn in TypeScript Source: https://github.com/evanshortiss/env-var/blob/master/API.md This TypeScript example demonstrates how to create a custom accessor using the 'ExtensionFn' type provided by 'env-var'. It shows how to define a type-safe 'asEmail' accessor that validates an email format and integrates it with 'env-var's 'from()' method, ensuring type correctness for custom extensions. ```TypeScript import { from, ExtensionFn, EnvVarError } from 'env-var' // Environment variable that we will use for this example: process.env.ADMIN = 'admin@example.com' const asEmail: ExtensionFn = (value) => { const split = String(value).split('@') // Validating email addresses is hard. if (split.length !== 2) { throw new Error('must contain exactly one "@"') } return value } const env = from(process.env, { asEmail }) // Returns the email string if it's valid, otherwise it will throw env.get('ADMIN').asEmail() ``` -------------------------------- ### Using env-var in Web Applications Source: https://github.com/evanshortiss/env-var/blob/master/README.md Demonstrates how to use env-var in web applications where process.env might not be directly available. It shows how to create an env object using the from function with import.meta.env. ```typescript import { from } from 'env-var' const env = from({ BASE_URL: import.meta.env.BASE_URL, VITE_CUSTOM_VARIABLE: import.meta.env.CUSTOM_VARIABLE }) ``` -------------------------------- ### Initialize env-var with Custom Environment Values Source: https://github.com/evanshortiss/env-var/blob/master/API.md The `from()` function allows creating an `env-var` instance that reads from a custom `values` object instead of `process.env`. It's useful for testing or non-Node.js environments. Optional `extraAccessors` and a `logger` function can also be provided. ```js const env = require('env-var').from({ API_BASE_URL: 'https://my.api.com/' }) // apiUrl will be 'https://my.api.com/' const apiUrl = env.get('API_BASE_URL').asUrlString() ``` ```APIDOC from(values: Object, extraAccessors: Object, logger: Function) values: An object containing key-value pairs for environment variables. extraAccessors: Optional. An object containing custom accessor functions. logger: Optional. A function to handle logging, matching signature: yourLoggerFn(varname: String, str: String) varname: The name of the variable being read (e.g., "API_KEY"). str: The log message (e.g., "verifying variable value is not empty"). ``` -------------------------------- ### Using Direct Accessors for env-var Parsing Source: https://github.com/evanshortiss/env-var/blob/master/API.md This snippet demonstrates the use of `env.accessors` to directly parse and validate values without first calling `env.get()`. It shows how to use `asJson()` directly on a string value, contrasting it with the chained method. ```javascript const env = require('env-var') // Validate that the string is JSON, and return the parsed result const myJsonDirectAccessor = env.accessors.asJson(process.env.SOME_JSON) const myJsonViaEnvVar = env.get('SOME_JSON').asJson() ``` -------------------------------- ### Integrate new accessor into getVariableAccessors Source: https://github.com/evanshortiss/env-var/blob/master/CONTRIBUTING.md How to register the newly created accessor module within the `accessors` object in `lib/variable.js`. The naming convention should be 'asTypeSubtype'. ```JavaScript asNumberZero: generateAccessor(container, varName, defValue, require('./accessors/number-zero')), ``` -------------------------------- ### Parse Environment Variable as URL Object Source: https://github.com/evanshortiss/env-var/blob/master/API.md Verifies the environment variable is a valid URL string using the WHATWG URL constructor and returns the resulting URL instance. This is useful for working with URL components. ```APIDOC asUrlObject() Returns: URL (WHATWG URL instance) Throws: Exception if value is not a valid URL string. ``` -------------------------------- ### Return Environment Variable as String Source: https://github.com/evanshortiss/env-var/blob/master/API.md Returns the environment variable value as a string. Throws an exception if the value is not a string, though this is highly unlikely for `process.env` entries. ```APIDOC asString() Returns: string Throws: Exception if value is not a string (rare for process.env). ``` -------------------------------- ### Validate Environment Variable as URL String Source: https://github.com/evanshortiss/env-var/blob/master/API.md Verifies the environment variable is a valid URL string using the WHATWG URL constructor and returns the validated string. Note that URLs without paths will have a default '/' appended. ```APIDOC asUrlString() Returns: string (validated URL string) Throws: Exception if value is not a valid URL string. ``` -------------------------------- ### env-var.accessors Property API Reference Source: https://github.com/evanshortiss/env-var/blob/master/API.md Documentation for the `env.accessors` property, which provides direct access to the parsing and validation functions used internally by the `env-var` library. These functions accept a string value directly, useful for custom accessor implementations. ```APIDOC env.accessors: Object Description: Exposes built-in accessors for direct parsing and validation of values. Usage: env.accessors.asX(value: String, ...args) Available Accessors (similar to env.get().asX()): - asString(value: String): String - asInt(value: String): Number | undefined - asFloat(value: String): Number | undefined - asBool(value: String): Boolean - asJson(value: String): Object | undefined - asArray(value: String, delimiter?: String): Array | undefined - asEnum(value: String, allowedValues: Array): String ``` -------------------------------- ### Parse Environment Variable as Regular Expression Source: https://github.com/evanshortiss/env-var/blob/master/API.md Reads the environment variable value and constructs a `RegExp` instance. An optional `flags` argument can be provided to the `RegExp` constructor. ```APIDOC asRegExp(flags: string = '') flags: Optional string of flags to pass to the RegExp constructor (e.g., 'g', 'i', 'm'). Returns: RegExp ``` -------------------------------- ### Parse Environment Variable as Negative Integer Source: https://github.com/evanshortiss/env-var/blob/master/API.md Parses the environment variable as an integer and verifies that the number is negative (less than or equal to zero). Throws an exception if parsing fails or the number is positive. ```APIDOC asIntNegative() Returns: number (negative integer) Throws: Exception if parsing fails or the number is greater than zero. ``` -------------------------------- ### Parse Environment Variable as Positive Integer Source: https://github.com/evanshortiss/env-var/blob/master/API.md Parses the environment variable as an integer and verifies that the number is positive (greater than or equal to zero). Throws an exception if parsing fails or the number is negative. ```APIDOC asIntPositive() Returns: number (positive integer) Throws: Exception if parsing fails or the number is less than zero. ``` -------------------------------- ### Enabling Built-in Logging for env-var Source: https://github.com/evanshortiss/env-var/blob/master/README.md Shows how to enable the built-in logger for env-var by passing the logger object to the from function. The built-in logger prints logs only when NODE_ENV is not set to prod or production. ```javascript const { from, logger } = require('env-var') const env = from(process.env, {}, logger) const API_KEY = env.get('API_KEY').required().asString() ``` -------------------------------- ### Parse Environment Variable as Float Source: https://github.com/evanshortiss/env-var/blob/master/API.md Attempts to parse the environment variable value into a floating-point number. Throws an exception if parsing fails. ```APIDOC asFloat() Returns: number (float) Throws: Exception if parsing fails. ``` -------------------------------- ### Parse Environment Variable as Negative Float Source: https://github.com/evanshortiss/env-var/blob/master/API.md Parses the environment variable as a float and verifies that the number is negative (less than or equal to zero). Throws an exception if parsing fails or the number is positive. ```APIDOC asFloatNegative() Returns: number (negative float) Throws: Exception if parsing fails or the number is greater than zero. ``` -------------------------------- ### Parse Environment Variable as Positive Float Source: https://github.com/evanshortiss/env-var/blob/master/API.md Parses the environment variable as a float and verifies that the number is positive (greater than or equal to zero). Throws an exception if parsing fails or the number is negative. ```APIDOC asFloatPositive() Returns: number (positive float) Throws: Exception if parsing fails or the number is less than zero. ``` -------------------------------- ### Set Default Value for Environment Variable Source: https://github.com/evanshortiss/env-var/blob/master/API.md The `default()` method provides a fallback value for an environment variable if it is not set in `process.env`. This ensures a value is always available, preventing errors from unset variables. ```js const env = require('env-var') // Use POOL_SIZE if set, else use a value of 10 const POOL_SIZE = env.get('POOL_SIZE').default('10').asIntPositive() ``` ```APIDOC variable.default(defaultValue: string): variable defaultValue: The string value to use if the environment variable is not set. Returns: The 'variable' object for chaining. ``` -------------------------------- ### Parse Environment Variable as Integer (Strict) Source: https://github.com/evanshortiss/env-var/blob/master/API.md Attempts to parse the environment variable value into an integer. This is a strict check; it throws an exception if the value is not a whole number (e.g., '1.2' will fail). ```APIDOC asInt() Returns: number (integer) Throws: Exception if parsing fails or the value is not a strict integer. ``` -------------------------------- ### Parse Environment Variable as JSON Array Source: https://github.com/evanshortiss/env-var/blob/master/API.md Attempts to parse the environment variable value into a JSON Array. Throws an exception if the value is not a valid JSON Array. ```APIDOC asJsonArray() Returns: array (parsed JSON array) Throws: Exception if parsing fails or value is not a valid JSON Array. ``` -------------------------------- ### Parse Environment Variable as JSON Object Source: https://github.com/evanshortiss/env-var/blob/master/API.md Attempts to parse the environment variable value into a JSON Object. Throws an exception if the value is not a valid JSON Object. ```APIDOC asJsonObject() Returns: object (parsed JSON object) Throws: Exception if parsing fails or value is not a valid JSON Object. ``` -------------------------------- ### Accessing and Parsing Environment Variables with env-var Source: https://github.com/evanshortiss/env-var/blob/master/API.md This snippet illustrates how to use the `env-var` library to retrieve and cast environment variables to specific types such as strings, integers, booleans, JSON objects, and arrays. It also shows how to apply validation like `required()` and default values. ```javascript const env = require('env-var'); // Normally these would be set using "export VARNAME" or similar in bash process.env.STRING = 'test'; process.env.INTEGER = '12'; process.env.BOOL = 'false'; process.env.JSON = '{"key":"value"}'; process.env.COMMA_ARRAY = '1,2,3'; process.env.DASH_ARRAY = '1-2-3'; // The entire process.env object const allVars = env.get(); // Returns a string. Throws an exception if not set or empty const stringVar = env.get('STRING').required().asString(); // Returns an int, undefined if not set, or throws if set to a non integer value const intVar = env.get('INTEGER').asInt(); // Return a float, or 23.2 if not set const floatVar = env.get('FLOAT').default('23.2').asFloat(); // Return a Boolean. Throws an exception if not set or parsing fails const boolVar = env.get('BOOL').required().asBool(); // Returns a JSON Object, undefined if not set, or throws if set to invalid JSON const jsonVar = env.get('JSON').asJson(); // Returns an array if defined, or undefined if not set const commaArray = env.get('COMMA_ARRAY').asArray(); // Returns an array if defined, or undefined if not set const commaArray = env.get('DASH_ARRAY').asArray('-'); // Returns the enum value if it's one of dev, test, or live const enumVal = env.get('ENVIRONMENT').asEnum(['dev', 'test', 'live']) ``` -------------------------------- ### Validate Environment Variable as Email Address Source: https://github.com/evanshortiss/env-var/blob/master/API.md Reads the environment variable and validates it as a valid email address string. Throws an exception if the value is not a valid email format. ```APIDOC asEmailString() Returns: string (validated email address) Throws: Exception if value is not a valid email address. ``` -------------------------------- ### Parse Environment Variable as Boolean (Lenient) Source: https://github.com/evanshortiss/env-var/blob/master/API.md Attempts to parse the environment variable value into a Boolean. Accepts 'true', 'false' (case-insensitive), 0, or 1. Throws an exception on parsing failure. ```APIDOC asBool() Returns: boolean Throws: Exception if parsing fails or value is not 'true', 'false', 0, or 1. ``` -------------------------------- ### Parse Environment Variable as Boolean (Strict) Source: https://github.com/evanshortiss/env-var/blob/master/API.md Attempts to parse the environment variable value into a Boolean. Only accepts 'true' or 'false' (case-insensitive). Throws an exception on parsing failure. ```APIDOC asBoolStrict() Returns: boolean Throws: Exception if parsing fails or value is not 'true' or 'false'. ``` -------------------------------- ### Mark Environment Variable as Required Source: https://github.com/evanshortiss/env-var/blob/master/API.md The `required()` method ensures that an environment variable is set and not empty. If the variable is missing or empty, an `EnvVarError` is thrown upon value access. The check can be conditionally bypassed by passing `false`. ```js const env = require('env-var') // Get the value of NODE_ENV as a string. Could be undefined since we're // not calling required() before asString() const NODE_ENV = env.get('NODE_ENV').asString() // Read PORT variable and ensure it's in a valid port range. If it's not in // valid port ranges, not set, or empty an EnvVarError will be thrown const PORT = env.get('PORT').required().asPortNumber() // If mode is production then this is required const SECRET = env.get('SECRET').required(NODE_ENV === 'production').asString() ``` ```APIDOC variable.required(isRequired?: boolean = true): variable isRequired: Optional. A boolean indicating whether the variable is required (defaults to true). Returns: The 'variable' object for chaining. Throws: EnvVarError if the variable is required but not set or empty. ``` -------------------------------- ### Parse Environment Variable as JSON Object or Array Source: https://github.com/evanshortiss/env-var/blob/master/API.md Attempts to parse the environment variable value into a JSON Object or Array. Throws an exception if the value is not valid JSON. ```APIDOC asJson() Returns: object | array (parsed JSON) Throws: Exception if parsing fails or value is not valid JSON. ``` -------------------------------- ### Parse Environment Variable as Array Source: https://github.com/evanshortiss/env-var/blob/master/API.md Reads an environment variable as a string and splits it into an array based on a specified delimiter, defaulting to a comma. Useful for handling comma-separated lists. ```APIDOC asArray(delimiter: string = ',') delimiter: The string used to split the environment variable value. Defaults to ','. Returns: string[] Example Outputs: - Reading MY_ARRAY='' results in [] - Reading MY_ARRAY='1' results in ['1'] - Reading MY_ARRAY='1,2,3' results in ['1', '2', '3'] ``` -------------------------------- ### Validate Environment Variable Against Enum List Source: https://github.com/evanshortiss/env-var/blob/master/API.md Converts the environment variable value to a string and checks if it matches any of the provided valid values. Raises an error if the value is not found in the list. ```APIDOC asEnum(validValues: string[]) validValues: An array of strings representing the allowed values for the environment variable. Returns: string (the validated value) Throws: Error if the value is not in validValues. ``` -------------------------------- ### Accessing Environment Variables in Node.js (TypeScript) Source: https://github.com/evanshortiss/env-var/blob/master/README.md Illustrates how to retrieve and validate environment variables in a Node.js TypeScript application. It shows how to ensure a variable is set and is a positive integer, throwing an EnvVarError on validation failure. ```typescript import * as env from 'env-var'; // Read a PORT environment variable and ensure it's a positive integer. // An EnvVarError will be thrown if the variable is not set, or if it // is not a positive integer. const PORT: number = env.get('PORT').required().asIntPositive(); ``` -------------------------------- ### Parse Environment Variable as Port Number Source: https://github.com/evanshortiss/env-var/blob/master/API.md Converts the environment variable value to an integer and verifies it falls within the valid port range of 0-65535. Well-known ports are considered valid. ```APIDOC asPortNumber() Returns: number (integer, 0-65535) Throws: Exception if parsing fails or the number is outside the valid port range. ``` -------------------------------- ### Handle Custom EnvVarError Class Source: https://github.com/evanshortiss/env-var/blob/master/API.md This is the custom error class used by the `env-var` module. It allows for specific error handling when environment variable operations fail, distinguishing them from other application errors. ```javascript const env = require('env-var') let value = null try { // will throw if you have not set this variable value = env.get('MISSING_VARIABLE').required().asString() // if catch error is set, we'll end up throwing here instead throw new Error('some other error') } catch (e) { if (e instanceof env.EnvVarError) { console.log('we got an env-var error', e) } else { console.log('we got some error that wasn\'t an env-var error', e) } } ``` -------------------------------- ### Decode Base64 Environment Variable in Node.js Source: https://github.com/evanshortiss/env-var/blob/master/API.md This function decodes a base64 encoded environment variable to a UTF8 string. It's useful for securely storing sensitive information like passwords in environment variables. ```javascript console.log(process.env.DB_PASSWORD) // prints "c2VjcmV0X3Bhc3N3b3Jk" // dbpass will contain the converted value of "secret_password" const dbpass = env.get('DB_PASSWORD').convertFromBase64().asString() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.