1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
export let openaiOpenAPI = `
openapi: 3.0.0
info:
title: Val Town API
description: |
The Val Town API provides services to evaluate JavaScript and TypeScript expressions, run vals as APIs, either as functions or Express handlers.
Learn more at [https://docs.val.town](https://docs.val.town)
version: 1.0.0
servers:
- url: https://stevekrouse-chatgptplugin.express.val.run
description: Val Town API v1
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: API Key
schemas:
JSON:
oneOf:
- type: string
- type: number
- type: object
- type: array
items: {}
- type: boolean
description: "Can be anything: string, number, array, object, etc., including \`null\`"
parameters:
expression:
in: path
name: expression
required: true
description: |
The JavaScript or TypeScript expression to be evaluated.
This should be a single expression, like a single function
call, assignment operation, or calculation. If you need
to execute multiple expressions, wrap them in a function.
schema:
type: string
examples:
simpleAddition:
value: "1+1"
summary: Simple addition
functionCall:
value: "@stevekrouse.addOne(@stevekrouse.example1)"
summary: Calling a user's val function
handle:
name: handle
in: path
required: true
description: |
The handle of the val owner, *not* including the \`@\` symbol.
schema:
type: string
examples:
stevekrouse:
value: stevekrouse
summary: Steve Krouse's handle
runVal:
name: val
in: path
required: true
description: The val to run.
schema:
type: string
examples:
id:
value: id
summary: "id"
description: |
This val is a function that returns its arguments. It is useful for testing how the API handles the arguments passed to it.
View the val at [https://val.town/v/stevekrouse.id](https://val.town/v/stevekrouse.id)
responses:
ExpressionResult:
description: The returned result of executing the passed expression successfully. The result can be of any JSON type. It will not include any logs that were generated during execution.
content:
application/json:
schema:
oneOf:
- type: string
- type: number
- type: object
- type: array
items: {}
- type: boolean
examples:
simpleAddition:
value: 2
summary: Simple addition result
functionCall:
value: 42
summary: Calling a function result
security:
- bearerAuth: []
- {}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023