From 53d4eded44690f04a40287f166861dd7ed9f5749 Mon Sep 17 00:00:00 2001 From: tmcw Date: Tue, 25 Feb 2025 19:04:19 +0000 Subject: [PATCH] Auto-updates from Stainless --- public/openapi.documented.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/openapi.documented.json b/public/openapi.documented.json index 4e4fede..d2bfb6c 100644 --- a/public/openapi.documented.json +++ b/public/openapi.documented.json @@ -1 +1 @@ -{"openapi":"3.1.0","info":{"title":"Val Town API","description":"Val Town’s public API\n\nOpenAPI JSON endpoint:\n\nhttps://api.val.town/openapi.json","termsOfService":"https://www.val.town/termsofuse","version":"1"},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Endpoints that support authorization expect Bearer authentication, using an API token provided from Val Town."}},"schemas":{"User":{"description":"User object","type":"object","properties":{"id":{"format":"uuid","description":"The ID of this user","type":"string"},"bio":{"anyOf":[{"description":"The user’s biography, if they have provided one","type":"string"},{"type":"null"}]},"username":{"anyOf":[{"description":"The user’s handle that they chose for themselves. Does not include the @ symbol","type":"string"},{"type":"null"}]},"profileImageUrl":{"anyOf":[{"description":"URL that points to the user’s profile image, if one exists","format":"uri","type":"string"},{"type":"null"}]},"url":{"format":"uri","description":"URL of this user’s profile on Val Town’s website","type":"string"},"links":{"type":"object","properties":{"self":{"format":"uri","description":"URL of this user on this API","type":"string"}},"required":["self"]}},"required":["id","bio","username","profileImageUrl","url","links"],"example":{"id":"00000000-0000-0000-0000-000000000000","bio":"Hello world","username":"tmcw","url":"https://val.town/u/tmcw","profileImageUrl":null}},"ResultSet":{"title":"ResultSet","description":"Result of executing an SQL statement.","type":"object","properties":{"columns":{"description":"Names of columns.\n\nNames of columns can be defined using the `AS` keyword in SQL:\n\n```sql\nSELECT author AS author, COUNT(*) AS count FROM books GROUP BY author\n```","type":"array","items":{"type":"string"}},"columnTypes":{"description":"Types of columns.\n\nThe types are currently shown for types declared in a SQL table. For column types of function calls, for example, an empty string is returned.","type":"array","items":{"type":"string"}},"rows":{"description":"Rows produced by the statement.","type":"array","items":{"title":"TursoRow","type":"array","items":{"description":"Columns can be accessed like an object by column names."}}},"rowsAffected":{"description":"Number of rows that were affected by an UPDATE, INSERT or DELETE operation.\n\nThis value is not specified for other SQL statements.","type":"number"},"lastInsertRowid":{"description":"ROWID of the last inserted row.\n\nThis value is not specified if the SQL statement was not an INSERT or if the table was not a ROWID table.","anyOf":[{"type":"string"},{"type":"number"},{"type":"null"}]}},"required":["columns","columnTypes","rows","rowsAffected"]},"ExtendedVal":{"description":"A Val","type":"object","properties":{"name":{"description":"The name of this val","type":"string"},"id":{"format":"uuid","description":"This val's id","type":"string"},"version":{"minimum":0,"description":"The version of this val, starting at zero","type":"integer"},"code":{"anyOf":[{"description":"TypeScript code associated with this val","type":"string"},{"type":"null"}]},"public":{"description":"Whether this val is available publicly on Val Town","type":"boolean"},"createdAt":{"format":"date-time","type":"string"},"privacy":{"type":"string","enum":["public","unlisted","private"],"description":"This resource's privacy setting. Unlisted resources do not appear on profile pages or elsewhere, but you can link to them."},"type":{"type":"string","enum":["interval","http","express","email","script","rpc","httpnext"],"description":"The type of a val. HTTP can receive web requests, Email can receive emails, Cron runs periodically, and Script can be used for libraries or one-off calculations"},"url":{"format":"uri","description":"The URL of this resource on the Val Town website","type":"string"},"links":{"type":"object","properties":{"self":{"format":"uri","description":"The URL of this val on this API","type":"string"},"versions":{"format":"uri","description":"The endpoint to retrieve this val's versions","type":"string"},"module":{"format":"uri","description":"The URL of this Val's source code as a module","type":"string"},"endpoint":{"format":"uri","description":"This val's web endpoint, where it serves a website or API","type":"string"}},"required":["self","versions","module"]},"author":{"anyOf":[{"description":"The user who created this val","type":"object","properties":{"id":{"format":"uuid","type":"string"},"username":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","username"]},{"type":"null"}]},"versionCreatedAt":{"format":"date-time","type":"string"},"likeCount":{"minimum":0,"description":"How many likes this val has received","type":"integer"},"referenceCount":{"minimum":0,"descriptions":"How many other public vals have imported this one","type":"integer"},"readme":{"anyOf":[{"description":"This val's readme, as Markdown","type":"string"},{"type":"null"}]}},"required":["name","id","version","code","public","createdAt","privacy","type","url","links","author","likeCount","referenceCount","readme"]},"BasicVal":{"description":"A Val","type":"object","properties":{"name":{"description":"The name of this val","type":"string"},"id":{"format":"uuid","description":"This val's id","type":"string"},"version":{"minimum":0,"description":"The version of this val, starting at zero","type":"integer"},"code":{"anyOf":[{"description":"TypeScript code associated with this val","type":"string"},{"type":"null"}]},"public":{"description":"Whether this val is available publicly on Val Town","type":"boolean"},"createdAt":{"format":"date-time","type":"string"},"privacy":{"type":"string","enum":["public","unlisted","private"],"description":"This resource's privacy setting. Unlisted resources do not appear on profile pages or elsewhere, but you can link to them."},"type":{"type":"string","enum":["interval","http","express","email","script","rpc","httpnext"],"description":"The type of a val. HTTP can receive web requests, Email can receive emails, Cron runs periodically, and Script can be used for libraries or one-off calculations"},"url":{"format":"uri","description":"The URL of this resource on the Val Town website","type":"string"},"links":{"type":"object","properties":{"self":{"format":"uri","description":"The URL of this val on this API","type":"string"},"versions":{"format":"uri","description":"The endpoint to retrieve this val's versions","type":"string"},"module":{"format":"uri","description":"The URL of this Val's source code as a module","type":"string"},"endpoint":{"format":"uri","description":"This val's web endpoint, where it serves a website or API","type":"string"}},"required":["self","versions","module"]},"author":{"anyOf":[{"description":"The user who created this val","type":"object","properties":{"id":{"format":"uuid","type":"string"},"username":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","username"]},{"type":"null"}]}},"required":["name","id","version","code","public","createdAt","privacy","type","url","links","author"],"example":{"version":0,"name":"counter","code":"export const count = 1;","createdAt":"2024-06-11T22:05:12.585Z","public":true,"id":"00000000-0000-0000-0000-000000000000","privacy":"public","type":"script","url":"https://val.town/v/tmcw/counter","author":{"id":"00000000-0000-0000-0000-000000000000","username":"tmcw"}}},"PaginationLinks":{"description":"Links to use for pagination","type":"object","properties":{"self":{"format":"uri","description":"URL of this page","type":"string"},"prev":{"format":"uri","description":"URL of the previous page, if any","type":"string"},"next":{"format":"uri","description":"URL of the next page, if any","type":"string"}},"required":["self"]},"Project":{"description":"A Project","type":"object","properties":{"name":{"type":"string"},"id":{"format":"uuid","description":"The id of the project","type":"string"},"createdAt":{"format":"date-time","type":"string"},"privacy":{"type":"string","enum":["public","unlisted","private"],"description":"This resource's privacy setting. Unlisted resources do not appear on profile pages or elsewhere, but you can link to them."},"author":{"type":"object","properties":{"id":{"format":"uuid","type":"string"},"username":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","username"]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"imageUrl":{"anyOf":[{"description":"The URL of this project's image","type":"string"},{"type":"null"}]},"links":{"type":"object","properties":{"self":{"format":"uri","description":"The URL of this resource on this API","type":"string"},"html":{"format":"uri","description":"The URL of this resource on Val Town","type":"string"}},"required":["self","html"]}},"required":["name","id","createdAt","privacy","author","description","imageUrl","links"]},"Branch":{"description":"A Branch","type":"object","properties":{"name":{"type":"string"},"id":{"format":"uuid","description":"The id of the branch","type":"string"},"version":{"minimum":0,"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"updatedAt":{"format":"date-time","type":"string"},"forkedBranchId":{"anyOf":[{"description":"The id of the branch this branch was forked from","type":"string"},{"type":"null"}]},"links":{"type":"object","properties":{"self":{"format":"uri","description":"The URL of this resource on this API","type":"string"},"html":{"format":"uri","description":"The URL of this resource on Val Town","type":"string"}},"required":["self","html"]}},"required":["name","id","version","createdAt","updatedAt","forkedBranchId","links"]},"FileRevisionMetadata":{"description":"A File or Directory's Metadata","type":"object","properties":{"name":{"type":"string"},"id":{"format":"uuid","description":"The id of the resource","type":"string"},"path":{"type":"string"},"version":{"minimum":0,"type":"integer"},"updatedAt":{"format":"date-time","type":"string"},"type":{"type":"string","enum":["directory","file","interval","http","email","script"]},"links":{"type":"object","properties":{"self":{"format":"uri","description":"The URL of this resource on this API","type":"string"},"html":{"format":"uri","description":"The URL of this resource on Val Town","type":"string"},"module":{"format":"uri","description":"The URL of this resource's source code as a module","type":"string"},"endpoint":{"format":"uri","description":"This resource's web endpoint, where it serves a website or API","type":"string"}},"required":["self","html","module"]}},"required":["name","id","path","version","updatedAt","type","links"]}}},"paths":{"/v1/search/vals":{"get":{"operationId":"searchVals","tags":["search"],"description":"Search for vals across the platform","parameters":[{"schema":{"minimum":0,"default":0,"type":"integer"},"in":"query","name":"offset","required":true,"description":"Number of items to skip in order to deliver paginated results"},{"schema":{"minimum":1,"maximum":100,"default":20,"type":"integer"},"in":"query","name":"limit","required":true,"description":"Maximum items to return in each paginated response"},{"schema":{"minLength":1,"maxLength":256,"type":"string"},"in":"query","name":"query","required":true,"description":"Search query"}],"responses":{"200":{"description":"A paginated result set","content":{"application/json":{"schema":{"description":"A paginated result set","type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BasicVal"}},"links":{"$ref":"#/components/schemas/PaginationLinks"}},"required":["data","links"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const basicVal of client.search.vals.list({ limit: 1, offset: 0, query: 'x' })) {\n console.log(basicVal.id);\n }\n}\n\nmain();"}]}},"/v1/alias/{username}":{"get":{"operationId":"aliasUsername","tags":["alias"],"description":"Get basic details about a user, given their username","parameters":[{"schema":{"type":"string"},"in":"path","name":"username","required":true,"description":"Username of the user who you are looking for"}],"responses":{"200":{"description":"User object","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const user = await client.alias.username.retrieve('username');\n\n console.log(user.id);\n}\n\nmain();"}]}},"/v1/alias/{username}/{val_name}":{"get":{"operationId":"aliasVal","tags":["alias"],"description":"Get a val","parameters":[{"schema":{"type":"string"},"in":"path","name":"username","required":true,"description":"Username of the user whose val you are looking for"},{"schema":{"type":"string"},"in":"path","name":"val_name","required":true,"description":"Name of the val you’re looking for"}],"responses":{"200":{"description":"A Val","content":{"application/json":{"schema":{"description":"A Val","type":"object","properties":{"name":{"description":"The name of this val","type":"string"},"id":{"format":"uuid","description":"This val's id","type":"string"},"version":{"minimum":0,"description":"The version of this val, starting at zero","type":"integer"},"code":{"anyOf":[{"description":"TypeScript code associated with this val","type":"string"},{"type":"null"}]},"public":{"description":"Whether this val is available publicly on Val Town","type":"boolean"},"createdAt":{"format":"date-time","type":"string"},"privacy":{"type":"string","enum":["public","unlisted","private"],"description":"This resource's privacy setting. Unlisted resources do not appear on profile pages or elsewhere, but you can link to them."},"type":{"type":"string","enum":["interval","http","express","email","script","rpc","httpnext"],"description":"The type of a val. HTTP can receive web requests, Email can receive emails, Cron runs periodically, and Script can be used for libraries or one-off calculations"},"url":{"format":"uri","description":"The URL of this resource on the Val Town website","type":"string"},"links":{"type":"object","properties":{"self":{"format":"uri","description":"The URL of this val on this API","type":"string"},"versions":{"format":"uri","description":"The endpoint to retrieve this val's versions","type":"string"},"module":{"format":"uri","description":"The URL of this Val's source code as a module","type":"string"},"endpoint":{"format":"uri","description":"This val's web endpoint, where it serves a website or API","type":"string"}},"required":["self","versions","module"]},"author":{"anyOf":[{"description":"The user who created this val","type":"object","properties":{"id":{"format":"uuid","type":"string"},"username":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","username"]},{"type":"null"}]},"versionCreatedAt":{"format":"date-time","type":"string"},"likeCount":{"minimum":0,"description":"How many likes this val has received","type":"integer"},"referenceCount":{"minimum":0,"descriptions":"How many other public vals have imported this one","type":"integer"},"readme":{"anyOf":[{"description":"This val's readme, as Markdown","type":"string"},{"type":"null"}]}},"required":["name","id","version","code","public","createdAt","privacy","type","url","links","author","likeCount","referenceCount","readme"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const valName = await client.alias.username.valName.retrieve('username', 'val_name');\n\n console.log(valName.id);\n}\n\nmain();"}]}},"/v1/alias/projects/{username}/{project_name}":{"get":{"operationId":"aliasProject","tags":["alias"],"description":"Get a project","parameters":[{"schema":{"type":"string"},"in":"path","name":"username","required":true,"description":"Username of the user whose project you are looking for"},{"schema":{"type":"string"},"in":"path","name":"project_name","required":true,"description":"Name of the project you’re looking for"}],"responses":{"200":{"description":"A Project","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Project"}}}}}}},"/v1/me":{"get":{"operationId":"meGet","tags":["me"],"description":"Get profile information for the current user","responses":{"200":{"description":"Your user information, with tier and email included","content":{"application/json":{"schema":{"description":"Your user information, with tier and email included","type":"object","properties":{"id":{"format":"uuid","description":"The ID of this user","type":"string"},"bio":{"anyOf":[{"description":"The user’s biography, if they have provided one","type":"string"},{"type":"null"}]},"username":{"anyOf":[{"description":"The user’s handle that they chose for themselves. Does not include the @ symbol","type":"string"},{"type":"null"}]},"profileImageUrl":{"anyOf":[{"description":"URL that points to the user’s profile image, if one exists","format":"uri","type":"string"},{"type":"null"}]},"url":{"format":"uri","description":"URL of this user’s profile on Val Town’s website","type":"string"},"links":{"type":"object","properties":{"self":{"format":"uri","description":"URL of this user on this API","type":"string"}},"required":["self"]},"tier":{"anyOf":[{"type":"string","enum":["free","pro"],"description":"Your account tier"},{"type":"null"}]},"email":{"description":"Your email address","type":"string"}},"required":["id","bio","username","profileImageUrl","url","links","tier","email"]},"example":{"id":"00000000-0000-0000-0000-000000000000","bio":"Hello world","username":"tmcw","email":"example@example.com","profileImageUrl":null,"tier":"pro"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const profile = await client.me.profile.retrieve();\n\n console.log(profile.id);\n}\n\nmain();"}]}},"/v1/me/projects":{"get":{"operationId":"meProjects","tags":["me"],"description":"[BETA] List all of a user's projects for authenticated users","parameters":[{"schema":{"minimum":0,"default":0,"type":"integer"},"in":"query","name":"offset","required":true,"description":"Number of items to skip in order to deliver paginated results"},{"schema":{"minimum":1,"maximum":100,"default":20,"type":"integer"},"in":"query","name":"limit","required":true,"description":"Maximum items to return in each paginated response"}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"A paginated result set","content":{"application/json":{"schema":{"description":"A paginated result set","type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Project"}},"links":{"$ref":"#/components/schemas/PaginationLinks"}},"required":["data","links"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const projectListResponse of client.me.projects.list({ limit: 1, offset: 0 })) {\n console.log(projectListResponse.id);\n }\n}\n\nmain();"}]}},"/v1/me/likes":{"get":{"operationId":"meLikes","tags":["me"],"description":"Get vals liked by the current user","parameters":[{"schema":{"minimum":0,"default":0,"type":"integer"},"in":"query","name":"offset","required":true,"description":"Number of items to skip in order to deliver paginated results"},{"schema":{"minimum":1,"maximum":100,"default":20,"type":"integer"},"in":"query","name":"limit","required":true,"description":"Maximum items to return in each paginated response"}],"responses":{"200":{"description":"A paginated result set","content":{"application/json":{"schema":{"description":"A paginated result set","type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BasicVal"}},"links":{"$ref":"#/components/schemas/PaginationLinks"}},"required":["data","links"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const basicVal of client.me.likes.list({ limit: 1, offset: 0 })) {\n console.log(basicVal.id);\n }\n}\n\nmain();"}]}},"/v1/me/comments":{"get":{"operationId":"meComments","tags":["me"],"description":"Get comments related to current user, either given or received","parameters":[{"schema":{"minimum":0,"default":0,"type":"integer"},"in":"query","name":"offset","required":true,"description":"Number of items to skip in order to deliver paginated results"},{"schema":{"minimum":1,"maximum":100,"default":20,"type":"integer"},"in":"query","name":"limit","required":true,"description":"Maximum items to return in each paginated response"},{"schema":{"format":"date-time","type":"string"},"in":"query","name":"since","required":false,"description":"Include items created after this date"},{"schema":{"format":"date-time","type":"string"},"in":"query","name":"until","required":false,"description":"Include items created before this date"},{"schema":{"type":"string","enum":["any","received","given"],"default":"any"},"in":"query","name":"relationship","required":true,"description":"Whether to get comments you have received, given, or both"}],"responses":{"200":{"description":"A paginated result set","content":{"application/json":{"schema":{"description":"A paginated result set","type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"comment":{"description":"Text of the given comment, in Markdown","type":"string"},"id":{"format":"uuid","description":"The comment’s id","type":"string"},"createdAt":{"format":"date-time","type":"string"},"author":{"type":"object","properties":{"id":{"format":"uuid","type":"string"},"username":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","username"]},"val":{"type":"object","properties":{"name":{"description":"Name of the val that is being commented on","type":"string"},"id":{"format":"uuid","type":"string"},"version":{"minimum":0,"type":"integer"},"privacy":{"type":"string","enum":["public","unlisted","private"],"description":"This resource's privacy setting. Unlisted resources do not appear on profile pages or elsewhere, but you can link to them."},"author":{"anyOf":[{"description":"The user who created this val","type":"object","properties":{"id":{"format":"uuid","type":"string"},"username":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","username"]},{"type":"null"}]}},"required":["name","id","version","privacy","author"]}},"required":["comment","id","createdAt","author","val"]}},"links":{"$ref":"#/components/schemas/PaginationLinks"}},"required":["data","links"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const commentListResponse of client.me.comments.list({\n limit: 1,\n offset: 0,\n relationship: 'any',\n })) {\n console.log(commentListResponse.id);\n }\n}\n\nmain();"}]}},"/v1/me/references":{"get":{"operationId":"meReferences","tags":["me"],"description":"Get vals that depend on any of the user's vals","parameters":[{"schema":{"minimum":0,"default":0,"type":"integer"},"in":"query","name":"offset","required":true,"description":"Number of items to skip in order to deliver paginated results"},{"schema":{"minimum":1,"maximum":100,"default":20,"type":"integer"},"in":"query","name":"limit","required":true,"description":"Maximum items to return in each paginated response"},{"schema":{"format":"date-time","type":"string"},"in":"query","name":"since","required":false,"description":"Include items created after this date"},{"schema":{"format":"date-time","type":"string"},"in":"query","name":"until","required":false,"description":"Include items created before this date"}],"responses":{"200":{"description":"A paginated result set","content":{"application/json":{"schema":{"description":"A paginated result set","type":"object","properties":{"data":{"type":"array","items":{"description":"A description of a dependency from one val (reference) to another (dependsOn) that was introduced at a particular time.","type":"object","properties":{"reference":{"description":"A val in a dependency relationship","type":"object","properties":{"id":{"format":"uuid","description":"The id of this val","type":"string"},"username":{"anyOf":[{"description":"The username of the person who authored this val","type":"string"},{"type":"null"}]},"author_id":{"anyOf":[{"format":"uuid","description":"The ID of the person who authored this val","type":"string"},{"type":"null"}]},"name":{"description":"The name of this val","type":"string"}},"required":["id","username","author_id","name"]},"dependsOn":{"description":"A val in a dependency relationship","type":"object","properties":{"id":{"format":"uuid","description":"The id of this val","type":"string"},"username":{"anyOf":[{"description":"The username of the person who authored this val","type":"string"},{"type":"null"}]},"author_id":{"anyOf":[{"format":"uuid","description":"The ID of the person who authored this val","type":"string"},{"type":"null"}]},"name":{"description":"The name of this val","type":"string"}},"required":["id","username","author_id","name"]},"referencedAt":{"format":"date-time","type":"string"}},"required":["reference","dependsOn","referencedAt"]}},"links":{"$ref":"#/components/schemas/PaginationLinks"}},"required":["data","links"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const referenceListResponse of client.me.references.list({ limit: 1, offset: 0 })) {\n console.log(referenceListResponse.dependsOn);\n }\n}\n\nmain();"}]}},"/v1/blob":{"get":{"operationId":"blobsList","tags":["blobs"],"description":"List blobs in your account","parameters":[{"schema":{"type":"string"},"in":"query","name":"prefix","required":false,"description":"If specified, only include blobs that start with this string"}],"responses":{"200":{"description":"List of blobs that you’ve stored","content":{"application/json":{"schema":{"description":"List of blobs that you’ve stored","type":"array","items":{"title":"BlobListingItem","type":"object","properties":{"key":{"type":"string"},"size":{"description":"Size in bytes of the object","type":"integer"},"lastModified":{"description":"Creation date of the object","format":"date-time","type":"string"}},"required":["key"]}},"example":[{"key":"hello_world","size":20,"lastModified":"2024-06-24T20:00:59.702Z"}]}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const blobs = await client.blobs.list();\n\n console.log(blobs);\n}\n\nmain();"}]}},"/v1/blob/{key}":{"get":{"operationId":"blobsGet","tags":["blobs"],"description":"Get a blob’s contents.","parameters":[{"schema":{"minLength":1,"maxLength":512,"type":"string"},"in":"path","name":"key","required":true,"description":"Key that uniquely identifies this blob"}],"responses":{"200":{"description":"Binary contents of the returned file","content":{"application/octet-stream":{"schema":{"format":"binary","type":"string"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const blob = await client.blobs.get('x');\n\n console.log(blob);\n\n const content = await blob.blob();\n console.log(content);\n}\n\nmain();"}]},"post":{"operationId":"blobsStore","tags":["blobs"],"description":"Store data in blob storage","requestBody":{"content":{"application/json":{"schema":{"format":"binary","description":"Binary input data","type":"string"}}},"description":"Binary input data"},"parameters":[{"schema":{"minLength":1,"maxLength":512,"type":"string"},"in":"path","name":"key","required":true,"description":"Key that uniquely identifies this blob"}],"security":[{"bearerAuth":[]}],"responses":{"201":{"description":"Successfully stored as blob"}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n await client.blobs.store('x', fs.createReadStream('path/to/file'));\n}\n\nmain();"}]},"delete":{"operationId":"blobsDelete","tags":["blobs"],"description":"Delete a blob","parameters":[{"schema":{"minLength":1,"maxLength":512,"type":"string"},"in":"path","name":"key","required":true,"description":"Key that uniquely identifies this blob"}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Blob successfully deleted"}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n await client.blobs.delete('x');\n}\n\nmain();"}]}},"/v1/users/{user_id}":{"get":{"operationId":"usersGet","tags":["users"],"description":"Get basic information about a user","parameters":[{"schema":{"format":"uuid","type":"string"},"in":"path","name":"user_id","required":true,"description":"User Id"}],"responses":{"200":{"description":"User object","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const user = await client.users.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');\n\n console.log(user.id);\n}\n\nmain();"}]}},"/v1/users/{user_id}/vals":{"get":{"operationId":"usersVals","tags":["users"],"description":"List a user's vals","parameters":[{"schema":{"minimum":0,"default":0,"type":"integer"},"in":"query","name":"offset","required":true,"description":"Number of items to skip in order to deliver paginated results"},{"schema":{"minimum":1,"maximum":100,"default":20,"type":"integer"},"in":"query","name":"limit","required":true,"description":"Maximum items to return in each paginated response"},{"schema":{"format":"uuid","type":"string"},"in":"path","name":"user_id","required":true,"description":"User Id"}],"responses":{"200":{"description":"A paginated result set","content":{"application/json":{"schema":{"description":"A paginated result set","type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BasicVal"}},"links":{"$ref":"#/components/schemas/PaginationLinks"}},"required":["data","links"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const basicVal of client.users.vals.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {\n limit: 1,\n offset: 0,\n })) {\n console.log(basicVal.id);\n }\n}\n\nmain();"}]}},"/v1/sqlite/execute":{"post":{"operationId":"sqliteExecute","tags":["sqlite"],"description":"Execute a single SQLite statement and return results","requestBody":{"content":{"application/json":{"schema":{"description":"A single statement to run","type":"object","properties":{"statement":{"anyOf":[{"description":"Simple SQL statement to run in SQLite","type":"string"},{"title":"ParameterizedQuery","description":"A parameterized SQL query. See https://docs.turso.tech/sdk/ts/reference#batch-transactions for reference","type":"object","properties":{"sql":{"description":"SQL statement, with ? placeholders for arguments","type":"string"},"args":{"title":"StatementArg","description":"List of arguments to be used in the given statement","anyOf":[{"type":"array","items":{"title":"TursoValue","description":"A value to be used as a parameter"}},{"type":"object","additionalProperties":{"title":"TursoValue","description":"A value to be used as a parameter"}}]}},"required":["sql","args"]}]}},"required":["statement"]},"examples":{"example1":{"value":{"statement":"SELECT 1;"}},"example2":{"value":{"statement":{"sql":"SELECT * FROM table WHERE column = ?;","args":[1]}}}}}},"required":true,"description":"A single statement to run"},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Result of executing an SQL statement.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultSet"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const resultSet = await client.sqlite.execute({ statement: 'SELECT 1;' });\n\n console.log(resultSet.lastInsertRowid);\n}\n\nmain();"}]}},"/v1/sqlite/batch":{"post":{"operationId":"sqliteBatch","tags":["sqlite"],"description":"Execute a batch of SQLite statements and return results for all of them","requestBody":{"content":{"application/json":{"schema":{"description":"A set of statements to be run in a single batch","type":"object","properties":{"statements":{"type":"array","items":{"anyOf":[{"description":"Simple SQL statement to run in SQLite","type":"string"},{"title":"ParameterizedQuery","description":"A parameterized SQL query. See https://docs.turso.tech/sdk/ts/reference#batch-transactions for reference","type":"object","properties":{"sql":{"description":"SQL statement, with ? placeholders for arguments","type":"string"},"args":{"title":"StatementArg","description":"List of arguments to be used in the given statement","anyOf":[{"type":"array","items":{"title":"TursoValue","description":"A value to be used as a parameter"}},{"type":"object","additionalProperties":{"title":"TursoValue","description":"A value to be used as a parameter"}}]}},"required":["sql","args"]}]}},"mode":{"type":"string","enum":["write","read","deferred"]}},"required":["statements"]},"example":{"statements":["SELECT 1;"],"mode":"read"}}},"required":true,"description":"A set of statements to be run in a single batch"},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Array of results from the statements executed","content":{"application/json":{"schema":{"description":"Array of results from the statements executed","type":"array","items":{"$ref":"#/components/schemas/ResultSet"}},"example":[{"columns":["id"],"columnTypes":["number"],"rows":[[1]],"rowsAffected":0,"lastInsertRowid":null}]}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const resultSets = await client.sqlite.batch({ statements: ['SELECT 1;'], mode: 'read' });\n\n console.log(resultSets);\n}\n\nmain();"}]}},"/v1/run/{valname}":{"get":{"operationId":"runGet","tags":["vals"],"description":"Run a val, specify any parameters in a querystring","parameters":[{"schema":{"type":"string"},"in":"query","name":"args","required":false,"description":"An argument that will be passed to the function as a JavaScript value"},{"schema":{"pattern":"^[^.]+.[^.]+$","type":"string"},"in":"path","name":"valname","required":true,"description":"Name of the val, in concatenated style, like username.valname"}],"deprecated":true,"responses":{"200":{"description":"Default Response"}}},"post":{"operationId":"runPost","tags":["vals"],"description":"Run a val, with arguments in the request body","requestBody":{"content":{"application/json":{"schema":{"description":"Arguments to call the method with","type":"object","properties":{"args":{"type":"array","items":{}}}},"example":{"args":[1]}}},"description":"Arguments to call the method with"},"parameters":[{"schema":{"pattern":"^[^.]+.[^.]+$","type":"string"},"in":"path","name":"valname","required":true,"description":"Name of the val, in concatenated style, like username.valname"}],"deprecated":true,"responses":{"200":{"description":"Default Response"}}}},"/v1/email":{"post":{"operationId":"emailsSend","tags":["emails"],"description":"Send emails","requestBody":{"content":{"application/json":{"schema":{"description":"Fields for an email to be sent","type":"object","properties":{"subject":{"description":"The subject line of the email","type":"string"},"from":{"title":"EmailData","anyOf":[{"type":"string"},{"title":"EmailNameAndAddress","description":"An email address and name","type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}},"required":["email"]}]},"headers":{"description":"A set of headers to include the email that you send","type":"object","additionalProperties":{"type":"string"}},"to":{"title":"EmailDataInput","description":"A single email or list of emails for one of the address fields","anyOf":[{"title":"EmailData","anyOf":[{"type":"string"},{"title":"EmailNameAndAddress","description":"An email address and name","type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}},"required":["email"]}]},{"title":"EmailDataList","type":"array","items":{"title":"EmailData","anyOf":[{"type":"string"},{"title":"EmailNameAndAddress","description":"An email address and name","type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}},"required":["email"]}]}}]},"cc":{"title":"EmailDataInput","description":"A single email or list of emails for one of the address fields","anyOf":[{"title":"EmailData","anyOf":[{"type":"string"},{"title":"EmailNameAndAddress","description":"An email address and name","type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}},"required":["email"]}]},{"title":"EmailDataList","type":"array","items":{"title":"EmailData","anyOf":[{"type":"string"},{"title":"EmailNameAndAddress","description":"An email address and name","type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}},"required":["email"]}]}}]},"bcc":{"title":"EmailDataInput","description":"A single email or list of emails for one of the address fields","anyOf":[{"title":"EmailData","anyOf":[{"type":"string"},{"title":"EmailNameAndAddress","description":"An email address and name","type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}},"required":["email"]}]},{"title":"EmailDataList","type":"array","items":{"title":"EmailData","anyOf":[{"type":"string"},{"title":"EmailNameAndAddress","description":"An email address and name","type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}},"required":["email"]}]}}]},"text":{"description":"Text content of the email, for email clients that may not support HTML","type":"string"},"html":{"description":"HTML content of the email. Can be specified alongside text","type":"string"},"attachments":{"description":"A list of attachments to add to the email","type":"array","items":{"title":"AttachmentObject","type":"object","properties":{"content":{"type":"string"},"filename":{"type":"string"},"type":{"type":"string"},"disposition":{"type":"string"},"contentId":{"type":"string"}},"required":["content","filename"]}},"replyToList":{"title":"ReplyToList","description":"A reply-to list of email addresses","anyOf":[{"title":"EmailNameAndAddress","description":"An email address and name","type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}},"required":["email"]},{"title":"EmailList","type":"array","items":{"title":"EmailNameAndAddress","description":"An email address and name","type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}},"required":["email"]}}]}}},"example":{"subject":"An important message","text":"Hello world","html":"Hello world"}}},"description":"Fields for an email to be sent"},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successfully sent email","content":{"application/json":{"schema":{"description":"Successfully sent email","type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const response = await client.emails.send({\n html: 'Hello world',\n subject: 'An important message',\n text: 'Hello world',\n });\n\n console.log(response.message);\n}\n\nmain();"}]}},"/v1/vals":{"post":{"operationId":"valsCreate","tags":["vals"],"description":"Create a new val","requestBody":{"content":{"application/json":{"schema":{"description":"Val information provided to create a new val","type":"object","properties":{"code":{"minLength":1,"maxLength":256000,"description":"Val source code as TypeScript","type":"string"},"name":{"minLength":1,"maxLength":48,"pattern":"^[a-zA-Z][a-zA-Z0-9_]*$","description":"This val’s name","type":"string"},"readme":{"maxLength":8192,"description":"Readme contents, as Markdown","type":"string"},"privacy":{"type":"string","enum":["public","unlisted","private"],"description":"This resource's privacy setting. Unlisted resources do not appear on profile pages or elsewhere, but you can link to them."},"type":{"type":"string","enum":["httpnext","http","script","email"],"default":"script","description":"The type of the val you want to create. Note that this does not include interval vals, because they cannot be created through the API yet."}},"required":["code"]},"example":{"code":"console.log(1);","name":"myVal","readme":"# My Val","privacy":"public","type":"script"}}},"required":true,"description":"Val information provided to create a new val"},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"A Val","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtendedVal"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const extendedVal = await client.vals.create({\n code: 'console.log(1);',\n name: 'myVal',\n privacy: 'public',\n readme: '# My Val',\n type: 'script',\n });\n\n console.log(extendedVal.id);\n}\n\nmain();"}]},"put":{"operationId":"valsPut","tags":["vals"],"description":"Run an existing val or create a new one","requestBody":{"content":{"application/json":{"schema":{"description":"Create a new val, or version of a val, with new code","type":"object","properties":{"code":{"minLength":1,"maxLength":256000,"description":"Val source code as TypeScript","type":"string"},"name":{"minLength":1,"maxLength":48,"description":"This val’s name","type":"string"}},"required":["code","name"]},"example":{"code":"console.log(1);","name":"myVal"}}},"required":true,"description":"Create a new val, or version of a val, with new code"},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n await client.vals.createOrUpdate({ code: 'console.log(1);', name: 'myVal' });\n}\n\nmain();"}]}},"/v1/vals/{val_id}":{"get":{"operationId":"valsGet","tags":["vals"],"description":"Get a val by id","parameters":[{"schema":{"format":"uuid","type":"string"},"in":"path","name":"val_id","required":true,"description":"Id of a val"}],"responses":{"200":{"description":"A Val","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtendedVal"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const extendedVal = await client.vals.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');\n\n console.log(extendedVal.id);\n}\n\nmain();"}]},"put":{"operationId":"valsUpdate","tags":["vals"],"description":"Update an existing val","requestBody":{"content":{"application/json":{"schema":{"description":"Note: you must supply at least one of the keys in this object in order to update a val","type":"object","properties":{"name":{"minLength":1,"maxLength":48,"pattern":"^[a-zA-Z][a-zA-Z0-9_]*$","description":"This val’s name","type":"string"},"readme":{"maxLength":8192,"description":"Readme contents, as Markdown","type":"string"},"privacy":{"type":"string","enum":["public","unlisted","private"],"description":"This resource's privacy setting. Unlisted resources do not appear on profile pages or elsewhere, but you can link to them."},"type":{"type":"string","enum":["httpnext","http","script","email"],"description":"The type of the val you want to update. Note that this does not include interval vals, because they cannot be created through the API yet."}}},"examples":{"example1":{"value":{"readme":"# Updated readme","name":"myVal"}},"example2":{"value":{"type":"http"}}}}},"description":"Note: you must supply at least one of the keys in this object in order to update a val"},"parameters":[{"schema":{"format":"uuid","type":"string"},"in":"path","name":"val_id","required":true,"description":"Id of a val"}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Val successfully updated"}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n await client.vals.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {\n name: 'myVal',\n readme: '# Updated readme',\n });\n}\n\nmain();"}]},"delete":{"operationId":"valsDelete","tags":["vals"],"description":"Delete a val","parameters":[{"schema":{"format":"uuid","type":"string"},"in":"path","name":"val_id","required":true,"description":"Id of a val"}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Val successfully deleted"},"404":{"description":"The val was not found"}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n await client.vals.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');\n}\n\nmain();"}]}},"/v1/vals/{val_id}/versions":{"get":{"operationId":"valsList","tags":["vals"],"description":"List versions of a val","parameters":[{"schema":{"minimum":0,"default":0,"type":"integer"},"in":"query","name":"offset","required":true,"description":"Number of items to skip in order to deliver paginated results"},{"schema":{"minimum":1,"maximum":100,"default":20,"type":"integer"},"in":"query","name":"limit","required":true,"description":"Maximum items to return in each paginated response"},{"schema":{"format":"uuid","type":"string"},"in":"path","name":"val_id","required":true,"description":"Id of a val"}],"responses":{"200":{"description":"A paginated result set","content":{"application/json":{"schema":{"description":"A paginated result set","type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"val_id":{"format":"uuid","description":"Id of a val","type":"string"},"version":{"minimum":0,"description":"Version of the val","type":"integer"},"createdAt":{"format":"date-time","type":"string"}},"required":["val_id","version","createdAt"]}},"links":{"$ref":"#/components/schemas/PaginationLinks"}},"required":["data","links"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const versionListResponse of client.vals.versions.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {\n limit: 1,\n offset: 0,\n })) {\n console.log(versionListResponse.val_id);\n }\n}\n\nmain();"}]},"post":{"operationId":"valsCreateVersion","tags":["vals"],"description":"Create a new version of a val","requestBody":{"content":{"application/json":{"schema":{"description":"Val information provided to create a new val","type":"object","properties":{"code":{"minLength":1,"maxLength":256000,"description":"Val source code as TypeScript","type":"string"},"name":{"minLength":1,"maxLength":48,"pattern":"^[a-zA-Z][a-zA-Z0-9_]*$","description":"This val’s name","type":"string"},"readme":{"maxLength":8192,"description":"Readme contents, as Markdown","type":"string"},"privacy":{"type":"string","enum":["public","unlisted","private"],"description":"This resource's privacy setting. Unlisted resources do not appear on profile pages or elsewhere, but you can link to them."},"type":{"type":"string","enum":["httpnext","http","script","email"],"default":"script","description":"The type of the val you want to create. Note that this does not include interval vals, because they cannot be created through the API yet."}},"required":["code"]},"example":{"code":"console.log(1);","name":"myVal","readme":"# My Val","privacy":"public","type":"script"}}},"required":true,"description":"Val information provided to create a new val"},"parameters":[{"schema":{"format":"uuid","type":"string"},"in":"path","name":"val_id","required":true,"description":"Id of a val"}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"A Val","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtendedVal"}}}},"201":{"description":"A Val","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtendedVal"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const extendedVal = await client.vals.versions.create('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {\n code: 'console.log(1);',\n name: 'myVal',\n privacy: 'public',\n readme: '# My Val',\n type: 'script',\n });\n\n console.log(extendedVal.id);\n}\n\nmain();"}]}},"/v1/vals/{val_id}/versions/{version}":{"get":{"operationId":"valsGetVersion","tags":["vals"],"description":"Get a specific version of a val","parameters":[{"schema":{"minimum":0,"default":0,"type":"integer"},"in":"query","name":"offset","required":true,"description":"Number of items to skip in order to deliver paginated results"},{"schema":{"minimum":1,"maximum":100,"default":20,"type":"integer"},"in":"query","name":"limit","required":true,"description":"Maximum items to return in each paginated response"},{"schema":{"format":"uuid","type":"string"},"in":"path","name":"val_id","required":true,"description":"Id of a val"},{"schema":{"minimum":0,"type":"integer"},"in":"path","name":"version","required":true,"description":"The val version"}],"responses":{"200":{"description":"A Val","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtendedVal"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const extendedVal = await client.vals.versions.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 0, {\n limit: 1,\n offset: 0,\n });\n\n console.log(extendedVal.id);\n}\n\nmain();"}]},"delete":{"operationId":"valsDeleteVersion","tags":["vals"],"description":"Delete a specific version of a val","parameters":[{"schema":{"format":"uuid","type":"string"},"in":"path","name":"val_id","required":true,"description":"Id of a val"},{"schema":{"minimum":0,"type":"integer"},"in":"path","name":"version","required":true,"description":"The val version"}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Version successfully deleted"},"404":{"description":"The val was not found"}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n await client.vals.versions.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 0);\n}\n\nmain();"}]}},"/v1/vals/{val_id}/evaluations/{evaluation_id}/cancel":{"post":{"operationId":"valsCancel","tags":["vals"],"description":"Cancel a running val","parameters":[{"schema":{"format":"uuid","type":"string"},"in":"path","name":"val_id","required":true,"description":"Id of a val"},{"schema":{"format":"uuid","type":"string"},"in":"path","name":"evaluation_id","required":true,"description":"The ID of the evaluation - the specific time that a val was run - that you want to cancel"}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The evaluation_id was successfully searched for and the evaluation was either already done or now has been cancelled","content":{"application/json":{"schema":{"description":"The evaluation_id was successfully searched for and the evaluation was either already done or now has been cancelled","type":"object","properties":{"found":{"description":"True if the evaluation was found and cancelled","type":"boolean"}},"required":["found"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"string"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const response = await client.vals.cancelEvaluation(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n );\n\n console.log(response.found);\n}\n\nmain();"}]}},"/v1/projects/{project_id}":{"get":{"operationId":"projectsGet","tags":["beta"],"description":"[BETA] Get a project by id","parameters":[{"schema":{"format":"uuid","type":"string"},"in":"path","name":"project_id","required":true,"description":"Id of a project"}],"responses":{"200":{"description":"A Project","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Project"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const project = await client.projects.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');\n\n console.log(project.id);\n}\n\nmain();"}]}},"/v1/projects":{"get":{"operationId":"projectsList","tags":["beta"],"description":"[BETA] Lists all public projects","parameters":[{"schema":{"minimum":0,"default":0,"type":"integer"},"in":"query","name":"offset","required":true,"description":"Number of items to skip in order to deliver paginated results"},{"schema":{"minimum":1,"maximum":100,"default":20,"type":"integer"},"in":"query","name":"limit","required":true,"description":"Maximum items to return in each paginated response"}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"A paginated result set","content":{"application/json":{"schema":{"description":"A paginated result set","type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Project"}},"links":{"$ref":"#/components/schemas/PaginationLinks"}},"required":["data","links"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const projectListResponse of client.projects.list({ limit: 1, offset: 0 })) {\n console.log(projectListResponse.id);\n }\n}\n\nmain();"}]}},"/v1/projects/{project_id}/branches/{branch_id}":{"get":{"operationId":"branchesGet","tags":["beta"],"description":"[BETA] Get a branch by id","parameters":[{"schema":{"format":"uuid","type":"string"},"in":"path","name":"project_id","required":true,"description":"Id of a project"},{"schema":{"format":"uuid","type":"string"},"in":"path","name":"branch_id","required":true,"description":"Id of a branch"}],"responses":{"200":{"description":"A Branch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Branch"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const branch = await client.projects.branches.retrieve(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n );\n\n console.log(branch.id);\n}\n\nmain();"}]}},"/v1/projects/{project_id}/branches":{"get":{"operationId":"branchesList","tags":["beta"],"description":"[BETA] List all branches for a project","parameters":[{"schema":{"minimum":0,"default":0,"type":"integer"},"in":"query","name":"offset","required":true,"description":"Number of items to skip in order to deliver paginated results"},{"schema":{"minimum":1,"maximum":100,"default":20,"type":"integer"},"in":"query","name":"limit","required":true,"description":"Maximum items to return in each paginated response"},{"schema":{"format":"uuid","type":"string"},"in":"path","name":"project_id","required":true,"description":"Id of a project"}],"responses":{"200":{"description":"A paginated result set","content":{"application/json":{"schema":{"description":"A paginated result set","type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Branch"}},"links":{"$ref":"#/components/schemas/PaginationLinks"}},"required":["data","links"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const branchListResponse of client.projects.branches.list(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n { limit: 1, offset: 0 },\n )) {\n console.log(branchListResponse.id);\n }\n}\n\nmain();"}]}},"/v1/projects/{project_id}/files":{"get":{"operationId":"rootProjectFilesGet","tags":["beta"],"description":"Get metadata for files and directories in a project at the root directory","parameters":[{"schema":{"minimum":0,"type":"integer"},"in":"query","name":"version","required":false,"description":"Specific branch version to query"},{"schema":{"type":"string"},"in":"query","name":"branch_id","required":false,"description":"Id to query"},{"schema":{"default":false,"type":"boolean"},"in":"query","name":"recursive","required":false,"description":"Whether to recursively list all files in the project"},{"schema":{"minimum":0,"default":0,"type":"integer"},"in":"query","name":"offset","required":true,"description":"Number of items to skip in order to deliver paginated results"},{"schema":{"minimum":1,"maximum":100,"default":20,"type":"integer"},"in":"query","name":"limit","required":true,"description":"Maximum items to return in each paginated response"},{"schema":{"format":"uuid","type":"string"},"in":"path","name":"project_id","required":true,"description":"Id of a project"}],"responses":{"200":{"description":"A paginated result set","content":{"application/json":{"schema":{"description":"A paginated result set","type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/FileRevisionMetadata"}},"links":{"$ref":"#/components/schemas/PaginationLinks"}},"required":["data","links"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const fileListResponse of client.projects.files.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {\n limit: 1,\n offset: 0,\n })) {\n console.log(fileListResponse.id);\n }\n}\n\nmain();"}]}},"/v1/projects/{project_id}/files/{path}":{"get":{"operationId":"projectFilesGet","tags":["beta"],"description":"Get metadata for files and directories in a project at the specified path","parameters":[{"schema":{"minimum":0,"type":"integer"},"in":"query","name":"version","required":false,"description":"Specific branch version to query"},{"schema":{"type":"string"},"in":"query","name":"branch_id","required":false,"description":"Id to query"},{"schema":{"minimum":0,"default":0,"type":"integer"},"in":"query","name":"offset","required":true,"description":"Number of items to skip in order to deliver paginated results"},{"schema":{"minimum":1,"maximum":100,"default":20,"type":"integer"},"in":"query","name":"limit","required":true,"description":"Maximum items to return in each paginated response"},{"schema":{"format":"uuid","type":"string"},"in":"path","name":"project_id","required":true,"description":"Id of a project"},{"schema":{"type":"string"},"in":"path","name":"path","required":true,"description":"URL encoded path to a file or directory (e.g. 'dir%2Fsubdir%2Ffile.ts')"}],"responses":{"200":{"description":"A paginated result set","content":{"application/json":{"schema":{"description":"A paginated result set","type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/FileRevisionMetadata"}},"links":{"$ref":"#/components/schemas/PaginationLinks"}},"required":["data","links"]}}}}}}},"/v1/projects/{project_id}/files/{path}/content":{"get":{"operationId":"filesContentGet","tags":["beta"],"description":"Download file content","parameters":[{"schema":{"minimum":0,"type":"integer"},"in":"query","name":"version","required":false,"description":"Specific branch version to query"},{"schema":{"type":"string"},"in":"query","name":"branch_id","required":false,"description":"Id to query"},{"schema":{"format":"uuid","type":"string"},"in":"path","name":"project_id","required":true,"description":"Id of a project"},{"schema":{"type":"string"},"in":"path","name":"path","required":true,"description":"URL encoded path to a file or directory (e.g. 'dir%2Fsubdir%2Ffile.ts')"},{"schema":{"type":"string"},"in":"header","name":"If-Match","required":false},{"schema":{"type":"string"},"in":"header","name":"If-Unmodified-Since","required":false},{"schema":{"type":"string"},"in":"header","name":"If-None-Match","required":false},{"schema":{"type":"string"},"in":"header","name":"If-Modified-Since","required":false},{"schema":{"type":"string"},"in":"header","name":"Cache-Control","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{}}}},"304":{"description":"Default Response","content":{"application/json":{"schema":{}}}}}}}},"servers":[{"url":"https://api.val.town","description":"Production"}],"tags":[{"name":"vals","description":"These endpoints\nlet you get, create, and run vals."},{"name":"alias","description":"Many API endpoints\naccept IDs instead of user-facing names. The alias\nendpoints let you convert between the user-facing name of a\nval or another object into an ID that can be used with other\nAPI endpoints"},{"name":"me","description":"These endpoints\ngive access to details and data from the requesting user."},{"name":"users","description":"Users"},{"name":"sqlite","description":"SQLite"},{"name":"blobs","description":"Blobs"},{"name":"search","description":"Search"},{"name":"emails","description":"Emails"}],"externalDocs":{"url":"https://api.val.town/documentation","description":"Find more info here"}} \ No newline at end of file +{"openapi":"3.1.0","info":{"title":"Val Town API","description":"Val Town’s public API\n\nOpenAPI JSON endpoint:\n\nhttps://api.val.town/openapi.json","termsOfService":"https://www.val.town/termsofuse","version":"1"},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Endpoints that support authorization expect Bearer authentication, using an API token provided from Val Town."}},"schemas":{"User":{"description":"User object","type":"object","properties":{"id":{"format":"uuid","description":"The ID of this user","type":"string"},"bio":{"anyOf":[{"description":"The user’s biography, if they have provided one","type":"string"},{"type":"null"}]},"username":{"anyOf":[{"description":"The user’s handle that they chose for themselves. Does not include the @ symbol","type":"string"},{"type":"null"}]},"profileImageUrl":{"anyOf":[{"description":"URL that points to the user’s profile image, if one exists","format":"uri","type":"string"},{"type":"null"}]},"url":{"format":"uri","description":"URL of this user’s profile on Val Town’s website","type":"string"},"links":{"type":"object","properties":{"self":{"format":"uri","description":"URL of this user on this API","type":"string"}},"required":["self"]}},"required":["id","bio","username","profileImageUrl","url","links"],"example":{"id":"00000000-0000-0000-0000-000000000000","bio":"Hello world","username":"tmcw","url":"https://val.town/u/tmcw","profileImageUrl":null}},"ResultSet":{"title":"ResultSet","description":"Result of executing an SQL statement.","type":"object","properties":{"columns":{"description":"Names of columns.\n\nNames of columns can be defined using the `AS` keyword in SQL:\n\n```sql\nSELECT author AS author, COUNT(*) AS count FROM books GROUP BY author\n```","type":"array","items":{"type":"string"}},"columnTypes":{"description":"Types of columns.\n\nThe types are currently shown for types declared in a SQL table. For column types of function calls, for example, an empty string is returned.","type":"array","items":{"type":"string"}},"rows":{"description":"Rows produced by the statement.","type":"array","items":{"title":"TursoRow","type":"array","items":{"description":"Columns can be accessed like an object by column names."}}},"rowsAffected":{"description":"Number of rows that were affected by an UPDATE, INSERT or DELETE operation.\n\nThis value is not specified for other SQL statements.","type":"number"},"lastInsertRowid":{"description":"ROWID of the last inserted row.\n\nThis value is not specified if the SQL statement was not an INSERT or if the table was not a ROWID table.","anyOf":[{"type":"string"},{"type":"number"},{"type":"null"}]}},"required":["columns","columnTypes","rows","rowsAffected"]},"ExtendedVal":{"description":"A Val","type":"object","properties":{"name":{"description":"The name of this val","type":"string"},"id":{"format":"uuid","description":"This val's id","type":"string"},"version":{"minimum":0,"description":"The version of this val, starting at zero","type":"integer"},"code":{"anyOf":[{"description":"TypeScript code associated with this val","type":"string"},{"type":"null"}]},"public":{"description":"Whether this val is available publicly on Val Town","type":"boolean"},"createdAt":{"format":"date-time","type":"string"},"privacy":{"type":"string","enum":["public","unlisted","private"],"description":"This resource's privacy setting. Unlisted resources do not appear on profile pages or elsewhere, but you can link to them."},"type":{"type":"string","enum":["interval","http","express","email","script","rpc","httpnext"],"description":"The type of a val. HTTP can receive web requests, Email can receive emails, Cron runs periodically, and Script can be used for libraries or one-off calculations"},"url":{"format":"uri","description":"The URL of this resource on the Val Town website","type":"string"},"links":{"type":"object","properties":{"self":{"format":"uri","description":"The URL of this val on this API","type":"string"},"versions":{"format":"uri","description":"The endpoint to retrieve this val's versions","type":"string"},"module":{"format":"uri","description":"The URL of this Val's source code as a module","type":"string"},"endpoint":{"format":"uri","description":"This val's web endpoint, where it serves a website or API","type":"string"}},"required":["self","versions","module"]},"author":{"anyOf":[{"description":"The user who created this val","type":"object","properties":{"id":{"format":"uuid","type":"string"},"username":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","username"]},{"type":"null"}]},"versionCreatedAt":{"format":"date-time","type":"string"},"likeCount":{"minimum":0,"description":"How many likes this val has received","type":"integer"},"referenceCount":{"minimum":0,"descriptions":"How many other public vals have imported this one","type":"integer"},"readme":{"anyOf":[{"description":"This val's readme, as Markdown","type":"string"},{"type":"null"}]}},"required":["name","id","version","code","public","createdAt","privacy","type","url","links","author","likeCount","referenceCount","readme"]},"BasicVal":{"description":"A Val","type":"object","properties":{"name":{"description":"The name of this val","type":"string"},"id":{"format":"uuid","description":"This val's id","type":"string"},"version":{"minimum":0,"description":"The version of this val, starting at zero","type":"integer"},"code":{"anyOf":[{"description":"TypeScript code associated with this val","type":"string"},{"type":"null"}]},"public":{"description":"Whether this val is available publicly on Val Town","type":"boolean"},"createdAt":{"format":"date-time","type":"string"},"privacy":{"type":"string","enum":["public","unlisted","private"],"description":"This resource's privacy setting. Unlisted resources do not appear on profile pages or elsewhere, but you can link to them."},"type":{"type":"string","enum":["interval","http","express","email","script","rpc","httpnext"],"description":"The type of a val. HTTP can receive web requests, Email can receive emails, Cron runs periodically, and Script can be used for libraries or one-off calculations"},"url":{"format":"uri","description":"The URL of this resource on the Val Town website","type":"string"},"links":{"type":"object","properties":{"self":{"format":"uri","description":"The URL of this val on this API","type":"string"},"versions":{"format":"uri","description":"The endpoint to retrieve this val's versions","type":"string"},"module":{"format":"uri","description":"The URL of this Val's source code as a module","type":"string"},"endpoint":{"format":"uri","description":"This val's web endpoint, where it serves a website or API","type":"string"}},"required":["self","versions","module"]},"author":{"anyOf":[{"description":"The user who created this val","type":"object","properties":{"id":{"format":"uuid","type":"string"},"username":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","username"]},{"type":"null"}]}},"required":["name","id","version","code","public","createdAt","privacy","type","url","links","author"],"example":{"version":0,"name":"counter","code":"export const count = 1;","createdAt":"2024-06-11T22:05:12.585Z","public":true,"id":"00000000-0000-0000-0000-000000000000","privacy":"public","type":"script","url":"https://val.town/v/tmcw/counter","author":{"id":"00000000-0000-0000-0000-000000000000","username":"tmcw"}}},"PaginationLinks":{"description":"Links to use for pagination","type":"object","properties":{"self":{"format":"uri","description":"URL of this page","type":"string"},"prev":{"format":"uri","description":"URL of the previous page, if any","type":"string"},"next":{"format":"uri","description":"URL of the next page, if any","type":"string"}},"required":["self"]},"Project":{"description":"A Project","type":"object","properties":{"name":{"type":"string"},"id":{"format":"uuid","description":"The id of the project","type":"string"},"createdAt":{"format":"date-time","type":"string"},"privacy":{"type":"string","enum":["public","unlisted","private"],"description":"This resource's privacy setting. Unlisted resources do not appear on profile pages or elsewhere, but you can link to them."},"author":{"type":"object","properties":{"id":{"format":"uuid","type":"string"},"username":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","username"]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"imageUrl":{"anyOf":[{"description":"The URL of this project's image","type":"string"},{"type":"null"}]},"links":{"type":"object","properties":{"self":{"format":"uri","description":"The URL of this resource on this API","type":"string"},"html":{"format":"uri","description":"The URL of this resource on Val Town","type":"string"}},"required":["self","html"]}},"required":["name","id","createdAt","privacy","author","description","imageUrl","links"]},"Branch":{"description":"A Branch","type":"object","properties":{"name":{"type":"string"},"id":{"format":"uuid","description":"The id of the branch","type":"string"},"version":{"minimum":0,"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"updatedAt":{"format":"date-time","type":"string"},"forkedBranchId":{"anyOf":[{"description":"The id of the branch this branch was forked from","type":"string"},{"type":"null"}]},"links":{"type":"object","properties":{"self":{"format":"uri","description":"The URL of this resource on this API","type":"string"},"html":{"format":"uri","description":"The URL of this resource on Val Town","type":"string"}},"required":["self","html"]}},"required":["name","id","version","createdAt","updatedAt","forkedBranchId","links"]},"FileRevisionMetadata":{"description":"A File or Directory's Metadata","type":"object","properties":{"name":{"type":"string"},"id":{"format":"uuid","description":"The id of the resource","type":"string"},"path":{"type":"string"},"version":{"minimum":0,"type":"integer"},"updatedAt":{"format":"date-time","type":"string"},"type":{"type":"string","enum":["directory","file","interval","http","email","script"]},"links":{"type":"object","properties":{"self":{"format":"uri","description":"The URL of this resource on this API","type":"string"},"html":{"format":"uri","description":"The URL of this resource on Val Town","type":"string"},"module":{"format":"uri","description":"The URL of this resource's source code as a module","type":"string"},"endpoint":{"format":"uri","description":"This resource's web endpoint, where it serves a website or API","type":"string"}},"required":["self","html","module"]}},"required":["name","id","path","version","updatedAt","type","links"]}}},"paths":{"/v1/search/vals":{"get":{"operationId":"searchVals","tags":["search"],"description":"Search for vals across the platform","parameters":[{"schema":{"minimum":0,"default":0,"type":"integer"},"in":"query","name":"offset","required":true,"description":"Number of items to skip in order to deliver paginated results"},{"schema":{"minimum":1,"maximum":100,"default":20,"type":"integer"},"in":"query","name":"limit","required":true,"description":"Maximum items to return in each paginated response"},{"schema":{"minLength":1,"maxLength":256,"type":"string"},"in":"query","name":"query","required":true,"description":"Search query"}],"responses":{"200":{"description":"A paginated result set","content":{"application/json":{"schema":{"description":"A paginated result set","type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BasicVal"}},"links":{"$ref":"#/components/schemas/PaginationLinks"}},"required":["data","links"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const basicVal of client.search.vals.list({ limit: 1, offset: 0, query: 'x' })) {\n console.log(basicVal.id);\n }\n}\n\nmain();"}]}},"/v1/alias/{username}":{"get":{"operationId":"aliasUsername","tags":["alias"],"description":"Get basic details about a user, given their username","parameters":[{"schema":{"type":"string"},"in":"path","name":"username","required":true,"description":"Username of the user who you are looking for"}],"responses":{"200":{"description":"User object","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const user = await client.alias.username.retrieve('username');\n\n console.log(user.id);\n}\n\nmain();"}]}},"/v1/alias/{username}/{val_name}":{"get":{"operationId":"aliasVal","tags":["alias"],"description":"Get a val","parameters":[{"schema":{"type":"string"},"in":"path","name":"username","required":true,"description":"Username of the user whose val you are looking for"},{"schema":{"type":"string"},"in":"path","name":"val_name","required":true,"description":"Name of the val you’re looking for"}],"responses":{"200":{"description":"A Val","content":{"application/json":{"schema":{"description":"A Val","type":"object","properties":{"name":{"description":"The name of this val","type":"string"},"id":{"format":"uuid","description":"This val's id","type":"string"},"version":{"minimum":0,"description":"The version of this val, starting at zero","type":"integer"},"code":{"anyOf":[{"description":"TypeScript code associated with this val","type":"string"},{"type":"null"}]},"public":{"description":"Whether this val is available publicly on Val Town","type":"boolean"},"createdAt":{"format":"date-time","type":"string"},"privacy":{"type":"string","enum":["public","unlisted","private"],"description":"This resource's privacy setting. Unlisted resources do not appear on profile pages or elsewhere, but you can link to them."},"type":{"type":"string","enum":["interval","http","express","email","script","rpc","httpnext"],"description":"The type of a val. HTTP can receive web requests, Email can receive emails, Cron runs periodically, and Script can be used for libraries or one-off calculations"},"url":{"format":"uri","description":"The URL of this resource on the Val Town website","type":"string"},"links":{"type":"object","properties":{"self":{"format":"uri","description":"The URL of this val on this API","type":"string"},"versions":{"format":"uri","description":"The endpoint to retrieve this val's versions","type":"string"},"module":{"format":"uri","description":"The URL of this Val's source code as a module","type":"string"},"endpoint":{"format":"uri","description":"This val's web endpoint, where it serves a website or API","type":"string"}},"required":["self","versions","module"]},"author":{"anyOf":[{"description":"The user who created this val","type":"object","properties":{"id":{"format":"uuid","type":"string"},"username":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","username"]},{"type":"null"}]},"versionCreatedAt":{"format":"date-time","type":"string"},"likeCount":{"minimum":0,"description":"How many likes this val has received","type":"integer"},"referenceCount":{"minimum":0,"descriptions":"How many other public vals have imported this one","type":"integer"},"readme":{"anyOf":[{"description":"This val's readme, as Markdown","type":"string"},{"type":"null"}]}},"required":["name","id","version","code","public","createdAt","privacy","type","url","links","author","likeCount","referenceCount","readme"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const valName = await client.alias.username.valName.retrieve('username', 'val_name');\n\n console.log(valName.id);\n}\n\nmain();"}]}},"/v1/alias/projects/{username}/{project_name}":{"get":{"operationId":"aliasProject","tags":["alias"],"description":"Get a project","parameters":[{"schema":{"type":"string"},"in":"path","name":"username","required":true,"description":"Username of the user whose project you are looking for"},{"schema":{"type":"string"},"in":"path","name":"project_name","required":true,"description":"Name of the project you’re looking for"}],"responses":{"200":{"description":"A Project","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Project"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const projectName = await client.alias.username.projectName.retrieve('username', 'project_name');\n\n console.log(projectName.id);\n}\n\nmain();"}]}},"/v1/me":{"get":{"operationId":"meGet","tags":["me"],"description":"Get profile information for the current user","responses":{"200":{"description":"Your user information, with tier and email included","content":{"application/json":{"schema":{"description":"Your user information, with tier and email included","type":"object","properties":{"id":{"format":"uuid","description":"The ID of this user","type":"string"},"bio":{"anyOf":[{"description":"The user’s biography, if they have provided one","type":"string"},{"type":"null"}]},"username":{"anyOf":[{"description":"The user’s handle that they chose for themselves. Does not include the @ symbol","type":"string"},{"type":"null"}]},"profileImageUrl":{"anyOf":[{"description":"URL that points to the user’s profile image, if one exists","format":"uri","type":"string"},{"type":"null"}]},"url":{"format":"uri","description":"URL of this user’s profile on Val Town’s website","type":"string"},"links":{"type":"object","properties":{"self":{"format":"uri","description":"URL of this user on this API","type":"string"}},"required":["self"]},"tier":{"anyOf":[{"type":"string","enum":["free","pro"],"description":"Your account tier"},{"type":"null"}]},"email":{"description":"Your email address","type":"string"}},"required":["id","bio","username","profileImageUrl","url","links","tier","email"]},"example":{"id":"00000000-0000-0000-0000-000000000000","bio":"Hello world","username":"tmcw","email":"example@example.com","profileImageUrl":null,"tier":"pro"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const profile = await client.me.profile.retrieve();\n\n console.log(profile.id);\n}\n\nmain();"}]}},"/v1/me/projects":{"get":{"operationId":"meProjects","tags":["me"],"description":"[BETA] List all of a user's projects for authenticated users","parameters":[{"schema":{"minimum":0,"default":0,"type":"integer"},"in":"query","name":"offset","required":true,"description":"Number of items to skip in order to deliver paginated results"},{"schema":{"minimum":1,"maximum":100,"default":20,"type":"integer"},"in":"query","name":"limit","required":true,"description":"Maximum items to return in each paginated response"}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"A paginated result set","content":{"application/json":{"schema":{"description":"A paginated result set","type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Project"}},"links":{"$ref":"#/components/schemas/PaginationLinks"}},"required":["data","links"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const projectListResponse of client.me.projects.list({ limit: 1, offset: 0 })) {\n console.log(projectListResponse.id);\n }\n}\n\nmain();"}]}},"/v1/me/likes":{"get":{"operationId":"meLikes","tags":["me"],"description":"Get vals liked by the current user","parameters":[{"schema":{"minimum":0,"default":0,"type":"integer"},"in":"query","name":"offset","required":true,"description":"Number of items to skip in order to deliver paginated results"},{"schema":{"minimum":1,"maximum":100,"default":20,"type":"integer"},"in":"query","name":"limit","required":true,"description":"Maximum items to return in each paginated response"}],"responses":{"200":{"description":"A paginated result set","content":{"application/json":{"schema":{"description":"A paginated result set","type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BasicVal"}},"links":{"$ref":"#/components/schemas/PaginationLinks"}},"required":["data","links"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const basicVal of client.me.likes.list({ limit: 1, offset: 0 })) {\n console.log(basicVal.id);\n }\n}\n\nmain();"}]}},"/v1/me/comments":{"get":{"operationId":"meComments","tags":["me"],"description":"Get comments related to current user, either given or received","parameters":[{"schema":{"minimum":0,"default":0,"type":"integer"},"in":"query","name":"offset","required":true,"description":"Number of items to skip in order to deliver paginated results"},{"schema":{"minimum":1,"maximum":100,"default":20,"type":"integer"},"in":"query","name":"limit","required":true,"description":"Maximum items to return in each paginated response"},{"schema":{"format":"date-time","type":"string"},"in":"query","name":"since","required":false,"description":"Include items created after this date"},{"schema":{"format":"date-time","type":"string"},"in":"query","name":"until","required":false,"description":"Include items created before this date"},{"schema":{"type":"string","enum":["any","received","given"],"default":"any"},"in":"query","name":"relationship","required":true,"description":"Whether to get comments you have received, given, or both"}],"responses":{"200":{"description":"A paginated result set","content":{"application/json":{"schema":{"description":"A paginated result set","type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"comment":{"description":"Text of the given comment, in Markdown","type":"string"},"id":{"format":"uuid","description":"The comment’s id","type":"string"},"createdAt":{"format":"date-time","type":"string"},"author":{"type":"object","properties":{"id":{"format":"uuid","type":"string"},"username":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","username"]},"val":{"type":"object","properties":{"name":{"description":"Name of the val that is being commented on","type":"string"},"id":{"format":"uuid","type":"string"},"version":{"minimum":0,"type":"integer"},"privacy":{"type":"string","enum":["public","unlisted","private"],"description":"This resource's privacy setting. Unlisted resources do not appear on profile pages or elsewhere, but you can link to them."},"author":{"anyOf":[{"description":"The user who created this val","type":"object","properties":{"id":{"format":"uuid","type":"string"},"username":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","username"]},{"type":"null"}]}},"required":["name","id","version","privacy","author"]}},"required":["comment","id","createdAt","author","val"]}},"links":{"$ref":"#/components/schemas/PaginationLinks"}},"required":["data","links"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const commentListResponse of client.me.comments.list({\n limit: 1,\n offset: 0,\n relationship: 'any',\n })) {\n console.log(commentListResponse.id);\n }\n}\n\nmain();"}]}},"/v1/me/references":{"get":{"operationId":"meReferences","tags":["me"],"description":"Get vals that depend on any of the user's vals","parameters":[{"schema":{"minimum":0,"default":0,"type":"integer"},"in":"query","name":"offset","required":true,"description":"Number of items to skip in order to deliver paginated results"},{"schema":{"minimum":1,"maximum":100,"default":20,"type":"integer"},"in":"query","name":"limit","required":true,"description":"Maximum items to return in each paginated response"},{"schema":{"format":"date-time","type":"string"},"in":"query","name":"since","required":false,"description":"Include items created after this date"},{"schema":{"format":"date-time","type":"string"},"in":"query","name":"until","required":false,"description":"Include items created before this date"}],"responses":{"200":{"description":"A paginated result set","content":{"application/json":{"schema":{"description":"A paginated result set","type":"object","properties":{"data":{"type":"array","items":{"description":"A description of a dependency from one val (reference) to another (dependsOn) that was introduced at a particular time.","type":"object","properties":{"reference":{"description":"A val in a dependency relationship","type":"object","properties":{"id":{"format":"uuid","description":"The id of this val","type":"string"},"username":{"anyOf":[{"description":"The username of the person who authored this val","type":"string"},{"type":"null"}]},"author_id":{"anyOf":[{"format":"uuid","description":"The ID of the person who authored this val","type":"string"},{"type":"null"}]},"name":{"description":"The name of this val","type":"string"}},"required":["id","username","author_id","name"]},"dependsOn":{"description":"A val in a dependency relationship","type":"object","properties":{"id":{"format":"uuid","description":"The id of this val","type":"string"},"username":{"anyOf":[{"description":"The username of the person who authored this val","type":"string"},{"type":"null"}]},"author_id":{"anyOf":[{"format":"uuid","description":"The ID of the person who authored this val","type":"string"},{"type":"null"}]},"name":{"description":"The name of this val","type":"string"}},"required":["id","username","author_id","name"]},"referencedAt":{"format":"date-time","type":"string"}},"required":["reference","dependsOn","referencedAt"]}},"links":{"$ref":"#/components/schemas/PaginationLinks"}},"required":["data","links"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const referenceListResponse of client.me.references.list({ limit: 1, offset: 0 })) {\n console.log(referenceListResponse.dependsOn);\n }\n}\n\nmain();"}]}},"/v1/blob":{"get":{"operationId":"blobsList","tags":["blobs"],"description":"List blobs in your account","parameters":[{"schema":{"type":"string"},"in":"query","name":"prefix","required":false,"description":"If specified, only include blobs that start with this string"}],"responses":{"200":{"description":"List of blobs that you’ve stored","content":{"application/json":{"schema":{"description":"List of blobs that you’ve stored","type":"array","items":{"title":"BlobListingItem","type":"object","properties":{"key":{"type":"string"},"size":{"description":"Size in bytes of the object","type":"integer"},"lastModified":{"description":"Creation date of the object","format":"date-time","type":"string"}},"required":["key"]}},"example":[{"key":"hello_world","size":20,"lastModified":"2024-06-24T20:00:59.702Z"}]}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const blobs = await client.blobs.list();\n\n console.log(blobs);\n}\n\nmain();"}]}},"/v1/blob/{key}":{"get":{"operationId":"blobsGet","tags":["blobs"],"description":"Get a blob’s contents.","parameters":[{"schema":{"minLength":1,"maxLength":512,"type":"string"},"in":"path","name":"key","required":true,"description":"Key that uniquely identifies this blob"}],"responses":{"200":{"description":"Binary contents of the returned file","content":{"application/octet-stream":{"schema":{"format":"binary","type":"string"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const blob = await client.blobs.get('x');\n\n console.log(blob);\n\n const content = await blob.blob();\n console.log(content);\n}\n\nmain();"}]},"post":{"operationId":"blobsStore","tags":["blobs"],"description":"Store data in blob storage","requestBody":{"content":{"application/json":{"schema":{"format":"binary","description":"Binary input data","type":"string"}}},"description":"Binary input data"},"parameters":[{"schema":{"minLength":1,"maxLength":512,"type":"string"},"in":"path","name":"key","required":true,"description":"Key that uniquely identifies this blob"}],"security":[{"bearerAuth":[]}],"responses":{"201":{"description":"Successfully stored as blob"}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n await client.blobs.store('x', fs.createReadStream('path/to/file'));\n}\n\nmain();"}]},"delete":{"operationId":"blobsDelete","tags":["blobs"],"description":"Delete a blob","parameters":[{"schema":{"minLength":1,"maxLength":512,"type":"string"},"in":"path","name":"key","required":true,"description":"Key that uniquely identifies this blob"}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Blob successfully deleted"}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n await client.blobs.delete('x');\n}\n\nmain();"}]}},"/v1/users/{user_id}":{"get":{"operationId":"usersGet","tags":["users"],"description":"Get basic information about a user","parameters":[{"schema":{"format":"uuid","type":"string"},"in":"path","name":"user_id","required":true,"description":"User Id"}],"responses":{"200":{"description":"User object","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const user = await client.users.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');\n\n console.log(user.id);\n}\n\nmain();"}]}},"/v1/users/{user_id}/vals":{"get":{"operationId":"usersVals","tags":["users"],"description":"List a user's vals","parameters":[{"schema":{"minimum":0,"default":0,"type":"integer"},"in":"query","name":"offset","required":true,"description":"Number of items to skip in order to deliver paginated results"},{"schema":{"minimum":1,"maximum":100,"default":20,"type":"integer"},"in":"query","name":"limit","required":true,"description":"Maximum items to return in each paginated response"},{"schema":{"format":"uuid","type":"string"},"in":"path","name":"user_id","required":true,"description":"User Id"}],"responses":{"200":{"description":"A paginated result set","content":{"application/json":{"schema":{"description":"A paginated result set","type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BasicVal"}},"links":{"$ref":"#/components/schemas/PaginationLinks"}},"required":["data","links"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const basicVal of client.users.vals.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {\n limit: 1,\n offset: 0,\n })) {\n console.log(basicVal.id);\n }\n}\n\nmain();"}]}},"/v1/sqlite/execute":{"post":{"operationId":"sqliteExecute","tags":["sqlite"],"description":"Execute a single SQLite statement and return results","requestBody":{"content":{"application/json":{"schema":{"description":"A single statement to run","type":"object","properties":{"statement":{"anyOf":[{"description":"Simple SQL statement to run in SQLite","type":"string"},{"title":"ParameterizedQuery","description":"A parameterized SQL query. See https://docs.turso.tech/sdk/ts/reference#batch-transactions for reference","type":"object","properties":{"sql":{"description":"SQL statement, with ? placeholders for arguments","type":"string"},"args":{"title":"StatementArg","description":"List of arguments to be used in the given statement","anyOf":[{"type":"array","items":{"title":"TursoValue","description":"A value to be used as a parameter"}},{"type":"object","additionalProperties":{"title":"TursoValue","description":"A value to be used as a parameter"}}]}},"required":["sql","args"]}]}},"required":["statement"]},"examples":{"example1":{"value":{"statement":"SELECT 1;"}},"example2":{"value":{"statement":{"sql":"SELECT * FROM table WHERE column = ?;","args":[1]}}}}}},"required":true,"description":"A single statement to run"},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Result of executing an SQL statement.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultSet"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const resultSet = await client.sqlite.execute({ statement: 'SELECT 1;' });\n\n console.log(resultSet.lastInsertRowid);\n}\n\nmain();"}]}},"/v1/sqlite/batch":{"post":{"operationId":"sqliteBatch","tags":["sqlite"],"description":"Execute a batch of SQLite statements and return results for all of them","requestBody":{"content":{"application/json":{"schema":{"description":"A set of statements to be run in a single batch","type":"object","properties":{"statements":{"type":"array","items":{"anyOf":[{"description":"Simple SQL statement to run in SQLite","type":"string"},{"title":"ParameterizedQuery","description":"A parameterized SQL query. See https://docs.turso.tech/sdk/ts/reference#batch-transactions for reference","type":"object","properties":{"sql":{"description":"SQL statement, with ? placeholders for arguments","type":"string"},"args":{"title":"StatementArg","description":"List of arguments to be used in the given statement","anyOf":[{"type":"array","items":{"title":"TursoValue","description":"A value to be used as a parameter"}},{"type":"object","additionalProperties":{"title":"TursoValue","description":"A value to be used as a parameter"}}]}},"required":["sql","args"]}]}},"mode":{"type":"string","enum":["write","read","deferred"]}},"required":["statements"]},"example":{"statements":["SELECT 1;"],"mode":"read"}}},"required":true,"description":"A set of statements to be run in a single batch"},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Array of results from the statements executed","content":{"application/json":{"schema":{"description":"Array of results from the statements executed","type":"array","items":{"$ref":"#/components/schemas/ResultSet"}},"example":[{"columns":["id"],"columnTypes":["number"],"rows":[[1]],"rowsAffected":0,"lastInsertRowid":null}]}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const resultSets = await client.sqlite.batch({ statements: ['SELECT 1;'], mode: 'read' });\n\n console.log(resultSets);\n}\n\nmain();"}]}},"/v1/run/{valname}":{"get":{"operationId":"runGet","tags":["vals"],"description":"Run a val, specify any parameters in a querystring","parameters":[{"schema":{"type":"string"},"in":"query","name":"args","required":false,"description":"An argument that will be passed to the function as a JavaScript value"},{"schema":{"pattern":"^[^.]+.[^.]+$","type":"string"},"in":"path","name":"valname","required":true,"description":"Name of the val, in concatenated style, like username.valname"}],"deprecated":true,"responses":{"200":{"description":"Default Response"}}},"post":{"operationId":"runPost","tags":["vals"],"description":"Run a val, with arguments in the request body","requestBody":{"content":{"application/json":{"schema":{"description":"Arguments to call the method with","type":"object","properties":{"args":{"type":"array","items":{}}}},"example":{"args":[1]}}},"description":"Arguments to call the method with"},"parameters":[{"schema":{"pattern":"^[^.]+.[^.]+$","type":"string"},"in":"path","name":"valname","required":true,"description":"Name of the val, in concatenated style, like username.valname"}],"deprecated":true,"responses":{"200":{"description":"Default Response"}}}},"/v1/email":{"post":{"operationId":"emailsSend","tags":["emails"],"description":"Send emails","requestBody":{"content":{"application/json":{"schema":{"description":"Fields for an email to be sent","type":"object","properties":{"subject":{"description":"The subject line of the email","type":"string"},"from":{"title":"EmailData","anyOf":[{"type":"string"},{"title":"EmailNameAndAddress","description":"An email address and name","type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}},"required":["email"]}]},"headers":{"description":"A set of headers to include the email that you send","type":"object","additionalProperties":{"type":"string"}},"to":{"title":"EmailDataInput","description":"A single email or list of emails for one of the address fields","anyOf":[{"title":"EmailData","anyOf":[{"type":"string"},{"title":"EmailNameAndAddress","description":"An email address and name","type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}},"required":["email"]}]},{"title":"EmailDataList","type":"array","items":{"title":"EmailData","anyOf":[{"type":"string"},{"title":"EmailNameAndAddress","description":"An email address and name","type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}},"required":["email"]}]}}]},"cc":{"title":"EmailDataInput","description":"A single email or list of emails for one of the address fields","anyOf":[{"title":"EmailData","anyOf":[{"type":"string"},{"title":"EmailNameAndAddress","description":"An email address and name","type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}},"required":["email"]}]},{"title":"EmailDataList","type":"array","items":{"title":"EmailData","anyOf":[{"type":"string"},{"title":"EmailNameAndAddress","description":"An email address and name","type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}},"required":["email"]}]}}]},"bcc":{"title":"EmailDataInput","description":"A single email or list of emails for one of the address fields","anyOf":[{"title":"EmailData","anyOf":[{"type":"string"},{"title":"EmailNameAndAddress","description":"An email address and name","type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}},"required":["email"]}]},{"title":"EmailDataList","type":"array","items":{"title":"EmailData","anyOf":[{"type":"string"},{"title":"EmailNameAndAddress","description":"An email address and name","type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}},"required":["email"]}]}}]},"text":{"description":"Text content of the email, for email clients that may not support HTML","type":"string"},"html":{"description":"HTML content of the email. Can be specified alongside text","type":"string"},"attachments":{"description":"A list of attachments to add to the email","type":"array","items":{"title":"AttachmentObject","type":"object","properties":{"content":{"type":"string"},"filename":{"type":"string"},"type":{"type":"string"},"disposition":{"type":"string"},"contentId":{"type":"string"}},"required":["content","filename"]}},"replyToList":{"title":"ReplyToList","description":"A reply-to list of email addresses","anyOf":[{"title":"EmailNameAndAddress","description":"An email address and name","type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}},"required":["email"]},{"title":"EmailList","type":"array","items":{"title":"EmailNameAndAddress","description":"An email address and name","type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}},"required":["email"]}}]}}},"example":{"subject":"An important message","text":"Hello world","html":"Hello world"}}},"description":"Fields for an email to be sent"},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successfully sent email","content":{"application/json":{"schema":{"description":"Successfully sent email","type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const response = await client.emails.send({\n html: 'Hello world',\n subject: 'An important message',\n text: 'Hello world',\n });\n\n console.log(response.message);\n}\n\nmain();"}]}},"/v1/vals":{"post":{"operationId":"valsCreate","tags":["vals"],"description":"Create a new val","requestBody":{"content":{"application/json":{"schema":{"description":"Val information provided to create a new val","type":"object","properties":{"code":{"minLength":1,"maxLength":256000,"description":"Val source code as TypeScript","type":"string"},"name":{"minLength":1,"maxLength":48,"pattern":"^[a-zA-Z][a-zA-Z0-9_]*$","description":"This val’s name","type":"string"},"readme":{"maxLength":8192,"description":"Readme contents, as Markdown","type":"string"},"privacy":{"type":"string","enum":["public","unlisted","private"],"description":"This resource's privacy setting. Unlisted resources do not appear on profile pages or elsewhere, but you can link to them."},"type":{"type":"string","enum":["httpnext","http","script","email"],"default":"script","description":"The type of the val you want to create. Note that this does not include interval vals, because they cannot be created through the API yet."}},"required":["code"]},"example":{"code":"console.log(1);","name":"myVal","readme":"# My Val","privacy":"public","type":"script"}}},"required":true,"description":"Val information provided to create a new val"},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"A Val","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtendedVal"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const extendedVal = await client.vals.create({\n code: 'console.log(1);',\n name: 'myVal',\n privacy: 'public',\n readme: '# My Val',\n type: 'script',\n });\n\n console.log(extendedVal.id);\n}\n\nmain();"}]},"put":{"operationId":"valsPut","tags":["vals"],"description":"Run an existing val or create a new one","requestBody":{"content":{"application/json":{"schema":{"description":"Create a new val, or version of a val, with new code","type":"object","properties":{"code":{"minLength":1,"maxLength":256000,"description":"Val source code as TypeScript","type":"string"},"name":{"minLength":1,"maxLength":48,"description":"This val’s name","type":"string"}},"required":["code","name"]},"example":{"code":"console.log(1);","name":"myVal"}}},"required":true,"description":"Create a new val, or version of a val, with new code"},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n await client.vals.createOrUpdate({ code: 'console.log(1);', name: 'myVal' });\n}\n\nmain();"}]}},"/v1/vals/{val_id}":{"get":{"operationId":"valsGet","tags":["vals"],"description":"Get a val by id","parameters":[{"schema":{"format":"uuid","type":"string"},"in":"path","name":"val_id","required":true,"description":"Id of a val"}],"responses":{"200":{"description":"A Val","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtendedVal"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const extendedVal = await client.vals.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');\n\n console.log(extendedVal.id);\n}\n\nmain();"}]},"put":{"operationId":"valsUpdate","tags":["vals"],"description":"Update an existing val","requestBody":{"content":{"application/json":{"schema":{"description":"Note: you must supply at least one of the keys in this object in order to update a val","type":"object","properties":{"name":{"minLength":1,"maxLength":48,"pattern":"^[a-zA-Z][a-zA-Z0-9_]*$","description":"This val’s name","type":"string"},"readme":{"maxLength":8192,"description":"Readme contents, as Markdown","type":"string"},"privacy":{"type":"string","enum":["public","unlisted","private"],"description":"This resource's privacy setting. Unlisted resources do not appear on profile pages or elsewhere, but you can link to them."},"type":{"type":"string","enum":["httpnext","http","script","email"],"description":"The type of the val you want to update. Note that this does not include interval vals, because they cannot be created through the API yet."}}},"examples":{"example1":{"value":{"readme":"# Updated readme","name":"myVal"}},"example2":{"value":{"type":"http"}}}}},"description":"Note: you must supply at least one of the keys in this object in order to update a val"},"parameters":[{"schema":{"format":"uuid","type":"string"},"in":"path","name":"val_id","required":true,"description":"Id of a val"}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Val successfully updated"}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n await client.vals.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {\n name: 'myVal',\n readme: '# Updated readme',\n });\n}\n\nmain();"}]},"delete":{"operationId":"valsDelete","tags":["vals"],"description":"Delete a val","parameters":[{"schema":{"format":"uuid","type":"string"},"in":"path","name":"val_id","required":true,"description":"Id of a val"}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Val successfully deleted"},"404":{"description":"The val was not found"}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n await client.vals.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');\n}\n\nmain();"}]}},"/v1/vals/{val_id}/versions":{"get":{"operationId":"valsList","tags":["vals"],"description":"List versions of a val","parameters":[{"schema":{"minimum":0,"default":0,"type":"integer"},"in":"query","name":"offset","required":true,"description":"Number of items to skip in order to deliver paginated results"},{"schema":{"minimum":1,"maximum":100,"default":20,"type":"integer"},"in":"query","name":"limit","required":true,"description":"Maximum items to return in each paginated response"},{"schema":{"format":"uuid","type":"string"},"in":"path","name":"val_id","required":true,"description":"Id of a val"}],"responses":{"200":{"description":"A paginated result set","content":{"application/json":{"schema":{"description":"A paginated result set","type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"val_id":{"format":"uuid","description":"Id of a val","type":"string"},"version":{"minimum":0,"description":"Version of the val","type":"integer"},"createdAt":{"format":"date-time","type":"string"}},"required":["val_id","version","createdAt"]}},"links":{"$ref":"#/components/schemas/PaginationLinks"}},"required":["data","links"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const versionListResponse of client.vals.versions.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {\n limit: 1,\n offset: 0,\n })) {\n console.log(versionListResponse.val_id);\n }\n}\n\nmain();"}]},"post":{"operationId":"valsCreateVersion","tags":["vals"],"description":"Create a new version of a val","requestBody":{"content":{"application/json":{"schema":{"description":"Val information provided to create a new val","type":"object","properties":{"code":{"minLength":1,"maxLength":256000,"description":"Val source code as TypeScript","type":"string"},"name":{"minLength":1,"maxLength":48,"pattern":"^[a-zA-Z][a-zA-Z0-9_]*$","description":"This val’s name","type":"string"},"readme":{"maxLength":8192,"description":"Readme contents, as Markdown","type":"string"},"privacy":{"type":"string","enum":["public","unlisted","private"],"description":"This resource's privacy setting. Unlisted resources do not appear on profile pages or elsewhere, but you can link to them."},"type":{"type":"string","enum":["httpnext","http","script","email"],"default":"script","description":"The type of the val you want to create. Note that this does not include interval vals, because they cannot be created through the API yet."}},"required":["code"]},"example":{"code":"console.log(1);","name":"myVal","readme":"# My Val","privacy":"public","type":"script"}}},"required":true,"description":"Val information provided to create a new val"},"parameters":[{"schema":{"format":"uuid","type":"string"},"in":"path","name":"val_id","required":true,"description":"Id of a val"}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"A Val","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtendedVal"}}}},"201":{"description":"A Val","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtendedVal"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const extendedVal = await client.vals.versions.create('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {\n code: 'console.log(1);',\n name: 'myVal',\n privacy: 'public',\n readme: '# My Val',\n type: 'script',\n });\n\n console.log(extendedVal.id);\n}\n\nmain();"}]}},"/v1/vals/{val_id}/versions/{version}":{"get":{"operationId":"valsGetVersion","tags":["vals"],"description":"Get a specific version of a val","parameters":[{"schema":{"minimum":0,"default":0,"type":"integer"},"in":"query","name":"offset","required":true,"description":"Number of items to skip in order to deliver paginated results"},{"schema":{"minimum":1,"maximum":100,"default":20,"type":"integer"},"in":"query","name":"limit","required":true,"description":"Maximum items to return in each paginated response"},{"schema":{"format":"uuid","type":"string"},"in":"path","name":"val_id","required":true,"description":"Id of a val"},{"schema":{"minimum":0,"type":"integer"},"in":"path","name":"version","required":true,"description":"The val version"}],"responses":{"200":{"description":"A Val","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtendedVal"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const extendedVal = await client.vals.versions.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 0, {\n limit: 1,\n offset: 0,\n });\n\n console.log(extendedVal.id);\n}\n\nmain();"}]},"delete":{"operationId":"valsDeleteVersion","tags":["vals"],"description":"Delete a specific version of a val","parameters":[{"schema":{"format":"uuid","type":"string"},"in":"path","name":"val_id","required":true,"description":"Id of a val"},{"schema":{"minimum":0,"type":"integer"},"in":"path","name":"version","required":true,"description":"The val version"}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Version successfully deleted"},"404":{"description":"The val was not found"}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n await client.vals.versions.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 0);\n}\n\nmain();"}]}},"/v1/vals/{val_id}/evaluations/{evaluation_id}/cancel":{"post":{"operationId":"valsCancel","tags":["vals"],"description":"Cancel a running val","parameters":[{"schema":{"format":"uuid","type":"string"},"in":"path","name":"val_id","required":true,"description":"Id of a val"},{"schema":{"format":"uuid","type":"string"},"in":"path","name":"evaluation_id","required":true,"description":"The ID of the evaluation - the specific time that a val was run - that you want to cancel"}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The evaluation_id was successfully searched for and the evaluation was either already done or now has been cancelled","content":{"application/json":{"schema":{"description":"The evaluation_id was successfully searched for and the evaluation was either already done or now has been cancelled","type":"object","properties":{"found":{"description":"True if the evaluation was found and cancelled","type":"boolean"}},"required":["found"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"string"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const response = await client.vals.cancelEvaluation(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n );\n\n console.log(response.found);\n}\n\nmain();"}]}},"/v1/projects/{project_id}":{"get":{"operationId":"projectsGet","tags":["beta"],"description":"[BETA] Get a project by id","parameters":[{"schema":{"format":"uuid","type":"string"},"in":"path","name":"project_id","required":true,"description":"Id of a project"}],"responses":{"200":{"description":"A Project","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Project"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const project = await client.projects.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');\n\n console.log(project.id);\n}\n\nmain();"}]}},"/v1/projects":{"get":{"operationId":"projectsList","tags":["beta"],"description":"[BETA] Lists all public projects","parameters":[{"schema":{"minimum":0,"default":0,"type":"integer"},"in":"query","name":"offset","required":true,"description":"Number of items to skip in order to deliver paginated results"},{"schema":{"minimum":1,"maximum":100,"default":20,"type":"integer"},"in":"query","name":"limit","required":true,"description":"Maximum items to return in each paginated response"}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"A paginated result set","content":{"application/json":{"schema":{"description":"A paginated result set","type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Project"}},"links":{"$ref":"#/components/schemas/PaginationLinks"}},"required":["data","links"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const projectListResponse of client.projects.list({ limit: 1, offset: 0 })) {\n console.log(projectListResponse.id);\n }\n}\n\nmain();"}]}},"/v1/projects/{project_id}/branches/{branch_id}":{"get":{"operationId":"branchesGet","tags":["beta"],"description":"[BETA] Get a branch by id","parameters":[{"schema":{"format":"uuid","type":"string"},"in":"path","name":"project_id","required":true,"description":"Id of a project"},{"schema":{"format":"uuid","type":"string"},"in":"path","name":"branch_id","required":true,"description":"Id of a branch"}],"responses":{"200":{"description":"A Branch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Branch"}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const branch = await client.projects.branches.retrieve(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n );\n\n console.log(branch.id);\n}\n\nmain();"}]}},"/v1/projects/{project_id}/branches":{"get":{"operationId":"branchesList","tags":["beta"],"description":"[BETA] List all branches for a project","parameters":[{"schema":{"minimum":0,"default":0,"type":"integer"},"in":"query","name":"offset","required":true,"description":"Number of items to skip in order to deliver paginated results"},{"schema":{"minimum":1,"maximum":100,"default":20,"type":"integer"},"in":"query","name":"limit","required":true,"description":"Maximum items to return in each paginated response"},{"schema":{"format":"uuid","type":"string"},"in":"path","name":"project_id","required":true,"description":"Id of a project"}],"responses":{"200":{"description":"A paginated result set","content":{"application/json":{"schema":{"description":"A paginated result set","type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Branch"}},"links":{"$ref":"#/components/schemas/PaginationLinks"}},"required":["data","links"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const branchListResponse of client.projects.branches.list(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n { limit: 1, offset: 0 },\n )) {\n console.log(branchListResponse.id);\n }\n}\n\nmain();"}]}},"/v1/projects/{project_id}/files":{"get":{"operationId":"rootProjectFilesGet","tags":["beta"],"description":"Get metadata for files and directories in a project at the root directory","parameters":[{"schema":{"minimum":0,"type":"integer"},"in":"query","name":"version","required":false,"description":"Specific branch version to query"},{"schema":{"type":"string"},"in":"query","name":"branch_id","required":false,"description":"Id to query"},{"schema":{"default":false,"type":"boolean"},"in":"query","name":"recursive","required":false,"description":"Whether to recursively list all files in the project"},{"schema":{"minimum":0,"default":0,"type":"integer"},"in":"query","name":"offset","required":true,"description":"Number of items to skip in order to deliver paginated results"},{"schema":{"minimum":1,"maximum":100,"default":20,"type":"integer"},"in":"query","name":"limit","required":true,"description":"Maximum items to return in each paginated response"},{"schema":{"format":"uuid","type":"string"},"in":"path","name":"project_id","required":true,"description":"Id of a project"}],"responses":{"200":{"description":"A paginated result set","content":{"application/json":{"schema":{"description":"A paginated result set","type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/FileRevisionMetadata"}},"links":{"$ref":"#/components/schemas/PaginationLinks"}},"required":["data","links"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const fileListResponse of client.projects.files.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {\n limit: 1,\n offset: 0,\n })) {\n console.log(fileListResponse.id);\n }\n}\n\nmain();"}]}},"/v1/projects/{project_id}/files/{path}":{"get":{"operationId":"projectFilesGet","tags":["beta"],"description":"Get metadata for files and directories in a project at the specified path","parameters":[{"schema":{"minimum":0,"type":"integer"},"in":"query","name":"version","required":false,"description":"Specific branch version to query"},{"schema":{"type":"string"},"in":"query","name":"branch_id","required":false,"description":"Id to query"},{"schema":{"minimum":0,"default":0,"type":"integer"},"in":"query","name":"offset","required":true,"description":"Number of items to skip in order to deliver paginated results"},{"schema":{"minimum":1,"maximum":100,"default":20,"type":"integer"},"in":"query","name":"limit","required":true,"description":"Maximum items to return in each paginated response"},{"schema":{"format":"uuid","type":"string"},"in":"path","name":"project_id","required":true,"description":"Id of a project"},{"schema":{"type":"string"},"in":"path","name":"path","required":true,"description":"URL encoded path to a file or directory (e.g. 'dir%2Fsubdir%2Ffile.ts')"}],"responses":{"200":{"description":"A paginated result set","content":{"application/json":{"schema":{"description":"A paginated result set","type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/FileRevisionMetadata"}},"links":{"$ref":"#/components/schemas/PaginationLinks"}},"required":["data","links"]}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const file = await client.projects.files.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 'path', {\n limit: 1,\n offset: 0,\n });\n\n console.log(file.data);\n}\n\nmain();"}]}},"/v1/projects/{project_id}/files/{path}/content":{"get":{"operationId":"filesContentGet","tags":["beta"],"description":"Download file content","parameters":[{"schema":{"minimum":0,"type":"integer"},"in":"query","name":"version","required":false,"description":"Specific branch version to query"},{"schema":{"type":"string"},"in":"query","name":"branch_id","required":false,"description":"Id to query"},{"schema":{"format":"uuid","type":"string"},"in":"path","name":"project_id","required":true,"description":"Id of a project"},{"schema":{"type":"string"},"in":"path","name":"path","required":true,"description":"URL encoded path to a file or directory (e.g. 'dir%2Fsubdir%2Ffile.ts')"},{"schema":{"type":"string"},"in":"header","name":"If-Match","required":false},{"schema":{"type":"string"},"in":"header","name":"If-Unmodified-Since","required":false},{"schema":{"type":"string"},"in":"header","name":"If-None-Match","required":false},{"schema":{"type":"string"},"in":"header","name":"If-Modified-Since","required":false},{"schema":{"type":"string"},"in":"header","name":"Cache-Control","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{}}}},"304":{"description":"Default Response","content":{"application/json":{"schema":{}}}}},"x-codeSamples":[{"lang":"JavaScript","source":"import ValTown from '@valtown/sdk';\n\nconst client = new ValTown();\n\nasync function main() {\n const response = await client.projects.files.content('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 'path');\n\n console.log(response);\n}\n\nmain();"}]}}},"servers":[{"url":"https://api.val.town","description":"Production"}],"tags":[{"name":"vals","description":"These endpoints\nlet you get, create, and run vals."},{"name":"alias","description":"Many API endpoints\naccept IDs instead of user-facing names. The alias\nendpoints let you convert between the user-facing name of a\nval or another object into an ID that can be used with other\nAPI endpoints"},{"name":"me","description":"These endpoints\ngive access to details and data from the requesting user."},{"name":"users","description":"Users"},{"name":"sqlite","description":"SQLite"},{"name":"blobs","description":"Blobs"},{"name":"search","description":"Search"},{"name":"emails","description":"Emails"}],"externalDocs":{"url":"https://api.val.town/documentation","description":"Find more info here"}} \ No newline at end of file