Functions
Create a function
POST /v1/functions- Permission
write:functions- Tokens
- API key, CLI user token
Create an API-managed function. It is live at once and runs on its schedule or when you start a run.
{
}
{
}
1
import os
2
3
from ellipsis import (
4
Ellipsis,
5
FunctionConfig,
6
FunctionIdentity,
7
FunctionSettings,
8
)
9
10
client = Ellipsis(api_key=os.environ["ELLIPSIS_API_TOKEN"])
11
12
result = client.functions.create(
13
FunctionConfig(
14
ellipsis=FunctionIdentity(name="open-pr-count"),
15
function=FunctionSettings(
16
handler="api-repo/functions/report.py:handler",
17
environment="api-environment",
18
),
19
),
20
)
21
print(result)
1
import { Ellipsis } from '@ellipsis-dev/sdk';
2
3
const client = new Ellipsis({
4
apiKey: process.env.ELLIPSIS_API_TOKEN!,
5
});
6
7
const request: Parameters<typeof client.functions.create>[0] = {
8
ellipsis: { kind: 'function', name: 'open-pr-count' },
9
function: {
10
handler: 'api-repo/functions/report.py:handler',
11
environment: 'api-environment',
12
},
13
};
14
15
const result = await client.functions.create(request);
16
console.log(result);
1
curl -X POST "https://api.ellipsis.dev/v1/functions" \
2
-H "Authorization: Bearer $ELLIPSIS_API_TOKEN" \
3
-H "Content-Type: application/json" \
4
-d '{
5
"function": {
6
"ellipsis": {
7
"kind": "function",
8
"name": "open-pr-count"
9
},
10
"function": {
11
"handler": "api-repo/functions/report.py:handler",
12
"environment": "api-environment"
13
}
14
}
15
}'
Request
functionFunctionConfigrequired
The function's definition.
Response
functionFunctionrequired
The saved function.