Back to APIs list

Github API examples & templates

Use these vals as a playground to view and fork Github API examples and templates on Val Town. Run any example below or find templates that can be used as a pre-built solution.
case avatar
case
market_kelly_bet
HTTP
// Copied from https://github.com/Will-Howard/manifolio/blob/master/manifolio-ui/lib/calculate.ts
0
easrng avatar
easrng
denoMediaTypes
Script
/// Definition files don't have separate content types and so we have to "guess"
0
tmcw avatar
tmcw
typeboxExample
Script
This val demonstrates how TypeBox objects are interchangeable with JSON Schema objects - if you run JSON.stringify() on one of them, you immediately get a JSON Schema validator. They do, in memory, have additional methods and information, but their easy conversion to JSON Schema objects is a major win.
0
webup avatar
webup
loaderSampleAudioChinese
Script
Forked from webup/loaderSampleAudio
0
stevekrouse avatar
stevekrouse
notionGetDatabase
Script
Get all the pages in a notion database Usage Find your databaseId : https://developers.notion.com/reference/retrieve-a-database Get auth by setting up an internal integration: https://developers.notion.com/docs/authorization#internal-integration-auth-flow-set-up Example usage: @stevekrouse.dateMeNotionDatabase deno-notion-sdk docs: https://github.com/cloudydeno/deno-notion_sdk
4
std avatar
std
sqlite2
Script
Forked from std/sqlite
0
curtcox avatar
curtcox
EmailCommand
Script
An interactive, runnable TypeScript val by curtcox
0
postpostscript avatar
postpostscript
reduceAsync
Script
// reference: https://github.com/microsoft/TypeScript/blob/main/src/lib/es5.d.ts#L1272
0
postpostscript avatar
postpostscript
sqliteBuilderTyped
Script
Example
1
pomdtr avatar
pomdtr
open_in_fullscreen
Script
This val is supposed to be used with the val.town extension. See the extension readme for installation instructions.
0
pomdtr avatar
pomdtr
sms
HTTP
Send/receive sms from val.town Test sending/receiving sms from SMSHub
0
sammeltassen avatar
sammeltassen
allmaps
HTTP
Random Maps API This val returns one or more random rows from a SQLite database as a JSON array. Each item represents a digitised map from a collection and contains the following properties: { // SQLite identifier "id": 70607, // Slug for the organisation "organizationId": "lmec", // Title of the map "title": "A topographical map of the northn. part of New York Island, exhibiting the plan of Fort Washington, now Fort Knyphausen, with the rebels lines to the southward, which were forced by the troops under the command of the Rt. Honble. Earl Percy, on the 16th Novr. 1776, and survey'd immediately after by order of his Lordship", // IIIF Presentation Manifest URL "manifestId": "https://collections.leventhalmap.org/search/commonwealth:9s161881v/manifest", // IIIF Image URL (first image in the manifest) "imageId": "https://iiif.digitalcommonwealth.org/iiif/2/commonwealth:9s1618824" } The val returns a single map by default. You can change this with the following parameters: count=100 Request a specific number of maps (max 1000) org=lmec Request maps from a specific institution For example: https://sammeltassen-allmaps.web.val.run/?count=100&org=lmec The val is used to offer maps to new users of Allmaps Editor . The scrapers used to gather the source data can be found here .
0
johndturn avatar
johndturn
quotableApiProxy
HTTP
Quotable API Proxy Small HTTP proxy to the Quotable API ( https://api.quotable.io ). I built this due to some DNSSEC issues that the Quotable API is currently experiencing. See this Github issue here for more information.
0
singpolyma avatar
singpolyma
sendxmpplib
Script
Simple helper for sending a message over XMPP. For an API that doesn't require your own bot setup see https://www.val.town/v/singpolyma/sendxmpp import sendxmpp from "https://esm.town/v/singpolyma/sendxmpplib"; await sendxmpp("someone@example.com", "Hello!"); Also supports optional keepalive to send multiple messages with one connection: import sendxmpp from "https://esm.town/v/singpolyma/sendxmpplib"; await sendxmpp("someone@example.com", "1", true); await sendxmpp("someone@example.com", "2", true); await sendxmpp("someone@example.com", "3); Or even manual disconnect: import sendxmpp from "https://esm.town/v/singpolyma/sendxmpplib"; await sendxmpp("someone@example.com", "1", true); await sendxmpp("someone@example.com", "2", true); const stop = sendxmpp("someone@example.com", "3", true); stop(); Environment variables needed for your bot: XMPP_URI=wss://example.com XMPP_DOMAIN=example.com XMPP_USERNAME=bot XMPP_PASSWORD=password Only websockets or direct tls (xmpps://) connections are supported until https://github.com/denoland/deno/issues/26685 is fixed
0
pomdtr avatar
pomdtr
search_user_vals
Script
This val is supposed to be used with the val.town extension. See the extension readme for installation instructions.
0
midnightlightning avatar
midnightlightning
uniswapV3Position
HTTP
An endpoint to calculate additional metadata for a Uniswap v3 liquidity position. In order to keep on-chain fees low, the Uniswap cryptocurrency exchange balances how much data it writes to the blockchain when users take out a liquidity position. Properties are saved in a few different contracts and so knowing exactly what a liquidity position entails takes a bit of additional calculation. This endpoint takes in a token identifier that represents a liquidity position, and follows the math to make the values more human-friendly. This script uses the bignumber.js library to do higher-precision floating-point math than JavaScript can do on its own with number variables. Usage Find the token ID of the Uniswap position you wish to get details about. If you own the liquidity position, you can head to https://app.uniswap.org/pool and click on the v3 position. The ID of that position will be in the URL of the details page. Append the token ID to the end of this val's URL to fetch data about it (e.g. to get information about token ID 12345 , fetch the url https://midnightlightning-uniswapv3position.web.val.run/12345 ) Reference This val fetches blockchain data from the following smart contracts: NonfungiblePositionManager( 0xc36442b4a4522e871399cd717abdd847ab11fe88 ) Manages the liquidity position tokens as an ERC721 contract. The positions function is used to determine what tokens and tick ranges the individual liquidity position has. UniswapV3Factory ( 0x1F98431c8aD98523631AE4a59f267346ea31F984 ) Contract that manages liquidity pools, and acts as a registry to record where each pairing is deployed to. The getPool function is used to find where the smart contract for a specific pairing of ERC20 tokens is deployed to. ERC20 tokens Each position has two tokens it's balancing between, and each token has its own instance of an ERC20 contract deployed to the blockchain. The name and symbol functions are used to determine how to describe each token, and the decimals function to determine how to scale the price value for the ratio between them. UniswapV3Pool Contract that handles swaps between specific pairs of tokens. The slot0 function is used to fetch the current price the two tokens are swapping at.
0