2type PR = Parameters<typeof Octokit["rest"]["pulls"]["create"]>;
3
4export async function submitPR(ghToken: string, ...pr: PR) {
5 return new Octokit({ auth: ghToken }).rest.pulls.create(pr);
6}
1import { Octokit } from "npm:@octokit/rest";
2
3export async function githubRestClient(ghToken: string | undefined) {
4 return new Octokit({ auth: ghToken || Deno.env.get("GITHUB_TOKEN") }).rest;
5}
1# githubRestClient
2
3Does what it says! Defaults to using `GITHUB_TOKEN` env var if none is passed to the function.
4
22import { getRedirectUrl } from "https://esm.town/v/postpostscript/moduleHighlightValueLink";
23
24export default async function(req: Request): Promise<Response> {
25 return htmlResponse`
26 <iframe src="${getRedirectUrl(import.meta.url, "default", true)}" width="100%" height="100%">
2 [key: string]: string;
3};
4export async function parseCalendarEventsTable(html: string): Promise<TableRow[]> {
5 const { DOMParser } = await import(
6 "https://deno.land/x/deno_dom/deno-dom-wasm.ts"
20## Parameters
21
22The function takes two parameters: your gh access token and an object that's identical to the object submitted to the gh API. See [GH's documentation](https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#create-a-pull-request) for more info!
23
24
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export function alias<P extends Params>(params: P): Promise<Result<P>> {
4 const username = params.username;
5 let url = `https://api.val.town/v1/alias/${username}`;
35
36export const hydrate = (importMetaURL: string) =>
37 async function(req: Request): Promise<Response> {
38 const { author, name } = extractValInfo(importMetaURL);
39 const valURL = `https://www.val.town/v/${author}/${name}`;
30import { html, htmlResponse } from "https://esm.town/v/postpostscript/html";
31
32export default function(req: Request) {
33 return htmlResponse`
34 Request URL: ${decodeURIComponent(req.url)}
8
9```ts
10export default function() {
11 <h1>Hello World!</h1>
12}
15Optionally, you can define an handler next to your component, allowing you to handle query params or form inputs.
16
17Use the `ctx.render` function to pass props to your component.
18
19```ts
24};
25
26export default function(props: {name?: string}) {
27 <h1>Hello { name || "World }!</h1>
28}
Simple functional CSS library for Val Town
A helper function to build a file's email
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.