freestyle-sandboxes 0.0.81 → 0.0.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/openapi/types.gen.ts +1 -0
- package/openapi.json +1 -1
- package/package.json +1 -1
- package/src/index.ts +41 -40
package/openapi/types.gen.ts
CHANGED
package/openapi.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"openapi":"3.1.0","info":{"title":"Freestyle Sandboxes","description":"\nFreestyle Sandboxes lets you deploy your users or AIs code. **Get your API Key at [admin.freestyle.sh](https://admin.freestyle.sh)**\n\nThey are broken up into core 5 categories: [Web](#tag/web), [Execute](#tag/execute), [Cloudstate](#tag/cloudstate), [Git](#tag/git), and [Domains](#tag/domains).\n\n[Web](#tag/web): Send us the code for the website, we'll provision the certificates and get it hosted\n\n[Execute](#tag/execute): Send us a function, we'll run it and send you the output\n\n[Cloudstate](#tag/cloudstate): Our Opensource JavaScript Runtime used for cloud functions with persistent state\n\n[Domains](#tag/domains): Manage your domains, including verification and listing\n\n[Git](#tag/git): Manage your git repositories\n","contact":{"name":"Ben","email":"ben@freestyle.sh"},"license":{"name":""},"version":"0.1.0"},"servers":[{"url":"https://api.freestyle.sh","description":"Production"}],"paths":{"/cloudstate/v1/deploy":{"post":{"tags":["Cloudstate"],"summary":"Deploy Cloudstate Project","description":"Deploy a cloudstate project","operationId":"handle_deploy_cloudstate","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleCloudstateDeployRequest"}}},"required":true},"responses":{"200":{"description":"successfully deployed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleCloudstateDeploySuccessResponse"}}}},"500":{"description":"failed to deploy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleCloudstateDeployErrorResponse"}}}}}}},"/cloudstate/v1/projects/{id}/backup":{"get":{"tags":["Cloudstate"],"summary":"Get Backup of Cloudstate Project","description":"Get a backup of a cloudstate project","operationId":"handle_backup_cloudstate","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"successfully backed up","content":{"application/octet-stream":{"schema":{"type":"array","items":{"type":"integer","format":"int32","minimum":0}}}}},"500":{"description":"failed to backup"}}}},"/dns/v1/records":{"get":{"tags":["DNS"],"summary":"List DNS Records","operationId":"handle_list_records","parameters":[{"name":"domain","in":"query","required":true,"schema":{"type":"string"},"example":"example.com"}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListRecordsResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"post":{"tags":["DNS"],"summary":"Create DNS Record","operationId":"handle_create_record","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRecordParams"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["record"],"properties":{"record":{"$ref":"#/components/schemas/DnsRecord"}}}}}},"400":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"delete":{"tags":["DNS"],"summary":"Delete DNS Record","operationId":"handle_delete_record","parameters":[{"name":"domain","in":"query","required":true,"schema":{"type":"string"},"example":"example.com"},{"name":"record","in":"query","required":true,"schema":{"$ref":"#/components/schemas/DnsRecord"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"400":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/domains/v1/certs/{domain}/wildcard":{"post":{"tags":["Certs","Domains"],"summary":"Provision a wildcard certificate","description":"Provisions a wildcard certificate for a verified domain\n\n\nThis speeds up deploys on all subdomains of the domain. In order to use it, you must add the following record to your DNS config:\n\n`_acme-challenge.yourdomain.com` NS `dns.freestyle.sh`","operationId":"handle_verify_wildcard","parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Domain verified","content":{"application/json":{"schema":{"type":"object","required":["domain"],"properties":{"domain":{"type":"string","example":"example.com"}}}}}},"400":{"description":"Failed to preverify domain","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.provisionWildcard('example.com').then((cert) => {\n console.log(cert);\n});"}]}},"/domains/v1/domains":{"get":{"tags":["Domains"],"summary":"List domains for an account","description":"This lists the domains that an account has verified ownership of. This includes the *.style.dev domains the account has claimed.","operationId":"handle_list_domains","responses":{"200":{"description":"List of domains","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","required":["domain","createdAt"],"properties":{"domain":{"type":"string","example":"example.yourdomain.com"},"createdAt":{"type":"string","format":"date-time"}}}}}}},"400":{"description":"Failed to get domains","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.listDomains().then((response) => {\n console.log(response);\n});"}]}},"/domains/v1/mappings/{domain}":{"post":{"tags":["Domains"],"summary":"Insert Domain Mapping","description":"This will unmap any other deployment to this domain","operationId":"handle_insert_domain_mapping","parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDomainMappingRequest"}}},"required":true},"responses":{"200":{"description":"Successfully mapped domain to deployment"},"401":{"description":"You do not have permission to do this","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"422":{"description":"Failed to provision certificate","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Failed to insert ownership","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"502":{"description":"Failed to check permissions","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"delete":{"tags":["Domains"],"summary":"Remove Domain Mapping","operationId":"handle_delete_domain_mapping","parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successfully removed domain mapping to deployment"},"401":{"description":"You do not have permission to do this","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Failed to insert ownership","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"502":{"description":"Failed to check permissions","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/domains/v1/verifications":{"get":{"tags":["Domains"],"summary":"List domain verification requests for an account","description":"Lists domain verification requests for the current account.","operationId":"handle_list_domain_verification_requests","responses":{"200":{"description":"List of verification codes","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","required":["verificationCode","domain","createdAt"],"properties":{"verificationCode":{"type":"string"},"domain":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}}}}}},"400":{"description":"Failed to get verification codes","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.listDomainVerificationRequests().then((response) => {\n console.log(response);\n});"}]},"put":{"tags":["Domains"],"summary":"Verify a domain verification request","description":"This checks a pre-existing verification request for a domain. To create a verification request, call the [create domain verification](/#tag/domains/POST/domains/v1/verifications) endpoint. This endpoint will check if the domain has a TXT record with the verification code. If it does, the domain will be verified.","operationId":"handle_verify_domain","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleVerifyDomainRequest"}}},"required":true},"responses":{"200":{"description":"Domain verified","content":{"application/json":{"schema":{"type":"object","required":["domain"],"properties":{"domain":{"type":"string","example":"example.com"}}}}}},"400":{"description":"Failed to verify domain","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Domain verification request not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst api = new FreestyleSandboxes({\n apiKey: process.env.FREESTYLE_API_KEY!,\n});\n\napi\n .verifyDomain('example.com')\n .then((result) => {\n console.log('Successfully Verified Domain!');\n })\n .catch((error) => {\n console.error('Failed to verify domain: ', error);\n });"}]},"post":{"tags":["Domains"],"summary":"Create a domain verification request","description":"This creates a Freestyle Domain Verification Request. It returns a `verificationCode` for your domain. You need to place this code in a TXT record at `_freestyle_custom_hostname.thedomain.com`, then call the [verify domain](/#tag/domains/PUT/domains/v1/verifications) endpoint with the domain to verify it.","operationId":"handle_create_domain_verification","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDomainVerificationRequest"}}},"required":true},"responses":{"200":{"description":"Verification code created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainVerificationRequest"}}}},"400":{"description":"Failed to create verification code","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst api = new FreestyleSandboxes({\n apiKey: process.env.FREESTYLE_API_KEY!,\n});\n\napi.createDomainVerificationRequest('example.com').then((result) => {\n const verificationCode = result.verificationCode;\n // put this at a TXT record at _freestyle_custom_hostname.example.com\n});"}]},"delete":{"tags":["Domains"],"summary":"Delete a domain verification request","description":"This deletes a Freestyle Domain Verification Request. This does not remove the domain from the account if it has already been verified, however the verification code will no longer be valid.","operationId":"handle_delete_domain_verification","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDeleteDomainVerificationRequest"}}},"required":true},"responses":{"200":{"description":"Verification code created","content":{"application/json":{"schema":{"type":"object","required":["verificationCode","domain"],"properties":{"verificationCode":{"type":"string"},"domain":{"type":"string","example":"example.com"}}}}}},"400":{"description":"Failed to create verification code","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/ephemeral/v1/dev-servers":{"post":{"tags":["Dev Servers"],"summary":"Request a Dev Server","operationId":"handle_ephemeral_dev_server","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DevServerRequest"}}},"required":true},"responses":{"200":{"description":"Successful","content":{"application/json":{"schema":{"type":"object","required":["url","isNew","devCommandRunning","installCommandRunning"],"properties":{"url":{"type":"string","deprecated":true},"isNew":{"type":"boolean"},"devCommandRunning":{"type":"boolean"},"installCommandRunning":{"type":"boolean"},"mcpEphemeralUrl":{"type":["string","null"]},"ephemeralUrl":{"type":["string","null"]}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}}}}}},"/ephemeral/v1/dev-servers/exec":{"post":{"tags":["Dev Servers"],"summary":"Execute a command on a Dev Server","operationId":"handle_exec_on_ephemeral_dev_server","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecRequest"}}},"required":true},"responses":{"200":{"description":"Successful","content":{"application/json":{"schema":{"type":"object","required":["id","isNew"],"properties":{"id":{"type":"string"},"isNew":{"type":"boolean"},"stdout":{"type":["array","null"],"items":{"type":"string"}},"stderr":{"type":["array","null"],"items":{"type":"string"}}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}}}}}},"/ephemeral/v1/dev-servers/files/{*filepath}":{"put":{"tags":["Dev Servers"],"summary":"Write a file to a Dev Server","operationId":"handle_write_file_from_ephemeral_dev_server","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WriteFileRequest"}}},"required":true},"responses":{"200":{"description":"Successful","content":{"application/json":{"schema":{"type":"object","required":["id","isNew"],"properties":{"id":{"type":"string"},"isNew":{"type":"boolean"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}}}}},"post":{"tags":["Dev Servers"],"summary":"Read a file from a Dev Server","operationId":"handle_read_file_from_ephemeral_dev_server","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReadFileRequest"}}},"required":true},"responses":{"200":{"description":"Successful","content":{"application/json":{"schema":{"type":"object","required":["id","isNew","content"],"properties":{"id":{"type":"string"},"isNew":{"type":"boolean"},"content":{"oneOf":[{"type":"object","required":["content","encoding","kind"],"properties":{"content":{"type":"string"},"encoding":{"type":"string"},"kind":{"type":"string","enum":["file"]}}},{"type":"object","required":["files","kind"],"properties":{"files":{"type":"array","items":{"type":"string"}},"kind":{"type":"string","enum":["directory"]}}}]}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["id","isNew"],"properties":{"id":{"type":"string"},"isNew":{"type":"boolean"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}}}}}},"/ephemeral/v1/dev-servers/git/commit-push":{"post":{"tags":["Dev Servers"],"summary":"Commit and push changes to a Dev Server repository","operationId":"handle_git_commit_push","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitCommitPushRequest"}}},"required":true},"responses":{"200":{"description":"Successful","content":{"application/json":{"schema":{"type":"object","required":["id","isNew"],"properties":{"id":{"type":"string"},"isNew":{"type":"boolean"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}}}}}},"/ephemeral/v1/dev-servers/shutdown":{"post":{"tags":["Dev Servers"],"summary":"Shut down a dev server","operationId":"handle_shutdown_dev_server","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShutdownDevServerRequest"}}},"required":true},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","required":["success","message"],"properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}}}}}},"/ephemeral/v1/dev-servers/status":{"get":{"tags":["Dev Servers"],"summary":"Get the status of a Dev Server","operationId":"handle_dev_server_status","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DevServerStatusRequest"}}},"required":true},"responses":{"200":{"description":"Successful","content":{"application/json":{"schema":{"type":"object","required":["installing","devRunning"],"properties":{"installing":{"type":"boolean"},"devRunning":{"type":"boolean"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}}}}}},"/ephemeral/v1/dev-servers/watch-files":{"post":{"tags":["Dev Servers"],"operationId":"handle_watch_dev_server_files","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DevServerWatchFilesRequest"}}},"required":true},"responses":{"200":{"description":"Stream of file events","content":{"text/plain":{"schema":{"type":"string"}}}}}}},"/execute/v1/deployments":{"get":{"tags":["Execute"],"summary":"List execute runs","description":"List execute runs.","operationId":"handle_list_execute_runs","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":["integer","null"],"minimum":0}},{"name":"offset","in":"query","required":false,"schema":{"type":["integer","null"],"minimum":0}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["entries","total","offset"],"properties":{"entries":{"type":"array","items":{"$ref":"#/components/schemas/ExecuteLogEntry"}},"total":{"type":"integer","format":"int64","minimum":0},"offset":{"type":"integer","format":"int64","minimum":0}}}}}},"500":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.listExecuteRuns().then((runs) => {\n console.log(runs);\n});"}]}},"/execute/v1/deployments/{deployment}":{"get":{"tags":["Execute"],"summary":"Get information on execute run","description":"Get information on execute run","operationId":"handle_get_execute_run","parameters":[{"name":"deployment","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","required":["metadata","code"],"properties":{"metadata":{"$ref":"#/components/schemas/ExecuteLogEntry"},"code":{"$ref":"#/components/schemas/ExecuteRunInfo"}}}}}},"401":{"description":"Unauthorized access","content":{"application/json":{"schema":{"type":"object","description":"Unauthorized access","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","description":"Not found","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","description":"Internal server error","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.getExecuteRun('123e4567-e89b-12d3-a456-426614174000').then((runs) => {\n console.log(runs);\n});"}]}},"/execute/v1/script":{"post":{"tags":["Execute"],"summary":"Execute Code","description":"Send a TypeScript or JavaScript module, get the result","operationId":"handle_execute_script","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleExecuteScriptParams"}}},"required":true},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","required":["result","logs"],"properties":{"result":{"description":"The return value of the default export of the script"},"logs":{"type":"array","items":{"$ref":"#/components/schemas/FreestyleJavaScriptLog"}}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"logs":{"type":["array","null"],"items":{"$ref":"#/components/schemas/FreestyleJavaScriptLog"}}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"logs":{"type":["array","null"],"items":{"$ref":"#/components/schemas/FreestyleJavaScriptLog"}}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.executeScript(\n `export default () => {\n let set1 = [1, 2, 3, 4, 5];\n let set2 = [4, 5, 6, 7, 8];\n\n // find the sum of every value of each set multiplied by every value of the other set\n\n let sum = 0;\n for (let i = 0; i < set1.length; i++) {\n for (let j = 0; j < set2.length; j++) {\n sum += set1[i] * set2[j];\n }\n }\n\n return sum;\n};`\n);"},{"label":"Vercel AI SDK","lang":"javascript","source":"import { executeTool } from 'freestyle-sandboxes/ai';\nimport { generateText } from 'ai';\n\nconst codeExecutor = executeTool({\n apiKey: 'your-api-key',\n});\n\nconst { text, steps } = await generateText({\n model: yourModel,\n tools: {\n codeExecutor,\n },\n maxSteps: 2,\n prompt:\n 'What is the sum of every number between 1 and 12 multiplied by itself?',\n});"},{"label":"Mastra AI SDK","lang":"javascript","source":"import { executeTool } from 'freestyle-sandboxes/mastra';\n\nconst mastra = new Mastra();\n\nconst modelConfig: ModelConfig = {\n provider: 'OPEN_AI',\n name: 'gpt-4',\n};\n\nconst llm = mastra.LLM(modelConfig);\n\nconst response = await llm.generate(\n 'Calculate the sum of every number between 13 and 19 divided by the sum of every number between 8 and 13',\n {\n tools: {\n executor: executeTool({\n apiKey: process.env.FREESTYLE_API_KEY!,\n }),\n },\n }\n);\n\nconsole.log('Response Steps:', response.steps);\nconsole.log('Response:', response.text);"},{"label":"LangGraph AI SDK","lang":"javascript","source":"import { createReactAgent } from '@langchain/langgraph/prebuilt';\nimport { ChatOpenAI } from '@langchain/openai';\nimport { executeTool } from 'freestyle-sandboxes/langgraph';\n\nconst model = new ChatOpenAI({ model: 'gpt-4o' });\n\nconst agent = createReactAgent({\n llm: model,\n tools: [\n executeTool({\n apiKey: process.env.FREESTYLE_API_KEY,\n nodeModules: {\n resend: '4.0.1',\n },\n envVars: {\n RESEND_API_KEY: process.env.RESEND_API_KEY,\n },\n }),\n ],\n});\n\nconst result = await agent.invoke(\n {\n messages: [\n { role: 'user', content: 'What is the factorial of 13 divided by 55^2' },\n ],\n },\n { configurable: { thread_id: 42 } }\n);\nconsole.log(result.messages.at(-1)?.content);"},{"label":"Python SDK","lang":"python","source":"import freestyle\nimport os\n\nclient = freestyle.Freestyle(\n os.environ.get('FREESTYLE_API_KEY')\n)\n\ncodeExecutionResult = client.execute_script(\n \"\"\"\nimport Stripe from 'stripe';\nexport default async () => {\n\nconst stripe = new Stripe(process.env.STRIPE_API_KEY);\n\nconst paymentIntent = await stripe.paymentIntents.create({\n amount: 1099,\n currency: 'usd',\n payment_method_types: ['card'],\n});\n\nreturn paymentIntent;\n};\n \"\"\",\n freestyle.FreestyleExecuteScriptParamsConfiguration(\n env_vars={\"STRIPE_API_KEY\": os.environ.get(\"STRIPE_API_KEY\")},\n node_modules={\"stripe\": \"17.7.0\"},\n ),\n)\n\nprint('The payment intent created is:', codeExecutionResult)"},{"label":"Gemini Python SDK","lang":"python","source":"import google.genai as genai\nfrom google.genai import types\n\nimport os\nimport freestyle.gemini\n\nclient = genai.Client(api_key=os.environ.get(\"GENERATIVEAI_API_KEY\"))\n\n\n# model = genai.client.com(\"gemini-2.0-flash\")\ndefinition, runner = freestyle.gemini.execute_tool(\n os.environ.get(\"FREESTYLE_API_KEY\"),\n)\nchat = client.chats.create(\n model=\"gemini-2.0-flash\",\n config=types.GenerateContentConfigDict(\n tools=[definition],\n ),\n history=[],\n)\n\nresponse = chat.send_message(\n \"What is the sum of every number from 50 to 65 divided by 17\"\n).candidates[0]\ntool_result = runner(response.content)\n\nprint(\"Answer: \", tool_result)"},{"label":"OpenAI Python SDK","lang":"python","source":"import os\nimport openai\nimport freestyle.openai\n\nclient = openai.OpenAI(\n api_key=os.environ.get('OPENAI_API_KEY'),\n)\n\n\n(definition, runner) = freestyle.openai.execute_tool(\n os.environ.get('FREESTYLE_API_KEY'),\n)\n\nquery = 'What is the sum of every number from 50 to 65 divided by 17'\nmessages = [{'role': 'user', 'content': query}]\nprint('Question: ', query)\n\nres = client.chat.completions.create(\n model='gpt-4-turbo', messages=messages, tools=[definition]\n)\n\n\nresult = runner(res.choices[0].message)\n\nmessages.append(res.choices[0].message)\nif len(result) > 0:\n messages.extend(result)\n\nres = client.chat.completions.create(\n model='gpt-4-turbo',\n messages=messages,\n tools=[definition],\n)\n\nprint('Answer: ', res.choices[0].message.content)"}]}},"/git/v1/identity":{"get":{"tags":["Git"],"summary":"List Git identities","description":"List Git identities created by your account.","operationId":"handle_list_identities","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int64","minimum":0}},{"name":"offset","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int64","minimum":0}},{"name":"includeManaged","in":"query","required":false,"schema":{"type":["boolean","null"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["identities","offset","total"],"properties":{"identities":{"type":"array","items":{"$ref":"#/components/schemas/GitIdentity"}},"offset":{"type":"integer","format":"int64","minimum":0},"total":{"type":"integer","format":"int64","minimum":0}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"post":{"tags":["Git"],"summary":"Create a Git identity","description":"Create a Git identity. This identity will be used to authenticate with the Git server.","operationId":"handle_create_identity","responses":{"200":{"description":"Identity created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitIdentity"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/identity/{identity}":{"delete":{"tags":["Git"],"summary":"Delete a Git identity","description":"Delete a Git identity. This will revoke all permissions granted to this identity.","operationId":"handle_delete_identity","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Identity deleted","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Identity not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/identity/{identity}/permissions":{"get":{"tags":["Git"],"summary":"List repository permissions for an identity","description":"List repository permissions for an identity. This will return a list of repositories that the identity has access to.","operationId":"handle_list_permissions","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"limit","in":"query","description":"Maximum number of repositories to return","required":false,"schema":{"type":"integer","format":"int64","minimum":0}},{"name":"offset","in":"query","description":"Offset for the list of repositories","required":false,"schema":{"type":"integer","format":"int64","minimum":0}}],"responses":{"200":{"description":"Permission list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListPermissionResponseSuccess"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/identity/{identity}/permissions/{repo}":{"get":{"tags":["Git"],"summary":"Get the permission of an identity on a repository","description":"Get the permission of an identity on a repository. This will return the access level of the identity on the repository.","operationId":"handle_describe_permission","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"repo","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Permission info","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DescribePermissionResponseSuccess"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"post":{"tags":["Git"],"summary":"Grant a permission to a Git identity","description":"Grant a permission to a Git identity on a repository","operationId":"handle_grant_permission","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"repo","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantPermissionRequest"}}},"required":true},"responses":{"200":{"description":"Permission granted successfully","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Repository not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"delete":{"tags":["Git"],"summary":"Revoke permissions from a Git identity","description":"Revoke a permission to a Git identity on a repository","operationId":"handle_revoke_permission","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"repo","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Permission revoked successfully","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"patch":{"tags":["Git"],"summary":"Update a permission for a Git identity","description":"Update a permission for a Git identity on a repository","operationId":"handle_update_permission","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"repo","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePermissionRequest"}}},"required":true},"responses":{"200":{"description":"Permission updated successfully","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/identity/{identity}/tokens":{"get":{"tags":["Git"],"summary":"List access tokens for a Git identity","description":"List access tokens for a Git identity","operationId":"handle_list_git_tokens","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Token list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListGitTokensResponseSuccess"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"post":{"tags":["Git"],"summary":"Create an access token for a Git identity","description":"Create an access token for a Git identity","operationId":"handle_create_git_token","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Token created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatedToken"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"delete":{"tags":["Git"],"summary":"Revoke an access token for a Git identity","description":"Revoke an access token for a Git identity","operationId":"handle_revoke_git_token","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevokeGitTokenRequest"}}},"required":true},"responses":{"200":{"description":"Token revoked","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo":{"get":{"tags":["Git"],"summary":"List repositories","description":"List repositories with metadata.","operationId":"handle_list_repositories","parameters":[{"name":"limit","in":"query","description":"Maximum number of repositories to return","required":false,"schema":{"type":"integer","format":"int64","minimum":0}},{"name":"offset","in":"query","description":"Offset for the list of repositories","required":false,"schema":{"type":"integer","format":"int64","minimum":0}}],"responses":{"200":{"description":"List of repositories","content":{"application/json":{"schema":{"type":"object","required":["repositories","total","offset"],"properties":{"repositories":{"type":"array","items":{"$ref":"#/components/schemas/RepositoryMetadata"}},"total":{"type":"integer","format":"int64","minimum":0},"offset":{"type":"integer","format":"int64","minimum":0}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"post":{"tags":["Git"],"summary":"Create a repository","description":"Create a repository. Once the repository is created, it will also be created on the Git server.\nThe repository name must be unique within your account.\n\nOnce created, you can then push your code to this repository.\n\nThe repo will be available at `git.freestyle.sh/{repo-id}`\n","operationId":"handle_create_repo","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":["string","null"],"description":"This name is not visible to users, and is only accessible to you via API and in the\ndashboard. Mostly useful for observability."},"public":{"type":"boolean","default":false},"defaultBranch":{"type":["string","null"],"description":"The default branch name for the repository. Defaults to \"main\" if not specified."},"source":{"$ref":"#/components/schemas/CreateRepoSource"},"import":{"$ref":"#/components/schemas/CreateRepoImport"}}}}},"required":true},"responses":{"200":{"description":"Repository created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRepositoryResponseSuccess"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo_id}/default-branch":{"get":{"tags":["Git"],"summary":"Get repository default branch","description":"Get the default branch name for a repository.","operationId":"handle_get_default_branch","parameters":[{"name":"repo_id","in":"path","description":"The repository ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetDefaultBranchResponse"}}}}}},"put":{"tags":["Git"],"summary":"Set repository default branch","description":"Set the default branch name for a repository. This will update the HEAD reference to point to the new default branch.","operationId":"handle_set_default_branch","parameters":[{"name":"repo_id","in":"path","description":"The repository ID","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetDefaultBranchRequest"}}},"required":true},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetDefaultBranchResponse"}}}}}}},"/git/v1/repo/{repo_id}/github-sync":{"get":{"tags":["Git"],"summary":"Get GitHub sync configuration","description":"Get the GitHub sync configuration for a repository, if configured.","operationId":"get_github_sync","parameters":[{"name":"repo_id","in":"path","description":"Repository ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"GitHub sync configuration","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GithubSyncConfigResponse"}}}},"404":{"description":"Repository or sync configuration not found"},"500":{"description":"Internal server error"}}},"post":{"tags":["Git"],"summary":"Configure GitHub sync for repository","description":"Configure GitHub synchronization for an existing Freestyle repository. This links your Freestyle repository to a GitHub repository for automatic syncing. Requires the GitHub repository name in 'owner/repo' format.","operationId":"configure_github_sync","parameters":[{"name":"repo_id","in":"path","description":"Repository ID","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfigureGithubSyncRequest"}}},"required":true},"responses":{"200":{"description":"GitHub sync configured successfully"},"400":{"description":"Bad request"},"404":{"description":"Repository not found"},"500":{"description":"Internal server error"}}},"delete":{"tags":["Git"],"summary":"Remove GitHub sync configuration","description":"Remove GitHub sync configuration from a repository. This stops automatic syncing but doesn't affect the repository content.","operationId":"remove_github_sync","parameters":[{"name":"repo_id","in":"path","description":"Repository ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"GitHub sync configuration removed successfully"},"404":{"description":"Repository or sync configuration not found"},"500":{"description":"Internal server error"}}}},"/git/v1/repo/{repo}":{"delete":{"tags":["Git"],"summary":"Delete a repository","description":"Delete a repository. This is irreversible, and will also delete the repository on the Git server.","operationId":"handle_delete_repo","parameters":[{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Repository deleted successfully","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"User does not have permission to delete this repository","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Repository does not exist","content":{"application/json":{"schema":{"type":"object"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}/contents/{*path}":{"get":{"tags":["Git"],"summary":"Get the contents of a file or directory","description":"Get the contents of a file or directory in a repository","operationId":"handle_get_contents","parameters":[{"name":"ref","in":"query","description":"The git reference (branch name, commit SHA, etc.). Defaults to HEAD.","required":false,"schema":{"type":"string"}},{"name":"repo","in":"path","description":"The repository ID.","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"*path","in":"path","description":"The path to the file or directory. Empty for root.","required":true,"schema":{"type":["string","null"]}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitContents"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}/git/blobs/{hash}":{"get":{"tags":["Git"],"summary":"Get a blob object","description":"Get a blob from the Git database. The contents will always be base64 encoded.","operationId":"handle_get_blob","parameters":[{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Blob retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlobObject"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Blob not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}/git/commits/{hash}":{"get":{"tags":["Git"],"summary":"Get a commit object","description":"Get a commit from the Git database with detailed information.","operationId":"handle_get_commit","parameters":[{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"hash","in":"path","description":"The object's hash","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Commit retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommitObject"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Commit not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}/git/refs/heads/{*branch}":{"get":{"tags":["Git"],"summary":"Get a branch reference","description":"Get a reference to a branch in the Git repository. Returns the ref name and SHA of the branch.","operationId":"handle_get_ref_branch","parameters":[{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"branch","in":"path","description":"The branch's name","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Branch reference object","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitReference"}}}},"400":{"description":"Bad request"},"401":{"description":"Unauthorized","content":{"application/json":{}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Branch not found","content":{"application/json":{}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}/git/refs/tags/{*tag}":{"get":{"tags":["Git"],"summary":"Get a tag reference","description":"Get a reference to a tag in the Git repository. Returns the ref name and SHA of the tag.","operationId":"handle_get_ref_tag","parameters":[{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"tag","in":"path","description":"The tag's name","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Branch reference object","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitReference"}}}},"400":{"description":"Bad request"},"401":{"description":"Unauthorized","content":{"application/json":{}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Branch not found","content":{"application/json":{}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}/git/tags/{hash}":{"get":{"tags":["Git"],"summary":"Get a tag object","description":"Get a tag from the Git database.","operationId":"handle_get_tag","parameters":[{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"hash","in":"path","description":"The object's hash","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Tag retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagObject"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Tag not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}/git/trees/{hash}":{"get":{"tags":["Git"],"summary":"Get a tree object","description":"Get a tree from the Git database with its entries.","operationId":"handle_get_tree","parameters":[{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"hash","in":"path","description":"The object's hash","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Tree retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TreeObject"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Tree not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}/tarball":{"get":{"tags":["Git"],"summary":"Download a tarball of a repo.","description":"Download the contents of a repo as a tarball.","operationId":"handle_download_tarball","parameters":[{"name":"ref","in":"query","description":"The git reference (branch name, commit SHA, etc.). Defaults to HEAD.","required":false,"schema":{"type":"string"}},{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success (byte stream)","content":{"application/x-tar":{}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}/trigger":{"get":{"tags":["Git"],"summary":"List git triggers for a repository","description":"List git triggers for the given repository.","operationId":"handle_list_git_triggers","parameters":[{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","required":["triggers"],"properties":{"triggers":{"type":"array","items":{"$ref":"#/components/schemas/GitRepositoryTrigger"}}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"User does not have permission to access this repository","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Repository does not exist","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"post":{"tags":["Git"],"summary":"Create a git trigger","description":"Create a git trigger for the given repository.","operationId":"handle_create_git_trigger","parameters":[{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["trigger","action"],"properties":{"trigger":{"oneOf":[{"type":"object","required":["event"],"properties":{"branches":{"type":["array","null"],"items":{"type":"string"}},"globs":{"type":["array","null"],"items":{"type":"string"}},"event":{"type":"string","enum":["push"]}}}]},"action":{"oneOf":[{"type":"object","required":["endpoint","action"],"properties":{"endpoint":{"type":"string"},"action":{"type":"string","enum":["webhook"]}}}]}}}}},"required":true},"responses":{"200":{"description":"Trigger created successfully","content":{"application/json":{"schema":{"type":"object","required":["triggerId"],"properties":{"triggerId":{"type":"string","format":"uuid"}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"User does not have permission to create a trigger on this repository","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Repository does not exist","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}/trigger/{trigger}":{"delete":{"tags":["Git"],"summary":"Delete a git trigger","description":"Delete a git trigger. This is irreversible.","operationId":"handle_delete_git_trigger","parameters":[{"name":"trigger","in":"path","description":"The trigger id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Trigger deleted successfully","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"User does not have permission to delete a trigger on this repository","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Trigger does not exist","content":{"application/json":{"schema":{"type":"object"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}/zip":{"get":{"tags":["Git"],"summary":"Download a zip of a repo","description":"Download the contents of a repo as a zip.","operationId":"handle_download_zip","parameters":[{"name":"ref","in":"query","description":"The git reference (branch name, commit SHA, etc.). Defaults to HEAD.","required":false,"schema":{"type":"string"}},{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success (byte stream)","content":{"application/zip":{}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/observability/v1/logs":{"get":{"tags":["Observability"],"summary":"Deployment Logs","description":"Get the logs for a deployment","operationId":"handle_get_logs","parameters":[{"name":"deploymentId","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"domain","in":"query","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleGetLogsResponse"}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.getLogs({\n deploymentId: 'deployment-id',\n}).then((response) => {\n console.log(response);\n});"}]}},"/web/v1/deploy":{"post":{"tags":["Deprecated"],"summary":"Deploy a Website (v1)","description":"Deploy a website. Files is a map of file paths to file contents. Configuration is optional and contains additional information about the deployment.","operationId":"handle_deploy_web","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDeployWebPayload"}}},"required":true},"responses":{"200":{"description":"successfully deployed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDeployWebSuccessResponseV2"}}}},"400":{"description":"failed to deploy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDeployWebErrorResponse"}}}}},"deprecated":true,"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\nimport 'dotenv/config';\n\nconst api = new FreestyleSandboxes({\n apiKey: process.env.FREESTYLE_API_KEY!,\n});\n\napi\n .deployWeb({\n 'index.js': {\n content:`\n import http from 'node:http';\n console.log('starting server');\n\n const server = http.createServer(async(req, res) => {\n // wait 5 seconds before responding\n // await new Promise((resolve) => setTimeout(resolve, 5000));\n res.writeHead(200, { 'Content-Type': 'text/plain' });\n res.end('Welcome to New York its been waiting for you');\n });\n\n server.listen(3000, () => {\n console.log('Server is running at http://localhost:3000');\n });`,\n }})\n .then((result) => {\n console.log('Deployed website @ ', result.deploymentId);\n });\n"},{"label":"Vercel AI SDK","lang":"javascript","source":"import { deployWebTool } from 'freestyle-sandboxes/ai';\nimport { generateText } from 'ai';\n\nconst deployer = deployWebTool({\n apiKey: 'your-api-key',\n});\n\nconst { text, steps } = await generateText({\n model: yourModel,\n tools: {\n deployer,\n },\n maxSteps: 2,\n prompt:\n 'Deploy a website to subdomain.yourdomain.com that has all the lyrics to Sandstorm by Darude on the homepage',\n});"}]}},"/web/v1/deployment":{"post":{"tags":["Web"],"summary":"Deploy a Website","description":"Deploy a website. Files is a map of file paths to file contents. Configuration is optional and contains additional information about the deployment.","operationId":"handle_deploy_web_v2","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDeployWebPayloadV2"}}},"required":true},"responses":{"200":{"description":"successfully deployed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDeployWebSuccessResponseV2"}}}},"400":{"description":"failed to deploy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDeployWebErrorResponse"}}}}}}},"/web/v1/deployments":{"get":{"tags":["Web"],"summary":"List web deploys","description":"List web deploys.","operationId":"handle_list_web_deploys","parameters":[{"name":"limit","in":"query","description":"Maximum number of repositories to return","required":true,"schema":{"type":"integer","format":"int64","minimum":0}},{"name":"offset","in":"query","description":"Offset for the list of repositories","required":true,"schema":{"type":"integer","format":"int64","minimum":0}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["entries","total","offset"],"properties":{"entries":{"type":"array","items":{"$ref":"#/components/schemas/DeploymentLogEntry"}},"total":{"type":"integer","format":"int64","minimum":0},"offset":{"type":"integer","format":"int64","minimum":0}}}}}},"500":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.listWebDeploys().then((response) => {\n console.log(response);\n});"}]}},"/web/v1/deployments/deployment/{deployment_id}":{"get":{"tags":["Web"],"summary":"Get information on web deploy","description":"Get information about a web deploy by its ID.","operationId":"handle_get_web_deploy_details","parameters":[{"name":"deployment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{}}}},"components":{"schemas":{"AccessLevel":{"type":"string","enum":["read","write"]},"AccessTokenInfo":{"type":"object","required":["id"],"properties":{"id":{"type":"string","format":"uuid"}}},"AccessibleRepository":{"type":"object","description":"Identical to [`RepositoryInfo`], but with the permissions field added.","required":["id","accountId","permissions","visibility"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":["string","null"]},"accountId":{"type":"string","format":"uuid"},"permissions":{"$ref":"#/components/schemas/AccessLevel"},"visibility":{"$ref":"#/components/schemas/Visibility"}}},"Behavior":{"type":"string","default":"exact","enum":["regex","exact"]},"BlobEncoding":{"type":"string","description":"The encoding of a blob from the API. Always `base64`.","enum":["base64"]},"BlobObject":{"type":"object","description":"Blob object","required":["content","encoding","sha"],"properties":{"content":{"type":"string","description":"The content of the blob, base64 encoded."},"encoding":{"$ref":"#/components/schemas/BlobEncoding","description":"The encoding of the blob. Always `base64`."},"sha":{"type":"string","description":"The object's hash."}}},"BranchDetails":{"type":"object","required":["default","name"],"properties":{"default":{"type":"boolean"},"name":{"type":"string"},"target":{"type":["string","null"]}}},"CommitObject":{"type":"object","description":"Commit object","required":["author","committer","message","tree","parents","sha"],"properties":{"author":{"$ref":"#/components/schemas/Signature","description":"The author of the commit"},"committer":{"$ref":"#/components/schemas/Signature","description":"The committer"},"message":{"type":"string","description":"The commit message"},"tree":{"$ref":"#/components/schemas/CommitTree","description":"The ID of the tree pointed to by this commit"},"parents":{"type":"array","items":{"$ref":"#/components/schemas/CommitParent"},"description":"Parent commit(s) of this commit"},"sha":{"type":"string","description":"The commit's hash ID"}}},"CommitParent":{"type":"object","required":["sha"],"properties":{"sha":{"type":"string","description":"The commit's hash ID"}}},"CommitTree":{"type":"object","required":["sha"],"properties":{"sha":{"type":"string","description":"The tree's hash ID"}}},"ConfigureGithubSyncRequest":{"type":"object","required":["githubRepoName"],"properties":{"githubRepoName":{"type":"string","description":"The GitHub repository name in \"owner/repo\" format"}}},"CreateDomainMappingRequest":{"type":"object","required":["deploymentId"],"properties":{"deploymentId":{"type":"string","format":"uuid"}}},"CreateRecordParams":{"type":"object","required":["domain","record"],"properties":{"domain":{"type":"string"},"record":{"$ref":"#/components/schemas/DnsRecordData"}}},"CreateRepoImport":{"oneOf":[{"type":"object","title":"Files","required":["files","commit_message","type"],"properties":{"files":{"type":"object","additionalProperties":{"type":"string"},"propertyNames":{"type":"string"}},"commit_message":{"type":"string"},"author_name":{"type":["string","null"]},"author_email":{"type":["string","null"]},"type":{"type":"string","enum":["files"]}}},{"type":"object","title":"Tar","required":["url","commit_message","type"],"properties":{"url":{"type":"string","format":"uri"},"dir":{"type":["string","null"]},"commit_message":{"type":"string"},"author_name":{"type":["string","null"]},"author_email":{"type":["string","null"]},"type":{"type":"string","enum":["tar"]}}},{"type":"object","title":"Zip","required":["url","commit_message","type"],"properties":{"url":{"type":"string","format":"uri"},"dir":{"type":["string","null"]},"commit_message":{"type":"string"},"author_name":{"type":["string","null"]},"author_email":{"type":["string","null"]},"type":{"type":"string","enum":["zip"]}}},{"type":"object","title":"Git","required":["url","commit_message","type"],"properties":{"url":{"type":"string","format":"uri"},"branch":{"type":["string","null"]},"dir":{"type":["string","null"]},"commit_message":{"type":"string"},"author_name":{"type":["string","null"]},"author_email":{"type":["string","null"]},"type":{"type":"string","enum":["git"]}}}]},"CreateRepoRequest":{"type":"object","properties":{"source":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/CreateRepoSource"}]},"import":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/CreateRepoImport"}]},"defaultBranch":{"type":["string","null"]}}},"CreateRepoSource":{"oneOf":[{"type":"object","title":"Source","required":["url","type"],"properties":{"url":{"type":"string","format":"uri"},"branch":{"type":["string","null"]},"depth":{"type":["integer","null"],"format":"int32"},"type":{"type":"string","enum":["git"]}}}]},"CreateRepositoryRequest":{"type":"object","properties":{"name":{"type":["string","null"],"description":"This name is not visible to users, and is only accessible to you via API and in the\ndashboard. Mostly useful for observability."},"public":{"type":"boolean","default":false},"defaultBranch":{"type":["string","null"],"description":"The default branch name for the repository. Defaults to \"main\" if not specified."},"source":{"$ref":"#/components/schemas/CreateRepoSource"},"import":{"$ref":"#/components/schemas/CreateRepoImport"}}},"CreateRepositoryResponseSuccess":{"type":"object","required":["repoId"],"properties":{"repoId":{"type":"string","format":"uuid"}}},"CreatedToken":{"type":"object","required":["id","token"],"properties":{"id":{"type":"string","format":"uuid"},"token":{"type":"string"}}},"CustomBuildOptions":{"type":"object","properties":{"command":{"type":["string","null"]},"envVars":{"type":["object","null"],"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"}},"outDir":{"type":["string","null"]}}},"DeploymentBuildOptions":{"oneOf":[{"oneOf":[{"$ref":"#/components/schemas/CustomBuildOptions"}],"title":"Custom"},{"type":"boolean","title":"Enabled"}]},"DeploymentLogEntry":{"type":"object","required":["deploymentId","accountId","provisionedAt","timeout","state","domains","envVars"],"properties":{"deploymentId":{"type":"string","format":"uuid"},"accountId":{"type":"string","format":"uuid"},"provisionedAt":{"type":"string","format":"date-time"},"timeout":{"type":"string"},"state":{"$ref":"#/components/schemas/DeploymentState"},"deployedAt":{"type":["string","null"],"format":"date-time"},"domains":{"type":"array","items":{"type":"string"}},"envVars":{"type":"object","additionalProperties":{"type":"string"},"propertyNames":{"type":"string"}}}},"DeploymentSource":{"oneOf":[{"type":"object","title":"Files","required":["files","kind"],"properties":{"files":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/FreestyleFile"},"propertyNames":{"type":"string"}},"kind":{"type":"string","enum":["files"]}}},{"type":"object","title":"Tar","required":["url","kind"],"properties":{"url":{"type":"string"},"kind":{"type":"string","enum":["tar"]}}},{"type":"object","title":"Git","description":"`dir` is the Directory to deploy from. If not provided, the root of the repository will be used.","required":["url","kind"],"properties":{"url":{"type":"string"},"branch":{"type":["string","null"],"example":"main"},"dir":{"type":["string","null"],"example":"dist"},"kind":{"type":"string","enum":["git"]}}}]},"DeploymentState":{"type":"string","enum":["provisioning","deployed","failed"]},"DescribePermissionResponseSuccess":{"type":"object","required":["identity","repo"],"properties":{"identity":{"type":"string","format":"uuid"},"repo":{"type":"string","format":"uuid"},"accessLevel":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/AccessLevel"}]}}},"DevServer":{"oneOf":[{"type":"object","required":["repoId","kind"],"properties":{"repoId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["repo"]}}}]},"DevServerRequest":{"type":"object","properties":{"devCommand":{"type":["string","null"]},"preDevCommandOnce":{"type":["string","null"]},"baseId":{"type":["string","null"],"example":"vite-skdjfls"},"envVars":{"type":["object","null"],"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"},"example":{"RESEND_API_KEY":"re_123456789"}},"repoId":{"type":["string","null"]},"computeClass":{"type":["string","null"],"default":"high","example":"low"},"timeout":{"type":["integer","null"],"format":"int64","description":"Timeout in seconds","example":"30","minimum":0},"domain":{"type":["string","null"],"deprecated":true},"repo":{"type":["string","null"],"deprecated":true}}},"DevServerStatusRequest":{"type":"object","required":["devServer"],"properties":{"devServer":{"$ref":"#/components/schemas/DevServer"}}},"DevServerWatchFilesRequest":{"type":"object","required":["devServer"],"properties":{"devServer":{"$ref":"#/components/schemas/DevServer"}}},"DnsRecord":{"type":"object","required":["kind","name","value","ttl","managed"],"properties":{"kind":{"$ref":"#/components/schemas/DnsRecordKind"},"name":{"type":"string"},"value":{"type":"string"},"ttl":{"type":"string"},"priority":{"type":["integer","null"],"format":"int32","minimum":0},"managed":{"type":"boolean"}}},"DnsRecordData":{"type":"object","required":["kind","name","value"],"properties":{"kind":{"$ref":"#/components/schemas/DnsRecordKind"},"name":{"type":"string"},"value":{"type":"string"},"ttl":{"type":["string","null"]},"priority":{"type":["integer","null"],"format":"int32","minimum":0}}},"DnsRecordKind":{"type":"string","enum":["A","AAAA","CNAME","TXT","NS"]},"DomainVerificationRequest":{"type":"object","required":["id","domain","accountId","verificationCode","createdAt"],"properties":{"id":{"type":"string","format":"uuid","example":"1234-5678-9012-3456"},"domain":{"type":"string","example":"example.com"},"accountId":{"type":"string","format":"uuid","example":"1234-5678-9012-3456"},"verificationCode":{"type":"string","example":"freestyle-verification-v1-1234-5678-9012-3456"},"createdAt":{"type":"string","format":"date-time","example":"1234567890"}}},"ExecRequest":{"type":"object","required":["devServer","command","background"],"properties":{"devServer":{"$ref":"#/components/schemas/DevServer"},"command":{"type":"string"},"background":{"type":"boolean","description":"Spawn this command as a background process and return immediately"}}},"ExecuteLogEntry":{"type":"object","required":["deployment","accountId","provisionedAt","state","envVars"],"properties":{"deployment":{"type":"string","format":"uuid"},"accountId":{"type":"string","format":"uuid"},"provisionedAt":{"type":"string","format":"date-time"},"startedAt":{"type":["string","null"],"format":"date-time"},"duration":{"type":["string","null"]},"state":{"$ref":"#/components/schemas/ExecuteRunState"},"envVars":{"type":"object","additionalProperties":{"type":"string"},"propertyNames":{"type":"string"}}}},"ExecuteRunInfo":{"type":"object","required":["code","nodeModules"],"properties":{"code":{"type":"string"},"nodeModules":{"type":"object","additionalProperties":{"type":"string"},"propertyNames":{"type":"string"}}}},"ExecuteRunState":{"type":"string","enum":["starting","running","complete"]},"FileReadContent":{"oneOf":[{"type":"object","required":["content","encoding","kind"],"properties":{"content":{"type":"string"},"encoding":{"type":"string"},"kind":{"type":"string","enum":["file"]}}},{"type":"object","required":["files","kind"],"properties":{"files":{"type":"array","items":{"type":"string"}},"kind":{"type":"string","enum":["directory"]}}}]},"FreestyleCloudstateDeployConfiguration":{"type":"object","properties":{"domains":{"type":["array","null"],"items":{"type":"string"},"description":"ID of the project to deploy, if not provided will create a new project","default":null},"envVars":{"type":"object","description":"The environment variables that the cloudstate deploy can access","default":{},"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"}},"cloudstateDatabaseId":{"type":["string","null"],"format":"uuid","default":null}}},"FreestyleCloudstateDeployErrorResponse":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}},"FreestyleCloudstateDeployRequest":{"type":"object","required":["classes"],"properties":{"classes":{"type":"string"},"config":{"$ref":"#/components/schemas/FreestyleCloudstateDeployConfiguration"}}},"FreestyleCloudstateDeploySuccessResponse":{"type":"object","required":["deploymentId","cloudstateDatabaseId"],"properties":{"deploymentId":{"type":"string","format":"uuid"},"cloudstateDatabaseId":{"type":"string","format":"uuid"}}},"FreestyleDeleteDomainVerificationRequest":{"type":"object","required":["domain","verificationCode"],"properties":{"domain":{"type":"string","description":"The domain to create a verification code for","example":"example.com"},"verificationCode":{"type":"string","description":"The verification code"}}},"FreestyleDeployWebConfiguration":{"type":"object","properties":{"entrypoint":{"type":["string","null"],"description":"The entrypoint file for the website","default":"index.js"},"domains":{"type":["array","null"],"items":{"type":"string"},"description":"The custom domains for the website, eg. [\\\"subdomain.yourwebsite.com\\\"]. You may include a single *.style.dev domain here.","example":["subdomain.yourdomain.com"],"default":null},"projectId":{"type":["string","null"],"description":"Project ID was our original way of tracking deployments together, it is now deprecated and will be removed in the future. Please use the domains field to specify the domains for your project.","default":null,"deprecated":true},"nodeModules":{"type":["object","null"],"description":"Node Modules to install for the website, a map of package names to versions, e.g. { \\\"express\\\": \\\"4.17.1\\\" }. If this and a package-lock.json are provided, the package-lock.json, bun.lockb, pnpm-lock.yaml, or yarn.lock is also provided, the versions here will override the versions in those lock files.","default":null,"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"},"example":{"resend":"4.0.1"}},"envVars":{"type":["object","null"],"description":"The environment variables that the website can access\ne.g. { \\\"RESEND_API_KEY\\\": \\\"re_123456789\\\" }","default":null,"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"},"example":{"RESEND_API_KEY":"re_123456789"}},"serverStartCheck":{"type":"boolean","default":false},"networkPermissions":{"type":["array","null"],"items":{"$ref":"#/components/schemas/FreestyleNetworkPermission"},"default":null},"build":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/DeploymentBuildOptions"}],"default":null},"timeout":{"type":["integer","null"],"format":"int64","description":"Timeout for the deployment in seconds. If not provided, the default is 10 seconds.","default":null,"example":"15","minimum":0}}},"FreestyleDeployWebErrorResponse":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}},"FreestyleDeployWebPayload":{"type":"object","required":["files"],"properties":{"files":{"type":"object","description":"The files to deploy, a map of file paths to file contents, e.g. { \\\"index.js\\\": {\\\"content\\\": \\\"your main\\\", \\\"encoding\\\": \\\"utf-8\\\"}, \\\"file2.js\\\": {\\\"content\\\": \\\"your helper\\\" } }\n\n**Do not include node modules in this bundle, they will not work**. Instead, includes a package-lock.json, bun.lockb, pnpm-lock.yaml, or yarn.lock, the node modules for the project will be installed from that lock file, or use the node_modules field in the configuration to specify the node modules to install.","additionalProperties":{"$ref":"#/components/schemas/FreestyleFile"},"propertyNames":{"type":"string"},"example":{"index.js":{"content":"import http from 'node:http';\\n// import { resolver } from './file2.js';\\n\\nconsole.log('starting server');\\n\\nconst server = http.createServer(async(req, res) => {\\n // wait 5 seconds before responding\\n // await new Promise((resolve) => setTimeout(resolve, 5000));\\n res.writeHead(200, { 'Content-Type': 'text/plain' });\\n res.end('Welcome to New York its been waiting for you');\\n});\\n\\nserver.listen(3000, () => {\\n console.log('Server is running at http://localhost:3000');\\n});"}}},"config":{"$ref":"#/components/schemas/FreestyleDeployWebConfiguration"}}},"FreestyleDeployWebPayloadV2":{"type":"object","required":["source"],"properties":{"source":{"$ref":"#/components/schemas/DeploymentSource","description":"The files to deploy, a map of file paths to file contents, e.g. { \\\"index.js\\\": {\\\"content\\\": \\\"your main\\\", \\\"encoding\\\": \\\"utf-8\\\"}, \\\"file2.js\\\": {\\\"content\\\": \\\"your helper\\\" } }\n\n**Do not include node modules in this bundle, they will not work**. Instead, includes a package-lock.json, bun.lockb, pnpm-lock.yaml, or yarn.lock, the node modules for the project will be installed from that lock file, or use the node_modules field in the configuration to specify the node modules to install."},"config":{"$ref":"#/components/schemas/FreestyleDeployWebConfiguration"}}},"FreestyleDeployWebSuccessResponseV2":{"type":"object","required":["deploymentId","projectId","entrypoint"],"properties":{"deploymentId":{"type":"string","format":"uuid"},"projectId":{"type":"string","format":"uuid","deprecated":true},"domains":{"type":["array","null"],"items":{"type":"string"}},"entrypoint":{"type":"string","description":"The entrypoint file for the website. If not specified we try to automatically detect it."}}},"FreestyleDomainVerificationRequest":{"type":"object","required":["domain"],"properties":{"domain":{"type":"string","description":"The domain to create a verification code for","example":"example.com"}}},"FreestyleExecuteScriptParams":{"type":"object","required":["script"],"properties":{"script":{"type":"string","description":"The JavaScript or TypeScript script to execute","example":"export default () => {\n // get the value of the factorials of the numbers from 1 to 10 combined\n const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];\n\n function factorial(n) {\n if (n === 0) {\n return 1;\n }\n return n * factorial(n - 1);\n }\n\n const b = a.map(factorial);\n\n return b.reduce((a, b) => a + b);\n};\n"},"config":{"$ref":"#/components/schemas/FreestyleExecuteScriptParamsConfiguration"}}},"FreestyleExecuteScriptParamsConfiguration":{"type":"object","properties":{"envVars":{"type":"object","description":"The environment variables to set for the script","default":{},"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"},"example":{"RESEND_API_KEY":"re_123456789"}},"nodeModules":{"type":"object","description":"The node modules to install for the script","default":{},"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"},"example":{"resend":"4.0.1"}},"tags":{"type":"array","items":{"type":"string"},"description":"Tags for you to organize your scripts, useful for tracking what you're running","example":["email"],"default":[]},"timeout":{"type":["integer","null"],"format":"int32","description":"The script timeout","default":null,"minimum":0},"peerDependencyResolution":{"type":"boolean","description":"If false, we'll not resolve peer dependencies for the packages given, this can speed up execute performance, but will break packages with peers unless the peers are manually specified.","default":true},"networkPermissions":{"type":["array","null"],"items":{"$ref":"#/components/schemas/FreestyleNetworkPermission"},"default":null},"customHeaders":{"type":"object","description":"These headers will be added to every fetch request made through the script","default":{},"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"}},"proxy":{"type":["string","null"],"description":"Proxy all outgoing requests through this URL","default":null,"example":"https://aproxyyouown.com"}}},"FreestyleExecuteScriptResultSuccess":{"type":"object","required":["result","logs"],"properties":{"result":{"description":"The return value of the default export of the script"},"logs":{"type":"array","items":{"$ref":"#/components/schemas/FreestyleJavaScriptLog"}}}},"FreestyleFile":{"type":"object","required":["content"],"properties":{"content":{"type":"string","description":"The content of the file"},"encoding":{"type":"string","description":"The encoding of the file. Either **utf-8** or **base64**"}}},"FreestyleGetLogsResponse":{"type":"object","required":["logs"],"properties":{"logs":{"type":"array","items":{"$ref":"#/components/schemas/FreestyleLogResponseObject"}}}},"FreestyleJavaScriptLog":{"type":"object","required":["message","type"],"properties":{"message":{"type":"string","description":"The log message","example":"I'm a log!"},"type":{"type":"string","description":"The log level","example":"log"}}},"FreestyleLogResponseObject":{"type":"object","required":["message","timestamp"],"properties":{"message":{"type":"string"},"timestamp":{"type":"string"}}},"FreestyleNetworkPermission":{"oneOf":[{"allOf":[{"$ref":"#/components/schemas/NetworkPermissionData"},{"type":"object","required":["action"],"properties":{"action":{"type":"string","enum":["allow"]}}}]},{"allOf":[{"$ref":"#/components/schemas/NetworkPermissionData"},{"type":"object","required":["action"],"properties":{"action":{"type":"string","enum":["deny"]}}}]}]},"FreestyleVerifyDomainRequest":{"oneOf":[{"type":"object","required":["domain"],"properties":{"domain":{"type":"string","example":"example.com"}}},{"type":"object","required":["id"],"properties":{"id":{"type":"string","format":"uuid","example":"1234-5678-9012-3456"}}}],"description":"Verify a domain verification request, can either be done for a domain, or for a specific request"},"GetDefaultBranchResponse":{"type":"object","required":["defaultBranch"],"properties":{"defaultBranch":{"type":"string"}}},"GitCommitPushRequest":{"type":"object","required":["devServer","message"],"properties":{"devServer":{"$ref":"#/components/schemas/DevServer"},"message":{"type":"string"}}},"GitContents":{"oneOf":[{"type":"object","title":"File","required":["name","path","sha","size","content","type"],"properties":{"name":{"type":"string"},"path":{"type":"string"},"sha":{"type":"string","description":"The hash / object ID of the file."},"size":{"type":"integer","format":"int64","minimum":0},"content":{"type":"string","description":"Base64-encoded content."},"type":{"type":"string","enum":["file"]}}},{"type":"object","title":"Directory","required":["name","path","sha","entries","type"],"properties":{"name":{"type":"string"},"path":{"type":"string"},"sha":{"type":"string","description":"The hash / object ID of the directory."},"entries":{"type":"array","items":{"$ref":"#/components/schemas/GitContentsDirEntryItem"}},"type":{"type":"string","enum":["dir"]}}}]},"GitContentsDirEntryItem":{"oneOf":[{"type":"object","title":"File Entry","required":["name","path","sha","size","type"],"properties":{"name":{"type":"string"},"path":{"type":"string"},"sha":{"type":"string","description":"The hash / object ID of the file."},"size":{"type":"integer","format":"int64","minimum":0},"type":{"type":"string","enum":["file"]}}},{"type":"object","title":"Directory Entry","description":"Directory","required":["name","path","sha","entries","type"],"properties":{"name":{"type":"string"},"path":{"type":"string"},"sha":{"type":"string","description":"The hash / object ID of the directory."},"entries":{"type":"array","items":{"oneOf":[{"type":"object","title":"File Entry"},{"type":"object","title":"Dir Entry (recursive)"}]}},"type":{"type":"string","enum":["dir"]}}}]},"GitIdentity":{"type":"object","required":["id","managed"],"properties":{"id":{"type":"string","format":"uuid"},"managed":{"type":"boolean"}}},"GitReference":{"type":"object","description":"A reference to a Git object","required":["name","sha"],"properties":{"name":{"type":"string","description":"The name of the ref (e.g., \"refs/heads/main\" or \"refs/tags/v1.0.0\")"},"sha":{"type":"string","description":"The SHA-1 hash of the Git object this reference points to"}}},"GitRepositoryTrigger":{"type":"object","required":["repositoryId","trigger","action","managed","id","createdAt"],"properties":{"repositoryId":{"type":"string","format":"uuid"},"trigger":{"oneOf":[{"type":"object","required":["event"],"properties":{"branches":{"type":["array","null"],"items":{"type":"string"}},"globs":{"type":["array","null"],"items":{"type":"string"}},"event":{"type":"string","enum":["push"]}}}]},"action":{"oneOf":[{"type":"object","required":["endpoint","action"],"properties":{"endpoint":{"type":"string"},"action":{"type":"string","enum":["webhook"]}}}]},"managed":{"type":"boolean"},"id":{"type":"string","format":"uuid"},"createdAt":{"type":"string","format":"date-time"}}},"GitTrigger":{"oneOf":[{"type":"object","required":["event"],"properties":{"branches":{"type":["array","null"],"items":{"type":"string"}},"globs":{"type":["array","null"],"items":{"type":"string"}},"event":{"type":"string","enum":["push"]}}}]},"GitTriggerAction":{"oneOf":[{"type":"object","required":["endpoint","action"],"properties":{"endpoint":{"type":"string"},"action":{"type":"string","enum":["webhook"]}}}]},"GithubRepoSyncConfig":{"type":"object","required":["freestyleRepoId","accountId","installationId","githubRepoId","githubRepoName","createdAt"],"properties":{"freestyleRepoId":{"type":"string","format":"uuid"},"accountId":{"type":"string","format":"uuid"},"installationId":{"type":"integer","format":"int64"},"githubRepoId":{"type":"integer","format":"int64"},"githubRepoName":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}},"GithubSyncConfigResponse":{"type":"object","required":["githubRepoName"],"properties":{"githubRepoName":{"type":"string"}}},"GrantPermissionRequest":{"type":"object","required":["permission"],"properties":{"permission":{"$ref":"#/components/schemas/AccessLevel"}}},"InternalServerError":{"type":"string"},"ListGitTokensResponseSuccess":{"type":"object","required":["tokens"],"properties":{"tokens":{"type":"array","items":{"$ref":"#/components/schemas/AccessTokenInfo"}}}},"ListPermissionResponseSuccess":{"type":"object","required":["repositories"],"properties":{"repositories":{"type":"array","items":{"$ref":"#/components/schemas/AccessibleRepository"}}}},"ListRecordsResponse":{"type":"object","required":["records"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/DnsRecord"}}}},"NetworkPermissionData":{"type":"object","required":["query"],"properties":{"query":{"type":"string"},"behavior":{"$ref":"#/components/schemas/Behavior"}}},"ReadFileEphemeralDevServerResponses":{"oneOf":[{"type":"object","required":["id","isNew","content"],"properties":{"id":{"type":"string"},"isNew":{"type":"boolean"},"content":{"oneOf":[{"type":"object","required":["content","encoding","kind"],"properties":{"content":{"type":"string"},"encoding":{"type":"string"},"kind":{"type":"string","enum":["file"]}}},{"type":"object","required":["files","kind"],"properties":{"files":{"type":"array","items":{"type":"string"}},"kind":{"type":"string","enum":["directory"]}}}]}}},{"type":"object","required":["id","isNew"],"properties":{"id":{"type":"string"},"isNew":{"type":"boolean"}}},{"$ref":"#/components/schemas/InternalServerError"}]},"ReadFileRequest":{"type":"object","required":["devServer"],"properties":{"devServer":{"$ref":"#/components/schemas/DevServer"},"encoding":{"type":"string","default":"utf-8"}}},"RepositoryInfo":{"type":"object","required":["id","accountId","visibility","defaultBranch"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":["string","null"],"examples":["my-repo"]},"accountId":{"type":"string","format":"uuid"},"visibility":{"$ref":"#/components/schemas/Visibility"},"defaultBranch":{"type":"string"}}},"RepositoryMetadata":{"type":"object","required":["branches","tags","defaultBranch"],"properties":{"branches":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/BranchDetails"},"propertyNames":{"type":"string"}},"tags":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/TagDetails"},"propertyNames":{"type":"string"}},"defaultBranch":{"type":"string"}}},"RevokeGitTokenRequest":{"type":"object","required":["tokenId"],"properties":{"tokenId":{"type":"string","format":"uuid"}}},"SetDefaultBranchRequest":{"type":"object","required":["defaultBranch"],"properties":{"defaultBranch":{"type":"string"}}},"SetDefaultBranchResponse":{"type":"object"},"ShutdownDevServerRequest":{"type":"object","required":["devServer"],"properties":{"devServer":{"$ref":"#/components/schemas/DevServer","description":"The dev server to shutdown"}}},"Signature":{"type":"object","required":["date","name","email"],"properties":{"date":{"type":"string","format":"date-time","description":"The date marker for this signature"},"name":{"type":"string"},"email":{"type":"string"}}},"TagDetails":{"type":"object","required":["name","target"],"properties":{"name":{"type":"string"},"target":{"type":"string"},"message":{"type":["string","null"]}}},"TagObject":{"type":"object","description":"Tag object","required":["name","target","sha"],"properties":{"name":{"type":"string","description":"The tag name"},"tagger":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/Signature","description":"The tagger who created the tag"}]},"message":{"type":["string","null"],"description":"The tag message"},"target":{"$ref":"#/components/schemas/TagTarget","description":"The object this tag points to"},"sha":{"type":"string","description":"The tag's hash ID"}}},"TagTarget":{"type":"object","required":["sha"],"properties":{"sha":{"type":"string","description":"The target object's hash ID"}}},"TreeEntry":{"oneOf":[{"type":"object","title":"Blob","required":["path","sha","type"],"properties":{"path":{"type":"string"},"sha":{"type":"string"},"type":{"type":"string","enum":["blob"]}}},{"type":"object","title":"Tree","required":["path","sha","type"],"properties":{"path":{"type":"string"},"sha":{"type":"string"},"type":{"type":"string","enum":["tree"]}}}]},"TreeObject":{"type":"object","description":"Tree object","required":["tree","sha"],"properties":{"tree":{"type":"array","items":{"$ref":"#/components/schemas/TreeEntry"},"description":"The tree's entries"},"sha":{"type":"string","description":"The tree's hash ID"}}},"UpdatePermissionRequest":{"type":"object","required":["permission"],"properties":{"permission":{"$ref":"#/components/schemas/AccessLevel"}}},"Visibility":{"type":"string","enum":["public","private"]},"WriteFileRequest":{"type":"object","required":["devServer","content"],"properties":{"devServer":{"$ref":"#/components/schemas/DevServer"},"content":{"type":"string"},"encoding":{"type":"string","default":"utf-8"}}}},"responses":{"FreestyleExecuteScriptResultSuccess":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["result","logs"],"properties":{"result":{"description":"The return value of the default export of the script"},"logs":{"type":"array","items":{"$ref":"#/components/schemas/FreestyleJavaScriptLog"}}}}}}}},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"tags":[{"name":"Web","description":"APIs for deploying websites. We handle node modules caching, scaling, certificates and the whole end to end process. Send the code using the [deploy](#tag/web/POST/web/v1/deploy) endpoint, and you'll get a full hosted website back. Works with any TypeScript or JavaScript codebase."},{"name":"Execute","description":"APIs for running code. Send the code using the [execute](#tag/execute/POST/execute/v1/execute) endpoint, and you'll get the output back. Works with any TypeScript or JavaScript code + handles any node modules and environment variables you want."},{"name":"Cloudstate","description":"APIs for running cloud functions with persistent state. [Cloudstate](https://github.com/freestyle-sh/cloudstate/) is an opensource, durable JavaScript runtime maintained by the Freestyle Team."},{"name":"Domains","description":"APIs for managing domains. This is only relevant when you want to start to deploy to custom domains. \nPlease read [this guide](https://github.com/freestyle-sh/sandbox_sdks/blob/main/docs/custom_domains.md) to understand how deployments work with custom domains."},{"name":"Git","description":"APIs for managing git repositories and accessing git objects like commits, trees, blobs, tags, and refs."},{"name":"DNS","description":"APIs for managing DNS records. WIP."}]}
|
|
1
|
+
{"openapi":"3.1.0","info":{"title":"Freestyle Sandboxes","description":"\nFreestyle Sandboxes lets you deploy your users or AIs code. **Get your API Key at [admin.freestyle.sh](https://admin.freestyle.sh)**\n\nThey are broken up into core 5 categories: [Web](#tag/web), [Execute](#tag/execute), [Cloudstate](#tag/cloudstate), [Git](#tag/git), and [Domains](#tag/domains).\n\n[Web](#tag/web): Send us the code for the website, we'll provision the certificates and get it hosted\n\n[Execute](#tag/execute): Send us a function, we'll run it and send you the output\n\n[Cloudstate](#tag/cloudstate): Our Opensource JavaScript Runtime used for cloud functions with persistent state\n\n[Domains](#tag/domains): Manage your domains, including verification and listing\n\n[Git](#tag/git): Manage your git repositories\n","contact":{"name":"Ben","email":"ben@freestyle.sh"},"license":{"name":""},"version":"0.1.0"},"servers":[{"url":"https://api.freestyle.sh","description":"Production"}],"paths":{"/cloudstate/v1/deploy":{"post":{"tags":["Cloudstate"],"summary":"Deploy Cloudstate Project","description":"Deploy a cloudstate project","operationId":"handle_deploy_cloudstate","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleCloudstateDeployRequest"}}},"required":true},"responses":{"200":{"description":"successfully deployed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleCloudstateDeploySuccessResponse"}}}},"500":{"description":"failed to deploy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleCloudstateDeployErrorResponse"}}}}}}},"/cloudstate/v1/projects/{id}/backup":{"get":{"tags":["Cloudstate"],"summary":"Get Backup of Cloudstate Project","description":"Get a backup of a cloudstate project","operationId":"handle_backup_cloudstate","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"successfully backed up","content":{"application/octet-stream":{"schema":{"type":"array","items":{"type":"integer","format":"int32","minimum":0}}}}},"500":{"description":"failed to backup"}}}},"/dns/v1/records":{"get":{"tags":["DNS"],"summary":"List DNS Records","operationId":"handle_list_records","parameters":[{"name":"domain","in":"query","required":true,"schema":{"type":"string"},"example":"example.com"}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListRecordsResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"post":{"tags":["DNS"],"summary":"Create DNS Record","operationId":"handle_create_record","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRecordParams"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["record"],"properties":{"record":{"$ref":"#/components/schemas/DnsRecord"}}}}}},"400":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"delete":{"tags":["DNS"],"summary":"Delete DNS Record","operationId":"handle_delete_record","parameters":[{"name":"domain","in":"query","required":true,"schema":{"type":"string"},"example":"example.com"},{"name":"record","in":"query","required":true,"schema":{"$ref":"#/components/schemas/DnsRecord"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"400":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/domains/v1/certs/{domain}/wildcard":{"post":{"tags":["Certs","Domains"],"summary":"Provision a wildcard certificate","description":"Provisions a wildcard certificate for a verified domain\n\n\nThis speeds up deploys on all subdomains of the domain. In order to use it, you must add the following record to your DNS config:\n\n`_acme-challenge.yourdomain.com` NS `dns.freestyle.sh`","operationId":"handle_verify_wildcard","parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Domain verified","content":{"application/json":{"schema":{"type":"object","required":["domain"],"properties":{"domain":{"type":"string","example":"example.com"}}}}}},"400":{"description":"Failed to preverify domain","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.provisionWildcard('example.com').then((cert) => {\n console.log(cert);\n});"}]}},"/domains/v1/domains":{"get":{"tags":["Domains"],"summary":"List domains for an account","description":"This lists the domains that an account has verified ownership of. This includes the *.style.dev domains the account has claimed.","operationId":"handle_list_domains","responses":{"200":{"description":"List of domains","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","required":["domain","createdAt"],"properties":{"domain":{"type":"string","example":"example.yourdomain.com"},"createdAt":{"type":"string","format":"date-time"}}}}}}},"400":{"description":"Failed to get domains","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.listDomains().then((response) => {\n console.log(response);\n});"}]}},"/domains/v1/mappings/{domain}":{"post":{"tags":["Domains"],"summary":"Insert Domain Mapping","description":"This will unmap any other deployment to this domain","operationId":"handle_insert_domain_mapping","parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDomainMappingRequest"}}},"required":true},"responses":{"200":{"description":"Successfully mapped domain to deployment"},"401":{"description":"You do not have permission to do this","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"422":{"description":"Failed to provision certificate","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Failed to insert ownership","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"502":{"description":"Failed to check permissions","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"delete":{"tags":["Domains"],"summary":"Remove Domain Mapping","operationId":"handle_delete_domain_mapping","parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successfully removed domain mapping to deployment"},"401":{"description":"You do not have permission to do this","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Failed to insert ownership","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"502":{"description":"Failed to check permissions","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/domains/v1/verifications":{"get":{"tags":["Domains"],"summary":"List domain verification requests for an account","description":"Lists domain verification requests for the current account.","operationId":"handle_list_domain_verification_requests","responses":{"200":{"description":"List of verification codes","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","required":["verificationCode","domain","createdAt"],"properties":{"verificationCode":{"type":"string"},"domain":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}}}}}},"400":{"description":"Failed to get verification codes","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.listDomainVerificationRequests().then((response) => {\n console.log(response);\n});"}]},"put":{"tags":["Domains"],"summary":"Verify a domain verification request","description":"This checks a pre-existing verification request for a domain. To create a verification request, call the [create domain verification](/#tag/domains/POST/domains/v1/verifications) endpoint. This endpoint will check if the domain has a TXT record with the verification code. If it does, the domain will be verified.","operationId":"handle_verify_domain","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleVerifyDomainRequest"}}},"required":true},"responses":{"200":{"description":"Domain verified","content":{"application/json":{"schema":{"type":"object","required":["domain"],"properties":{"domain":{"type":"string","example":"example.com"}}}}}},"400":{"description":"Failed to verify domain","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Domain verification request not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst api = new FreestyleSandboxes({\n apiKey: process.env.FREESTYLE_API_KEY!,\n});\n\napi\n .verifyDomain('example.com')\n .then((result) => {\n console.log('Successfully Verified Domain!');\n })\n .catch((error) => {\n console.error('Failed to verify domain: ', error);\n });"}]},"post":{"tags":["Domains"],"summary":"Create a domain verification request","description":"This creates a Freestyle Domain Verification Request. It returns a `verificationCode` for your domain. You need to place this code in a TXT record at `_freestyle_custom_hostname.thedomain.com`, then call the [verify domain](/#tag/domains/PUT/domains/v1/verifications) endpoint with the domain to verify it.","operationId":"handle_create_domain_verification","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDomainVerificationRequest"}}},"required":true},"responses":{"200":{"description":"Verification code created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainVerificationRequest"}}}},"400":{"description":"Failed to create verification code","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst api = new FreestyleSandboxes({\n apiKey: process.env.FREESTYLE_API_KEY!,\n});\n\napi.createDomainVerificationRequest('example.com').then((result) => {\n const verificationCode = result.verificationCode;\n // put this at a TXT record at _freestyle_custom_hostname.example.com\n});"}]},"delete":{"tags":["Domains"],"summary":"Delete a domain verification request","description":"This deletes a Freestyle Domain Verification Request. This does not remove the domain from the account if it has already been verified, however the verification code will no longer be valid.","operationId":"handle_delete_domain_verification","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDeleteDomainVerificationRequest"}}},"required":true},"responses":{"200":{"description":"Verification code created","content":{"application/json":{"schema":{"type":"object","required":["verificationCode","domain"],"properties":{"verificationCode":{"type":"string"},"domain":{"type":"string","example":"example.com"}}}}}},"400":{"description":"Failed to create verification code","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/ephemeral/v1/dev-servers":{"post":{"tags":["Dev Servers"],"summary":"Request a Dev Server","operationId":"handle_ephemeral_dev_server","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DevServerRequest"}}},"required":true},"responses":{"200":{"description":"Successful","content":{"application/json":{"schema":{"type":"object","required":["url","isNew","devCommandRunning","installCommandRunning"],"properties":{"url":{"type":"string","deprecated":true},"isNew":{"type":"boolean"},"devCommandRunning":{"type":"boolean"},"installCommandRunning":{"type":"boolean"},"mcpEphemeralUrl":{"type":["string","null"]},"ephemeralUrl":{"type":["string","null"]}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}}}}}},"/ephemeral/v1/dev-servers/exec":{"post":{"tags":["Dev Servers"],"summary":"Execute a command on a Dev Server","operationId":"handle_exec_on_ephemeral_dev_server","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecRequest"}}},"required":true},"responses":{"200":{"description":"Successful","content":{"application/json":{"schema":{"type":"object","required":["id","isNew"],"properties":{"id":{"type":"string"},"isNew":{"type":"boolean"},"stdout":{"type":["array","null"],"items":{"type":"string"}},"stderr":{"type":["array","null"],"items":{"type":"string"}}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}}}}}},"/ephemeral/v1/dev-servers/files/{*filepath}":{"put":{"tags":["Dev Servers"],"summary":"Write a file to a Dev Server","operationId":"handle_write_file_from_ephemeral_dev_server","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WriteFileRequest"}}},"required":true},"responses":{"200":{"description":"Successful","content":{"application/json":{"schema":{"type":"object","required":["id","isNew"],"properties":{"id":{"type":"string"},"isNew":{"type":"boolean"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}}}}},"post":{"tags":["Dev Servers"],"summary":"Read a file from a Dev Server","operationId":"handle_read_file_from_ephemeral_dev_server","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReadFileRequest"}}},"required":true},"responses":{"200":{"description":"Successful","content":{"application/json":{"schema":{"type":"object","required":["id","isNew","content"],"properties":{"id":{"type":"string"},"isNew":{"type":"boolean"},"content":{"oneOf":[{"type":"object","required":["content","encoding","kind"],"properties":{"content":{"type":"string"},"encoding":{"type":"string"},"kind":{"type":"string","enum":["file"]}}},{"type":"object","required":["files","kind"],"properties":{"files":{"type":"array","items":{"type":"string"}},"kind":{"type":"string","enum":["directory"]}}}]}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["id","isNew"],"properties":{"id":{"type":"string"},"isNew":{"type":"boolean"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}}}}}},"/ephemeral/v1/dev-servers/git/commit-push":{"post":{"tags":["Dev Servers"],"summary":"Commit and push changes to a Dev Server repository","operationId":"handle_git_commit_push","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitCommitPushRequest"}}},"required":true},"responses":{"200":{"description":"Successful","content":{"application/json":{"schema":{"type":"object","required":["id","isNew"],"properties":{"id":{"type":"string"},"isNew":{"type":"boolean"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}}}}}},"/ephemeral/v1/dev-servers/shutdown":{"post":{"tags":["Dev Servers"],"summary":"Shut down a dev server","operationId":"handle_shutdown_dev_server","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShutdownDevServerRequest"}}},"required":true},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","required":["success","message"],"properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}}}}}},"/ephemeral/v1/dev-servers/status":{"get":{"tags":["Dev Servers"],"summary":"Get the status of a Dev Server","operationId":"handle_dev_server_status","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DevServerStatusRequest"}}},"required":true},"responses":{"200":{"description":"Successful","content":{"application/json":{"schema":{"type":"object","required":["installing","devRunning"],"properties":{"installing":{"type":"boolean"},"devRunning":{"type":"boolean"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}}}}}},"/ephemeral/v1/dev-servers/watch-files":{"post":{"tags":["Dev Servers"],"operationId":"handle_watch_dev_server_files","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DevServerWatchFilesRequest"}}},"required":true},"responses":{"200":{"description":"Stream of file events","content":{"text/plain":{"schema":{"type":"string"}}}}}}},"/execute/v1/deployments":{"get":{"tags":["Execute"],"summary":"List execute runs","description":"List execute runs.","operationId":"handle_list_execute_runs","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":["integer","null"],"minimum":0}},{"name":"offset","in":"query","required":false,"schema":{"type":["integer","null"],"minimum":0}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["entries","total","offset"],"properties":{"entries":{"type":"array","items":{"$ref":"#/components/schemas/ExecuteLogEntry"}},"total":{"type":"integer","format":"int64","minimum":0},"offset":{"type":"integer","format":"int64","minimum":0}}}}}},"500":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.listExecuteRuns().then((runs) => {\n console.log(runs);\n});"}]}},"/execute/v1/deployments/{deployment}":{"get":{"tags":["Execute"],"summary":"Get information on execute run","description":"Get information on execute run","operationId":"handle_get_execute_run","parameters":[{"name":"deployment","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","required":["metadata","code"],"properties":{"metadata":{"$ref":"#/components/schemas/ExecuteLogEntry"},"code":{"$ref":"#/components/schemas/ExecuteRunInfo"}}}}}},"401":{"description":"Unauthorized access","content":{"application/json":{"schema":{"type":"object","description":"Unauthorized access","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","description":"Not found","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","description":"Internal server error","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.getExecuteRun('123e4567-e89b-12d3-a456-426614174000').then((runs) => {\n console.log(runs);\n});"}]}},"/execute/v1/script":{"post":{"tags":["Execute"],"summary":"Execute Code","description":"Send a TypeScript or JavaScript module, get the result","operationId":"handle_execute_script","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleExecuteScriptParams"}}},"required":true},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","required":["result","logs"],"properties":{"result":{"description":"The return value of the default export of the script"},"logs":{"type":"array","items":{"$ref":"#/components/schemas/FreestyleJavaScriptLog"}}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"logs":{"type":["array","null"],"items":{"$ref":"#/components/schemas/FreestyleJavaScriptLog"}}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"logs":{"type":["array","null"],"items":{"$ref":"#/components/schemas/FreestyleJavaScriptLog"}}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.executeScript(\n `export default () => {\n let set1 = [1, 2, 3, 4, 5];\n let set2 = [4, 5, 6, 7, 8];\n\n // find the sum of every value of each set multiplied by every value of the other set\n\n let sum = 0;\n for (let i = 0; i < set1.length; i++) {\n for (let j = 0; j < set2.length; j++) {\n sum += set1[i] * set2[j];\n }\n }\n\n return sum;\n};`\n);"},{"label":"Vercel AI SDK","lang":"javascript","source":"import { executeTool } from 'freestyle-sandboxes/ai';\nimport { generateText } from 'ai';\n\nconst codeExecutor = executeTool({\n apiKey: 'your-api-key',\n});\n\nconst { text, steps } = await generateText({\n model: yourModel,\n tools: {\n codeExecutor,\n },\n maxSteps: 2,\n prompt:\n 'What is the sum of every number between 1 and 12 multiplied by itself?',\n});"},{"label":"Mastra AI SDK","lang":"javascript","source":"import { executeTool } from 'freestyle-sandboxes/mastra';\n\nconst mastra = new Mastra();\n\nconst modelConfig: ModelConfig = {\n provider: 'OPEN_AI',\n name: 'gpt-4',\n};\n\nconst llm = mastra.LLM(modelConfig);\n\nconst response = await llm.generate(\n 'Calculate the sum of every number between 13 and 19 divided by the sum of every number between 8 and 13',\n {\n tools: {\n executor: executeTool({\n apiKey: process.env.FREESTYLE_API_KEY!,\n }),\n },\n }\n);\n\nconsole.log('Response Steps:', response.steps);\nconsole.log('Response:', response.text);"},{"label":"LangGraph AI SDK","lang":"javascript","source":"import { createReactAgent } from '@langchain/langgraph/prebuilt';\nimport { ChatOpenAI } from '@langchain/openai';\nimport { executeTool } from 'freestyle-sandboxes/langgraph';\n\nconst model = new ChatOpenAI({ model: 'gpt-4o' });\n\nconst agent = createReactAgent({\n llm: model,\n tools: [\n executeTool({\n apiKey: process.env.FREESTYLE_API_KEY,\n nodeModules: {\n resend: '4.0.1',\n },\n envVars: {\n RESEND_API_KEY: process.env.RESEND_API_KEY,\n },\n }),\n ],\n});\n\nconst result = await agent.invoke(\n {\n messages: [\n { role: 'user', content: 'What is the factorial of 13 divided by 55^2' },\n ],\n },\n { configurable: { thread_id: 42 } }\n);\nconsole.log(result.messages.at(-1)?.content);"},{"label":"Python SDK","lang":"python","source":"import freestyle\nimport os\n\nclient = freestyle.Freestyle(\n os.environ.get('FREESTYLE_API_KEY')\n)\n\ncodeExecutionResult = client.execute_script(\n \"\"\"\nimport Stripe from 'stripe';\nexport default async () => {\n\nconst stripe = new Stripe(process.env.STRIPE_API_KEY);\n\nconst paymentIntent = await stripe.paymentIntents.create({\n amount: 1099,\n currency: 'usd',\n payment_method_types: ['card'],\n});\n\nreturn paymentIntent;\n};\n \"\"\",\n freestyle.FreestyleExecuteScriptParamsConfiguration(\n env_vars={\"STRIPE_API_KEY\": os.environ.get(\"STRIPE_API_KEY\")},\n node_modules={\"stripe\": \"17.7.0\"},\n ),\n)\n\nprint('The payment intent created is:', codeExecutionResult)"},{"label":"Gemini Python SDK","lang":"python","source":"import google.genai as genai\nfrom google.genai import types\n\nimport os\nimport freestyle.gemini\n\nclient = genai.Client(api_key=os.environ.get(\"GENERATIVEAI_API_KEY\"))\n\n\n# model = genai.client.com(\"gemini-2.0-flash\")\ndefinition, runner = freestyle.gemini.execute_tool(\n os.environ.get(\"FREESTYLE_API_KEY\"),\n)\nchat = client.chats.create(\n model=\"gemini-2.0-flash\",\n config=types.GenerateContentConfigDict(\n tools=[definition],\n ),\n history=[],\n)\n\nresponse = chat.send_message(\n \"What is the sum of every number from 50 to 65 divided by 17\"\n).candidates[0]\ntool_result = runner(response.content)\n\nprint(\"Answer: \", tool_result)"},{"label":"OpenAI Python SDK","lang":"python","source":"import os\nimport openai\nimport freestyle.openai\n\nclient = openai.OpenAI(\n api_key=os.environ.get('OPENAI_API_KEY'),\n)\n\n\n(definition, runner) = freestyle.openai.execute_tool(\n os.environ.get('FREESTYLE_API_KEY'),\n)\n\nquery = 'What is the sum of every number from 50 to 65 divided by 17'\nmessages = [{'role': 'user', 'content': query}]\nprint('Question: ', query)\n\nres = client.chat.completions.create(\n model='gpt-4-turbo', messages=messages, tools=[definition]\n)\n\n\nresult = runner(res.choices[0].message)\n\nmessages.append(res.choices[0].message)\nif len(result) > 0:\n messages.extend(result)\n\nres = client.chat.completions.create(\n model='gpt-4-turbo',\n messages=messages,\n tools=[definition],\n)\n\nprint('Answer: ', res.choices[0].message.content)"}]}},"/git/v1/identity":{"get":{"tags":["Git"],"summary":"List Git identities","description":"List Git identities created by your account.","operationId":"handle_list_identities","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int64","minimum":0}},{"name":"offset","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int64","minimum":0}},{"name":"includeManaged","in":"query","required":false,"schema":{"type":["boolean","null"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["identities","offset","total"],"properties":{"identities":{"type":"array","items":{"$ref":"#/components/schemas/GitIdentity"}},"offset":{"type":"integer","format":"int64","minimum":0},"total":{"type":"integer","format":"int64","minimum":0}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"post":{"tags":["Git"],"summary":"Create a Git identity","description":"Create a Git identity. This identity will be used to authenticate with the Git server.","operationId":"handle_create_identity","responses":{"200":{"description":"Identity created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitIdentity"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/identity/{identity}":{"delete":{"tags":["Git"],"summary":"Delete a Git identity","description":"Delete a Git identity. This will revoke all permissions granted to this identity.","operationId":"handle_delete_identity","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Identity deleted","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Identity not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/identity/{identity}/permissions":{"get":{"tags":["Git"],"summary":"List repository permissions for an identity","description":"List repository permissions for an identity. This will return a list of repositories that the identity has access to.","operationId":"handle_list_permissions","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"limit","in":"query","description":"Maximum number of repositories to return","required":false,"schema":{"type":"integer","format":"int64","minimum":0}},{"name":"offset","in":"query","description":"Offset for the list of repositories","required":false,"schema":{"type":"integer","format":"int64","minimum":0}}],"responses":{"200":{"description":"Permission list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListPermissionResponseSuccess"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/identity/{identity}/permissions/{repo}":{"get":{"tags":["Git"],"summary":"Get the permission of an identity on a repository","description":"Get the permission of an identity on a repository. This will return the access level of the identity on the repository.","operationId":"handle_describe_permission","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"repo","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Permission info","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DescribePermissionResponseSuccess"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"post":{"tags":["Git"],"summary":"Grant a permission to a Git identity","description":"Grant a permission to a Git identity on a repository","operationId":"handle_grant_permission","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"repo","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantPermissionRequest"}}},"required":true},"responses":{"200":{"description":"Permission granted successfully","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Repository not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"delete":{"tags":["Git"],"summary":"Revoke permissions from a Git identity","description":"Revoke a permission to a Git identity on a repository","operationId":"handle_revoke_permission","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"repo","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Permission revoked successfully","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"patch":{"tags":["Git"],"summary":"Update a permission for a Git identity","description":"Update a permission for a Git identity on a repository","operationId":"handle_update_permission","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"repo","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePermissionRequest"}}},"required":true},"responses":{"200":{"description":"Permission updated successfully","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/identity/{identity}/tokens":{"get":{"tags":["Git"],"summary":"List access tokens for a Git identity","description":"List access tokens for a Git identity","operationId":"handle_list_git_tokens","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Token list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListGitTokensResponseSuccess"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"post":{"tags":["Git"],"summary":"Create an access token for a Git identity","description":"Create an access token for a Git identity","operationId":"handle_create_git_token","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Token created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatedToken"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"delete":{"tags":["Git"],"summary":"Revoke an access token for a Git identity","description":"Revoke an access token for a Git identity","operationId":"handle_revoke_git_token","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevokeGitTokenRequest"}}},"required":true},"responses":{"200":{"description":"Token revoked","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo":{"get":{"tags":["Git"],"summary":"List repositories","description":"List repositories with metadata.","operationId":"handle_list_repositories","parameters":[{"name":"limit","in":"query","description":"Maximum number of repositories to return","required":false,"schema":{"type":"integer","format":"int64","minimum":0}},{"name":"offset","in":"query","description":"Offset for the list of repositories","required":false,"schema":{"type":"integer","format":"int64","minimum":0}}],"responses":{"200":{"description":"List of repositories","content":{"application/json":{"schema":{"type":"object","required":["repositories","total","offset"],"properties":{"repositories":{"type":"array","items":{"$ref":"#/components/schemas/RepositoryMetadata"}},"total":{"type":"integer","format":"int64","minimum":0},"offset":{"type":"integer","format":"int64","minimum":0}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"post":{"tags":["Git"],"summary":"Create a repository","description":"Create a repository. Once the repository is created, it will also be created on the Git server.\nThe repository name must be unique within your account.\n\nOnce created, you can then push your code to this repository.\n\nThe repo will be available at `git.freestyle.sh/{repo-id}`\n","operationId":"handle_create_repo","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":["string","null"],"description":"This name is not visible to users, and is only accessible to you via API and in the\ndashboard. Mostly useful for observability."},"public":{"type":"boolean","default":false},"defaultBranch":{"type":["string","null"],"description":"The default branch name for the repository. Defaults to \"main\" if not specified."},"source":{"$ref":"#/components/schemas/CreateRepoSource"},"import":{"$ref":"#/components/schemas/CreateRepoImport"}}}}},"required":true},"responses":{"200":{"description":"Repository created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRepositoryResponseSuccess"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo_id}/default-branch":{"get":{"tags":["Git"],"summary":"Get repository default branch","description":"Get the default branch name for a repository.","operationId":"handle_get_default_branch","parameters":[{"name":"repo_id","in":"path","description":"The repository ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetDefaultBranchResponse"}}}}}},"put":{"tags":["Git"],"summary":"Set repository default branch","description":"Set the default branch name for a repository. This will update the HEAD reference to point to the new default branch.","operationId":"handle_set_default_branch","parameters":[{"name":"repo_id","in":"path","description":"The repository ID","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetDefaultBranchRequest"}}},"required":true},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetDefaultBranchResponse"}}}}}}},"/git/v1/repo/{repo_id}/github-sync":{"get":{"tags":["Git"],"summary":"Get GitHub sync configuration","description":"Get the GitHub sync configuration for a repository, if configured.","operationId":"get_github_sync","parameters":[{"name":"repo_id","in":"path","description":"Repository ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"GitHub sync configuration","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GithubSyncConfigResponse"}}}},"404":{"description":"Repository or sync configuration not found"},"500":{"description":"Internal server error"}}},"post":{"tags":["Git"],"summary":"Configure GitHub sync for repository","description":"Configure GitHub synchronization for an existing Freestyle repository. This links your Freestyle repository to a GitHub repository for automatic syncing. Requires the GitHub repository name in 'owner/repo' format.","operationId":"configure_github_sync","parameters":[{"name":"repo_id","in":"path","description":"Repository ID","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfigureGithubSyncRequest"}}},"required":true},"responses":{"200":{"description":"GitHub sync configured successfully"},"400":{"description":"Bad request"},"404":{"description":"Repository not found"},"500":{"description":"Internal server error"}}},"delete":{"tags":["Git"],"summary":"Remove GitHub sync configuration","description":"Remove GitHub sync configuration from a repository. This stops automatic syncing but doesn't affect the repository content.","operationId":"remove_github_sync","parameters":[{"name":"repo_id","in":"path","description":"Repository ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"GitHub sync configuration removed successfully"},"404":{"description":"Repository or sync configuration not found"},"500":{"description":"Internal server error"}}}},"/git/v1/repo/{repo}":{"delete":{"tags":["Git"],"summary":"Delete a repository","description":"Delete a repository. This is irreversible, and will also delete the repository on the Git server.","operationId":"handle_delete_repo","parameters":[{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Repository deleted successfully","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"User does not have permission to delete this repository","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Repository does not exist","content":{"application/json":{"schema":{"type":"object"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}/contents/{*path}":{"get":{"tags":["Git"],"summary":"Get the contents of a file or directory","description":"Get the contents of a file or directory in a repository","operationId":"handle_get_contents","parameters":[{"name":"ref","in":"query","description":"The git reference (branch name, commit SHA, etc.). Defaults to HEAD.","required":false,"schema":{"type":"string"}},{"name":"repo","in":"path","description":"The repository ID.","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"*path","in":"path","description":"The path to the file or directory. Empty for root.","required":true,"schema":{"type":["string","null"]}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitContents"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}/git/blobs/{hash}":{"get":{"tags":["Git"],"summary":"Get a blob object","description":"Get a blob from the Git database. The contents will always be base64 encoded.","operationId":"handle_get_blob","parameters":[{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Blob retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlobObject"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Blob not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}/git/commits/{hash}":{"get":{"tags":["Git"],"summary":"Get a commit object","description":"Get a commit from the Git database with detailed information.","operationId":"handle_get_commit","parameters":[{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"hash","in":"path","description":"The object's hash","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Commit retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommitObject"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Commit not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}/git/refs/heads/{*branch}":{"get":{"tags":["Git"],"summary":"Get a branch reference","description":"Get a reference to a branch in the Git repository. Returns the ref name and SHA of the branch.","operationId":"handle_get_ref_branch","parameters":[{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"branch","in":"path","description":"The branch's name","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Branch reference object","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitReference"}}}},"400":{"description":"Bad request"},"401":{"description":"Unauthorized","content":{"application/json":{}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Branch not found","content":{"application/json":{}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}/git/refs/tags/{*tag}":{"get":{"tags":["Git"],"summary":"Get a tag reference","description":"Get a reference to a tag in the Git repository. Returns the ref name and SHA of the tag.","operationId":"handle_get_ref_tag","parameters":[{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"tag","in":"path","description":"The tag's name","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Branch reference object","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitReference"}}}},"400":{"description":"Bad request"},"401":{"description":"Unauthorized","content":{"application/json":{}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Branch not found","content":{"application/json":{}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}/git/tags/{hash}":{"get":{"tags":["Git"],"summary":"Get a tag object","description":"Get a tag from the Git database.","operationId":"handle_get_tag","parameters":[{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"hash","in":"path","description":"The object's hash","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Tag retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagObject"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Tag not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}/git/trees/{hash}":{"get":{"tags":["Git"],"summary":"Get a tree object","description":"Get a tree from the Git database with its entries.","operationId":"handle_get_tree","parameters":[{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"hash","in":"path","description":"The object's hash","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Tree retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TreeObject"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Tree not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}/tarball":{"get":{"tags":["Git"],"summary":"Download a tarball of a repo.","description":"Download the contents of a repo as a tarball.","operationId":"handle_download_tarball","parameters":[{"name":"ref","in":"query","description":"The git reference (branch name, commit SHA, etc.). Defaults to HEAD.","required":false,"schema":{"type":"string"}},{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success (byte stream)","content":{"application/x-tar":{}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}/trigger":{"get":{"tags":["Git"],"summary":"List git triggers for a repository","description":"List git triggers for the given repository.","operationId":"handle_list_git_triggers","parameters":[{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","required":["triggers"],"properties":{"triggers":{"type":"array","items":{"$ref":"#/components/schemas/GitRepositoryTrigger"}}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"User does not have permission to access this repository","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Repository does not exist","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"post":{"tags":["Git"],"summary":"Create a git trigger","description":"Create a git trigger for the given repository.","operationId":"handle_create_git_trigger","parameters":[{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["trigger","action"],"properties":{"trigger":{"oneOf":[{"type":"object","required":["event"],"properties":{"branches":{"type":["array","null"],"items":{"type":"string"}},"globs":{"type":["array","null"],"items":{"type":"string"}},"event":{"type":"string","enum":["push"]}}}]},"action":{"oneOf":[{"type":"object","required":["endpoint","action"],"properties":{"endpoint":{"type":"string"},"action":{"type":"string","enum":["webhook"]}}}]}}}}},"required":true},"responses":{"200":{"description":"Trigger created successfully","content":{"application/json":{"schema":{"type":"object","required":["triggerId"],"properties":{"triggerId":{"type":"string","format":"uuid"}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"User does not have permission to create a trigger on this repository","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Repository does not exist","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}/trigger/{trigger}":{"delete":{"tags":["Git"],"summary":"Delete a git trigger","description":"Delete a git trigger. This is irreversible.","operationId":"handle_delete_git_trigger","parameters":[{"name":"trigger","in":"path","description":"The trigger id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Trigger deleted successfully","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"User does not have permission to delete a trigger on this repository","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Trigger does not exist","content":{"application/json":{"schema":{"type":"object"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}/zip":{"get":{"tags":["Git"],"summary":"Download a zip of a repo","description":"Download the contents of a repo as a zip.","operationId":"handle_download_zip","parameters":[{"name":"ref","in":"query","description":"The git reference (branch name, commit SHA, etc.). Defaults to HEAD.","required":false,"schema":{"type":"string"}},{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success (byte stream)","content":{"application/zip":{}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/observability/v1/logs":{"get":{"tags":["Observability"],"summary":"Deployment Logs","description":"Get the logs for a deployment","operationId":"handle_get_logs","parameters":[{"name":"deploymentId","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"domain","in":"query","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleGetLogsResponse"}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.getLogs({\n deploymentId: 'deployment-id',\n}).then((response) => {\n console.log(response);\n});"}]}},"/web/v1/deploy":{"post":{"tags":["Deprecated"],"summary":"Deploy a Website (v1)","description":"Deploy a website. Files is a map of file paths to file contents. Configuration is optional and contains additional information about the deployment.","operationId":"handle_deploy_web","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDeployWebPayload"}}},"required":true},"responses":{"200":{"description":"successfully deployed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDeployWebSuccessResponseV2"}}}},"400":{"description":"failed to deploy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDeployWebErrorResponse"}}}}},"deprecated":true,"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\nimport 'dotenv/config';\n\nconst api = new FreestyleSandboxes({\n apiKey: process.env.FREESTYLE_API_KEY!,\n});\n\napi\n .deployWeb({\n 'index.js': {\n content:`\n import http from 'node:http';\n console.log('starting server');\n\n const server = http.createServer(async(req, res) => {\n // wait 5 seconds before responding\n // await new Promise((resolve) => setTimeout(resolve, 5000));\n res.writeHead(200, { 'Content-Type': 'text/plain' });\n res.end('Welcome to New York its been waiting for you');\n });\n\n server.listen(3000, () => {\n console.log('Server is running at http://localhost:3000');\n });`,\n }})\n .then((result) => {\n console.log('Deployed website @ ', result.deploymentId);\n });\n"},{"label":"Vercel AI SDK","lang":"javascript","source":"import { deployWebTool } from 'freestyle-sandboxes/ai';\nimport { generateText } from 'ai';\n\nconst deployer = deployWebTool({\n apiKey: 'your-api-key',\n});\n\nconst { text, steps } = await generateText({\n model: yourModel,\n tools: {\n deployer,\n },\n maxSteps: 2,\n prompt:\n 'Deploy a website to subdomain.yourdomain.com that has all the lyrics to Sandstorm by Darude on the homepage',\n});"}]}},"/web/v1/deployment":{"post":{"tags":["Web"],"summary":"Deploy a Website","description":"Deploy a website. Files is a map of file paths to file contents. Configuration is optional and contains additional information about the deployment.","operationId":"handle_deploy_web_v2","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDeployWebPayloadV2"}}},"required":true},"responses":{"200":{"description":"successfully deployed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDeployWebSuccessResponseV2"}}}},"400":{"description":"failed to deploy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDeployWebErrorResponse"}}}}}}},"/web/v1/deployments":{"get":{"tags":["Web"],"summary":"List web deploys","description":"List web deploys.","operationId":"handle_list_web_deploys","parameters":[{"name":"limit","in":"query","description":"Maximum number of repositories to return","required":true,"schema":{"type":"integer","format":"int64","minimum":0}},{"name":"offset","in":"query","description":"Offset for the list of repositories","required":true,"schema":{"type":"integer","format":"int64","minimum":0}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["entries","total","offset"],"properties":{"entries":{"type":"array","items":{"$ref":"#/components/schemas/DeploymentLogEntry"}},"total":{"type":"integer","format":"int64","minimum":0},"offset":{"type":"integer","format":"int64","minimum":0}}}}}},"500":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.listWebDeploys().then((response) => {\n console.log(response);\n});"}]}},"/web/v1/deployments/deployment/{deployment_id}":{"get":{"tags":["Web"],"summary":"Get information on web deploy","description":"Get information about a web deploy by its ID.","operationId":"handle_get_web_deploy_details","parameters":[{"name":"deployment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{}}}},"components":{"schemas":{"AccessLevel":{"type":"string","enum":["read","write"]},"AccessTokenInfo":{"type":"object","required":["id"],"properties":{"id":{"type":"string","format":"uuid"}}},"AccessibleRepository":{"type":"object","description":"Identical to [`RepositoryInfo`], but with the permissions field added.","required":["id","accountId","permissions","visibility"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":["string","null"]},"accountId":{"type":"string","format":"uuid"},"permissions":{"$ref":"#/components/schemas/AccessLevel"},"visibility":{"$ref":"#/components/schemas/Visibility"}}},"Behavior":{"type":"string","default":"exact","enum":["regex","exact"]},"BlobEncoding":{"type":"string","description":"The encoding of a blob from the API. Always `base64`.","enum":["base64"]},"BlobObject":{"type":"object","description":"Blob object","required":["content","encoding","sha"],"properties":{"content":{"type":"string","description":"The content of the blob, base64 encoded."},"encoding":{"$ref":"#/components/schemas/BlobEncoding","description":"The encoding of the blob. Always `base64`."},"sha":{"type":"string","description":"The object's hash."}}},"BranchDetails":{"type":"object","required":["default","name"],"properties":{"default":{"type":"boolean"},"name":{"type":"string"},"target":{"type":["string","null"]}}},"CommitObject":{"type":"object","description":"Commit object","required":["author","committer","message","tree","parents","sha"],"properties":{"author":{"$ref":"#/components/schemas/Signature","description":"The author of the commit"},"committer":{"$ref":"#/components/schemas/Signature","description":"The committer"},"message":{"type":"string","description":"The commit message"},"tree":{"$ref":"#/components/schemas/CommitTree","description":"The ID of the tree pointed to by this commit"},"parents":{"type":"array","items":{"$ref":"#/components/schemas/CommitParent"},"description":"Parent commit(s) of this commit"},"sha":{"type":"string","description":"The commit's hash ID"}}},"CommitParent":{"type":"object","required":["sha"],"properties":{"sha":{"type":"string","description":"The commit's hash ID"}}},"CommitTree":{"type":"object","required":["sha"],"properties":{"sha":{"type":"string","description":"The tree's hash ID"}}},"ConfigureGithubSyncRequest":{"type":"object","required":["githubRepoName"],"properties":{"githubRepoName":{"type":"string","description":"The GitHub repository name in \"owner/repo\" format"}}},"CreateDomainMappingRequest":{"type":"object","required":["deploymentId"],"properties":{"deploymentId":{"type":"string","format":"uuid"}}},"CreateRecordParams":{"type":"object","required":["domain","record"],"properties":{"domain":{"type":"string"},"record":{"$ref":"#/components/schemas/DnsRecordData"}}},"CreateRepoImport":{"oneOf":[{"type":"object","title":"Files","required":["files","commit_message","type"],"properties":{"files":{"type":"object","additionalProperties":{"type":"string"},"propertyNames":{"type":"string"}},"commit_message":{"type":"string"},"author_name":{"type":["string","null"]},"author_email":{"type":["string","null"]},"type":{"type":"string","enum":["files"]}}},{"type":"object","title":"Tar","required":["url","commit_message","type"],"properties":{"url":{"type":"string","format":"uri"},"dir":{"type":["string","null"]},"commit_message":{"type":"string"},"author_name":{"type":["string","null"]},"author_email":{"type":["string","null"]},"type":{"type":"string","enum":["tar"]}}},{"type":"object","title":"Zip","required":["url","commit_message","type"],"properties":{"url":{"type":"string","format":"uri"},"dir":{"type":["string","null"]},"commit_message":{"type":"string"},"author_name":{"type":["string","null"]},"author_email":{"type":["string","null"]},"type":{"type":"string","enum":["zip"]}}},{"type":"object","title":"Git","required":["url","commit_message","type"],"properties":{"url":{"type":"string","format":"uri"},"branch":{"type":["string","null"]},"dir":{"type":["string","null"]},"commit_message":{"type":"string"},"author_name":{"type":["string","null"]},"author_email":{"type":["string","null"]},"type":{"type":"string","enum":["git"]}}}]},"CreateRepoRequest":{"type":"object","properties":{"source":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/CreateRepoSource"}]},"import":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/CreateRepoImport"}]},"defaultBranch":{"type":["string","null"]}}},"CreateRepoSource":{"oneOf":[{"type":"object","title":"Source","required":["url","type"],"properties":{"url":{"type":"string","format":"uri"},"branch":{"type":["string","null"]},"depth":{"type":["integer","null"],"format":"int32"},"type":{"type":"string","enum":["git"]}}}]},"CreateRepositoryRequest":{"type":"object","properties":{"name":{"type":["string","null"],"description":"This name is not visible to users, and is only accessible to you via API and in the\ndashboard. Mostly useful for observability."},"public":{"type":"boolean","default":false},"defaultBranch":{"type":["string","null"],"description":"The default branch name for the repository. Defaults to \"main\" if not specified."},"source":{"$ref":"#/components/schemas/CreateRepoSource"},"import":{"$ref":"#/components/schemas/CreateRepoImport"}}},"CreateRepositoryResponseSuccess":{"type":"object","required":["repoId"],"properties":{"repoId":{"type":"string","format":"uuid"}}},"CreatedToken":{"type":"object","required":["id","token"],"properties":{"id":{"type":"string","format":"uuid"},"token":{"type":"string"}}},"CustomBuildOptions":{"type":"object","properties":{"command":{"type":["string","null"]},"envVars":{"type":["object","null"],"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"}},"outDir":{"type":["string","null"]}}},"DeploymentBuildOptions":{"oneOf":[{"oneOf":[{"$ref":"#/components/schemas/CustomBuildOptions"}],"title":"Custom"},{"type":"boolean","title":"Enabled"}]},"DeploymentLogEntry":{"type":"object","required":["deploymentId","accountId","provisionedAt","timeout","state","domains","envVars"],"properties":{"deploymentId":{"type":"string","format":"uuid"},"accountId":{"type":"string","format":"uuid"},"provisionedAt":{"type":"string","format":"date-time"},"timeout":{"type":"string"},"state":{"$ref":"#/components/schemas/DeploymentState"},"deployedAt":{"type":["string","null"],"format":"date-time"},"domains":{"type":"array","items":{"type":"string"}},"envVars":{"type":"object","additionalProperties":{"type":"string"},"propertyNames":{"type":"string"}}}},"DeploymentSource":{"oneOf":[{"type":"object","title":"Files","required":["files","kind"],"properties":{"files":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/FreestyleFile"},"propertyNames":{"type":"string"}},"kind":{"type":"string","enum":["files"]}}},{"type":"object","title":"Tar","required":["url","kind"],"properties":{"url":{"type":"string"},"kind":{"type":"string","enum":["tar"]}}},{"type":"object","title":"Git","description":"`dir` is the Directory to deploy from. If not provided, the root of the repository will be used.","required":["url","kind"],"properties":{"url":{"type":"string"},"branch":{"type":["string","null"],"example":"main"},"dir":{"type":["string","null"],"example":"dist"},"kind":{"type":"string","enum":["git"]}}}]},"DeploymentState":{"type":"string","enum":["provisioning","deployed","failed"]},"DescribePermissionResponseSuccess":{"type":"object","required":["identity","repo"],"properties":{"identity":{"type":"string","format":"uuid"},"repo":{"type":"string","format":"uuid"},"accessLevel":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/AccessLevel"}]}}},"DevServer":{"oneOf":[{"type":"object","required":["repoId","kind"],"properties":{"repoId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["repo"]}}}]},"DevServerRequest":{"type":"object","properties":{"devCommand":{"type":["string","null"]},"preDevCommandOnce":{"type":["string","null"]},"baseId":{"type":["string","null"],"example":"vite-skdjfls"},"envVars":{"type":["object","null"],"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"},"example":{"RESEND_API_KEY":"re_123456789"}},"repoId":{"type":["string","null"]},"computeClass":{"type":["string","null"],"default":"high","example":"low"},"timeout":{"type":["integer","null"],"format":"int64","description":"Timeout in seconds","example":"30","minimum":0},"domain":{"type":["string","null"],"deprecated":true},"repo":{"type":["string","null"],"deprecated":true},"gitRef":{"type":["string","null"]}}},"DevServerStatusRequest":{"type":"object","required":["devServer"],"properties":{"devServer":{"$ref":"#/components/schemas/DevServer"}}},"DevServerWatchFilesRequest":{"type":"object","required":["devServer"],"properties":{"devServer":{"$ref":"#/components/schemas/DevServer"}}},"DnsRecord":{"type":"object","required":["kind","name","value","ttl","managed"],"properties":{"kind":{"$ref":"#/components/schemas/DnsRecordKind"},"name":{"type":"string"},"value":{"type":"string"},"ttl":{"type":"string"},"priority":{"type":["integer","null"],"format":"int32","minimum":0},"managed":{"type":"boolean"}}},"DnsRecordData":{"type":"object","required":["kind","name","value"],"properties":{"kind":{"$ref":"#/components/schemas/DnsRecordKind"},"name":{"type":"string"},"value":{"type":"string"},"ttl":{"type":["string","null"]},"priority":{"type":["integer","null"],"format":"int32","minimum":0}}},"DnsRecordKind":{"type":"string","enum":["A","AAAA","CNAME","TXT","NS"]},"DomainVerificationRequest":{"type":"object","required":["id","domain","accountId","verificationCode","createdAt"],"properties":{"id":{"type":"string","format":"uuid","example":"1234-5678-9012-3456"},"domain":{"type":"string","example":"example.com"},"accountId":{"type":"string","format":"uuid","example":"1234-5678-9012-3456"},"verificationCode":{"type":"string","example":"freestyle-verification-v1-1234-5678-9012-3456"},"createdAt":{"type":"string","format":"date-time","example":"1234567890"}}},"ExecRequest":{"type":"object","required":["devServer","command","background"],"properties":{"devServer":{"$ref":"#/components/schemas/DevServer"},"command":{"type":"string"},"background":{"type":"boolean","description":"Spawn this command as a background process and return immediately"}}},"ExecuteLogEntry":{"type":"object","required":["deployment","accountId","provisionedAt","state","envVars"],"properties":{"deployment":{"type":"string","format":"uuid"},"accountId":{"type":"string","format":"uuid"},"provisionedAt":{"type":"string","format":"date-time"},"startedAt":{"type":["string","null"],"format":"date-time"},"duration":{"type":["string","null"]},"state":{"$ref":"#/components/schemas/ExecuteRunState"},"envVars":{"type":"object","additionalProperties":{"type":"string"},"propertyNames":{"type":"string"}}}},"ExecuteRunInfo":{"type":"object","required":["code","nodeModules"],"properties":{"code":{"type":"string"},"nodeModules":{"type":"object","additionalProperties":{"type":"string"},"propertyNames":{"type":"string"}}}},"ExecuteRunState":{"type":"string","enum":["starting","running","complete"]},"FileReadContent":{"oneOf":[{"type":"object","required":["content","encoding","kind"],"properties":{"content":{"type":"string"},"encoding":{"type":"string"},"kind":{"type":"string","enum":["file"]}}},{"type":"object","required":["files","kind"],"properties":{"files":{"type":"array","items":{"type":"string"}},"kind":{"type":"string","enum":["directory"]}}}]},"FreestyleCloudstateDeployConfiguration":{"type":"object","properties":{"domains":{"type":["array","null"],"items":{"type":"string"},"description":"ID of the project to deploy, if not provided will create a new project","default":null},"envVars":{"type":"object","description":"The environment variables that the cloudstate deploy can access","default":{},"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"}},"cloudstateDatabaseId":{"type":["string","null"],"format":"uuid","default":null}}},"FreestyleCloudstateDeployErrorResponse":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}},"FreestyleCloudstateDeployRequest":{"type":"object","required":["classes"],"properties":{"classes":{"type":"string"},"config":{"$ref":"#/components/schemas/FreestyleCloudstateDeployConfiguration"}}},"FreestyleCloudstateDeploySuccessResponse":{"type":"object","required":["deploymentId","cloudstateDatabaseId"],"properties":{"deploymentId":{"type":"string","format":"uuid"},"cloudstateDatabaseId":{"type":"string","format":"uuid"}}},"FreestyleDeleteDomainVerificationRequest":{"type":"object","required":["domain","verificationCode"],"properties":{"domain":{"type":"string","description":"The domain to create a verification code for","example":"example.com"},"verificationCode":{"type":"string","description":"The verification code"}}},"FreestyleDeployWebConfiguration":{"type":"object","properties":{"entrypoint":{"type":["string","null"],"description":"The entrypoint file for the website","default":"index.js"},"domains":{"type":["array","null"],"items":{"type":"string"},"description":"The custom domains for the website, eg. [\\\"subdomain.yourwebsite.com\\\"]. You may include a single *.style.dev domain here.","example":["subdomain.yourdomain.com"],"default":null},"projectId":{"type":["string","null"],"description":"Project ID was our original way of tracking deployments together, it is now deprecated and will be removed in the future. Please use the domains field to specify the domains for your project.","default":null,"deprecated":true},"nodeModules":{"type":["object","null"],"description":"Node Modules to install for the website, a map of package names to versions, e.g. { \\\"express\\\": \\\"4.17.1\\\" }. If this and a package-lock.json are provided, the package-lock.json, bun.lockb, pnpm-lock.yaml, or yarn.lock is also provided, the versions here will override the versions in those lock files.","default":null,"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"},"example":{"resend":"4.0.1"}},"envVars":{"type":["object","null"],"description":"The environment variables that the website can access\ne.g. { \\\"RESEND_API_KEY\\\": \\\"re_123456789\\\" }","default":null,"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"},"example":{"RESEND_API_KEY":"re_123456789"}},"serverStartCheck":{"type":"boolean","default":false},"networkPermissions":{"type":["array","null"],"items":{"$ref":"#/components/schemas/FreestyleNetworkPermission"},"default":null},"build":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/DeploymentBuildOptions"}],"default":null},"timeout":{"type":["integer","null"],"format":"int64","description":"Timeout for the deployment in seconds. If not provided, the default is 10 seconds.","default":null,"example":"15","minimum":0}}},"FreestyleDeployWebErrorResponse":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}},"FreestyleDeployWebPayload":{"type":"object","required":["files"],"properties":{"files":{"type":"object","description":"The files to deploy, a map of file paths to file contents, e.g. { \\\"index.js\\\": {\\\"content\\\": \\\"your main\\\", \\\"encoding\\\": \\\"utf-8\\\"}, \\\"file2.js\\\": {\\\"content\\\": \\\"your helper\\\" } }\n\n**Do not include node modules in this bundle, they will not work**. Instead, includes a package-lock.json, bun.lockb, pnpm-lock.yaml, or yarn.lock, the node modules for the project will be installed from that lock file, or use the node_modules field in the configuration to specify the node modules to install.","additionalProperties":{"$ref":"#/components/schemas/FreestyleFile"},"propertyNames":{"type":"string"},"example":{"index.js":{"content":"import http from 'node:http';\\n// import { resolver } from './file2.js';\\n\\nconsole.log('starting server');\\n\\nconst server = http.createServer(async(req, res) => {\\n // wait 5 seconds before responding\\n // await new Promise((resolve) => setTimeout(resolve, 5000));\\n res.writeHead(200, { 'Content-Type': 'text/plain' });\\n res.end('Welcome to New York its been waiting for you');\\n});\\n\\nserver.listen(3000, () => {\\n console.log('Server is running at http://localhost:3000');\\n});"}}},"config":{"$ref":"#/components/schemas/FreestyleDeployWebConfiguration"}}},"FreestyleDeployWebPayloadV2":{"type":"object","required":["source"],"properties":{"source":{"$ref":"#/components/schemas/DeploymentSource","description":"The files to deploy, a map of file paths to file contents, e.g. { \\\"index.js\\\": {\\\"content\\\": \\\"your main\\\", \\\"encoding\\\": \\\"utf-8\\\"}, \\\"file2.js\\\": {\\\"content\\\": \\\"your helper\\\" } }\n\n**Do not include node modules in this bundle, they will not work**. Instead, includes a package-lock.json, bun.lockb, pnpm-lock.yaml, or yarn.lock, the node modules for the project will be installed from that lock file, or use the node_modules field in the configuration to specify the node modules to install."},"config":{"$ref":"#/components/schemas/FreestyleDeployWebConfiguration"}}},"FreestyleDeployWebSuccessResponseV2":{"type":"object","required":["deploymentId","projectId","entrypoint"],"properties":{"deploymentId":{"type":"string","format":"uuid"},"projectId":{"type":"string","format":"uuid","deprecated":true},"domains":{"type":["array","null"],"items":{"type":"string"}},"entrypoint":{"type":"string","description":"The entrypoint file for the website. If not specified we try to automatically detect it."}}},"FreestyleDomainVerificationRequest":{"type":"object","required":["domain"],"properties":{"domain":{"type":"string","description":"The domain to create a verification code for","example":"example.com"}}},"FreestyleExecuteScriptParams":{"type":"object","required":["script"],"properties":{"script":{"type":"string","description":"The JavaScript or TypeScript script to execute","example":"export default () => {\n // get the value of the factorials of the numbers from 1 to 10 combined\n const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];\n\n function factorial(n) {\n if (n === 0) {\n return 1;\n }\n return n * factorial(n - 1);\n }\n\n const b = a.map(factorial);\n\n return b.reduce((a, b) => a + b);\n};\n"},"config":{"$ref":"#/components/schemas/FreestyleExecuteScriptParamsConfiguration"}}},"FreestyleExecuteScriptParamsConfiguration":{"type":"object","properties":{"envVars":{"type":"object","description":"The environment variables to set for the script","default":{},"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"},"example":{"RESEND_API_KEY":"re_123456789"}},"nodeModules":{"type":"object","description":"The node modules to install for the script","default":{},"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"},"example":{"resend":"4.0.1"}},"tags":{"type":"array","items":{"type":"string"},"description":"Tags for you to organize your scripts, useful for tracking what you're running","example":["email"],"default":[]},"timeout":{"type":["integer","null"],"format":"int32","description":"The script timeout","default":null,"minimum":0},"peerDependencyResolution":{"type":"boolean","description":"If false, we'll not resolve peer dependencies for the packages given, this can speed up execute performance, but will break packages with peers unless the peers are manually specified.","default":true},"networkPermissions":{"type":["array","null"],"items":{"$ref":"#/components/schemas/FreestyleNetworkPermission"},"default":null},"customHeaders":{"type":"object","description":"These headers will be added to every fetch request made through the script","default":{},"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"}},"proxy":{"type":["string","null"],"description":"Proxy all outgoing requests through this URL","default":null,"example":"https://aproxyyouown.com"}}},"FreestyleExecuteScriptResultSuccess":{"type":"object","required":["result","logs"],"properties":{"result":{"description":"The return value of the default export of the script"},"logs":{"type":"array","items":{"$ref":"#/components/schemas/FreestyleJavaScriptLog"}}}},"FreestyleFile":{"type":"object","required":["content"],"properties":{"content":{"type":"string","description":"The content of the file"},"encoding":{"type":"string","description":"The encoding of the file. Either **utf-8** or **base64**"}}},"FreestyleGetLogsResponse":{"type":"object","required":["logs"],"properties":{"logs":{"type":"array","items":{"$ref":"#/components/schemas/FreestyleLogResponseObject"}}}},"FreestyleJavaScriptLog":{"type":"object","required":["message","type"],"properties":{"message":{"type":"string","description":"The log message","example":"I'm a log!"},"type":{"type":"string","description":"The log level","example":"log"}}},"FreestyleLogResponseObject":{"type":"object","required":["message","timestamp"],"properties":{"message":{"type":"string"},"timestamp":{"type":"string"}}},"FreestyleNetworkPermission":{"oneOf":[{"allOf":[{"$ref":"#/components/schemas/NetworkPermissionData"},{"type":"object","required":["action"],"properties":{"action":{"type":"string","enum":["allow"]}}}]},{"allOf":[{"$ref":"#/components/schemas/NetworkPermissionData"},{"type":"object","required":["action"],"properties":{"action":{"type":"string","enum":["deny"]}}}]}]},"FreestyleVerifyDomainRequest":{"oneOf":[{"type":"object","required":["domain"],"properties":{"domain":{"type":"string","example":"example.com"}}},{"type":"object","required":["id"],"properties":{"id":{"type":"string","format":"uuid","example":"1234-5678-9012-3456"}}}],"description":"Verify a domain verification request, can either be done for a domain, or for a specific request"},"GetDefaultBranchResponse":{"type":"object","required":["defaultBranch"],"properties":{"defaultBranch":{"type":"string"}}},"GitCommitPushRequest":{"type":"object","required":["devServer","message"],"properties":{"devServer":{"$ref":"#/components/schemas/DevServer"},"message":{"type":"string"}}},"GitContents":{"oneOf":[{"type":"object","title":"File","required":["name","path","sha","size","content","type"],"properties":{"name":{"type":"string"},"path":{"type":"string"},"sha":{"type":"string","description":"The hash / object ID of the file."},"size":{"type":"integer","format":"int64","minimum":0},"content":{"type":"string","description":"Base64-encoded content."},"type":{"type":"string","enum":["file"]}}},{"type":"object","title":"Directory","required":["name","path","sha","entries","type"],"properties":{"name":{"type":"string"},"path":{"type":"string"},"sha":{"type":"string","description":"The hash / object ID of the directory."},"entries":{"type":"array","items":{"$ref":"#/components/schemas/GitContentsDirEntryItem"}},"type":{"type":"string","enum":["dir"]}}}]},"GitContentsDirEntryItem":{"oneOf":[{"type":"object","title":"File Entry","required":["name","path","sha","size","type"],"properties":{"name":{"type":"string"},"path":{"type":"string"},"sha":{"type":"string","description":"The hash / object ID of the file."},"size":{"type":"integer","format":"int64","minimum":0},"type":{"type":"string","enum":["file"]}}},{"type":"object","title":"Directory Entry","description":"Directory","required":["name","path","sha","entries","type"],"properties":{"name":{"type":"string"},"path":{"type":"string"},"sha":{"type":"string","description":"The hash / object ID of the directory."},"entries":{"type":"array","items":{"oneOf":[{"type":"object","title":"File Entry"},{"type":"object","title":"Dir Entry (recursive)"}]}},"type":{"type":"string","enum":["dir"]}}}]},"GitIdentity":{"type":"object","required":["id","managed"],"properties":{"id":{"type":"string","format":"uuid"},"managed":{"type":"boolean"}}},"GitReference":{"type":"object","description":"A reference to a Git object","required":["name","sha"],"properties":{"name":{"type":"string","description":"The name of the ref (e.g., \"refs/heads/main\" or \"refs/tags/v1.0.0\")"},"sha":{"type":"string","description":"The SHA-1 hash of the Git object this reference points to"}}},"GitRepositoryTrigger":{"type":"object","required":["repositoryId","trigger","action","managed","id","createdAt"],"properties":{"repositoryId":{"type":"string","format":"uuid"},"trigger":{"oneOf":[{"type":"object","required":["event"],"properties":{"branches":{"type":["array","null"],"items":{"type":"string"}},"globs":{"type":["array","null"],"items":{"type":"string"}},"event":{"type":"string","enum":["push"]}}}]},"action":{"oneOf":[{"type":"object","required":["endpoint","action"],"properties":{"endpoint":{"type":"string"},"action":{"type":"string","enum":["webhook"]}}}]},"managed":{"type":"boolean"},"id":{"type":"string","format":"uuid"},"createdAt":{"type":"string","format":"date-time"}}},"GitTrigger":{"oneOf":[{"type":"object","required":["event"],"properties":{"branches":{"type":["array","null"],"items":{"type":"string"}},"globs":{"type":["array","null"],"items":{"type":"string"}},"event":{"type":"string","enum":["push"]}}}]},"GitTriggerAction":{"oneOf":[{"type":"object","required":["endpoint","action"],"properties":{"endpoint":{"type":"string"},"action":{"type":"string","enum":["webhook"]}}}]},"GithubRepoSyncConfig":{"type":"object","required":["freestyleRepoId","accountId","installationId","githubRepoId","githubRepoName","createdAt"],"properties":{"freestyleRepoId":{"type":"string","format":"uuid"},"accountId":{"type":"string","format":"uuid"},"installationId":{"type":"integer","format":"int64"},"githubRepoId":{"type":"integer","format":"int64"},"githubRepoName":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}},"GithubSyncConfigResponse":{"type":"object","required":["githubRepoName"],"properties":{"githubRepoName":{"type":"string"}}},"GrantPermissionRequest":{"type":"object","required":["permission"],"properties":{"permission":{"$ref":"#/components/schemas/AccessLevel"}}},"InternalServerError":{"type":"string"},"ListGitTokensResponseSuccess":{"type":"object","required":["tokens"],"properties":{"tokens":{"type":"array","items":{"$ref":"#/components/schemas/AccessTokenInfo"}}}},"ListPermissionResponseSuccess":{"type":"object","required":["repositories"],"properties":{"repositories":{"type":"array","items":{"$ref":"#/components/schemas/AccessibleRepository"}}}},"ListRecordsResponse":{"type":"object","required":["records"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/DnsRecord"}}}},"NetworkPermissionData":{"type":"object","required":["query"],"properties":{"query":{"type":"string"},"behavior":{"$ref":"#/components/schemas/Behavior"}}},"ReadFileEphemeralDevServerResponses":{"oneOf":[{"type":"object","required":["id","isNew","content"],"properties":{"id":{"type":"string"},"isNew":{"type":"boolean"},"content":{"oneOf":[{"type":"object","required":["content","encoding","kind"],"properties":{"content":{"type":"string"},"encoding":{"type":"string"},"kind":{"type":"string","enum":["file"]}}},{"type":"object","required":["files","kind"],"properties":{"files":{"type":"array","items":{"type":"string"}},"kind":{"type":"string","enum":["directory"]}}}]}}},{"type":"object","required":["id","isNew"],"properties":{"id":{"type":"string"},"isNew":{"type":"boolean"}}},{"$ref":"#/components/schemas/InternalServerError"}]},"ReadFileRequest":{"type":"object","required":["devServer"],"properties":{"devServer":{"$ref":"#/components/schemas/DevServer"},"encoding":{"type":"string","default":"utf-8"}}},"RepositoryInfo":{"type":"object","required":["id","accountId","visibility","defaultBranch"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":["string","null"],"examples":["my-repo"]},"accountId":{"type":"string","format":"uuid"},"visibility":{"$ref":"#/components/schemas/Visibility"},"defaultBranch":{"type":"string"}}},"RepositoryMetadata":{"type":"object","required":["branches","tags","defaultBranch"],"properties":{"branches":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/BranchDetails"},"propertyNames":{"type":"string"}},"tags":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/TagDetails"},"propertyNames":{"type":"string"}},"defaultBranch":{"type":"string"}}},"RevokeGitTokenRequest":{"type":"object","required":["tokenId"],"properties":{"tokenId":{"type":"string","format":"uuid"}}},"SetDefaultBranchRequest":{"type":"object","required":["defaultBranch"],"properties":{"defaultBranch":{"type":"string"}}},"SetDefaultBranchResponse":{"type":"object"},"ShutdownDevServerRequest":{"type":"object","required":["devServer"],"properties":{"devServer":{"$ref":"#/components/schemas/DevServer","description":"The dev server to shutdown"}}},"Signature":{"type":"object","required":["date","name","email"],"properties":{"date":{"type":"string","format":"date-time","description":"The date marker for this signature"},"name":{"type":"string"},"email":{"type":"string"}}},"TagDetails":{"type":"object","required":["name","target"],"properties":{"name":{"type":"string"},"target":{"type":"string"},"message":{"type":["string","null"]}}},"TagObject":{"type":"object","description":"Tag object","required":["name","target","sha"],"properties":{"name":{"type":"string","description":"The tag name"},"tagger":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/Signature","description":"The tagger who created the tag"}]},"message":{"type":["string","null"],"description":"The tag message"},"target":{"$ref":"#/components/schemas/TagTarget","description":"The object this tag points to"},"sha":{"type":"string","description":"The tag's hash ID"}}},"TagTarget":{"type":"object","required":["sha"],"properties":{"sha":{"type":"string","description":"The target object's hash ID"}}},"TreeEntry":{"oneOf":[{"type":"object","title":"Blob","required":["path","sha","type"],"properties":{"path":{"type":"string"},"sha":{"type":"string"},"type":{"type":"string","enum":["blob"]}}},{"type":"object","title":"Tree","required":["path","sha","type"],"properties":{"path":{"type":"string"},"sha":{"type":"string"},"type":{"type":"string","enum":["tree"]}}}]},"TreeObject":{"type":"object","description":"Tree object","required":["tree","sha"],"properties":{"tree":{"type":"array","items":{"$ref":"#/components/schemas/TreeEntry"},"description":"The tree's entries"},"sha":{"type":"string","description":"The tree's hash ID"}}},"UpdatePermissionRequest":{"type":"object","required":["permission"],"properties":{"permission":{"$ref":"#/components/schemas/AccessLevel"}}},"Visibility":{"type":"string","enum":["public","private"]},"WriteFileRequest":{"type":"object","required":["devServer","content"],"properties":{"devServer":{"$ref":"#/components/schemas/DevServer"},"content":{"type":"string"},"encoding":{"type":"string","default":"utf-8"}}}},"responses":{"FreestyleExecuteScriptResultSuccess":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["result","logs"],"properties":{"result":{"description":"The return value of the default export of the script"},"logs":{"type":"array","items":{"$ref":"#/components/schemas/FreestyleJavaScriptLog"}}}}}}}},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"tags":[{"name":"Web","description":"APIs for deploying websites. We handle node modules caching, scaling, certificates and the whole end to end process. Send the code using the [deploy](#tag/web/POST/web/v1/deploy) endpoint, and you'll get a full hosted website back. Works with any TypeScript or JavaScript codebase."},{"name":"Execute","description":"APIs for running code. Send the code using the [execute](#tag/execute/POST/execute/v1/execute) endpoint, and you'll get the output back. Works with any TypeScript or JavaScript code + handles any node modules and environment variables you want."},{"name":"Cloudstate","description":"APIs for running cloud functions with persistent state. [Cloudstate](https://github.com/freestyle-sh/cloudstate/) is an opensource, durable JavaScript runtime maintained by the Freestyle Team."},{"name":"Domains","description":"APIs for managing domains. This is only relevant when you want to start to deploy to custom domains. \nPlease read [this guide](https://github.com/freestyle-sh/sandbox_sdks/blob/main/docs/custom_domains.md) to understand how deployments work with custom domains."},{"name":"Git","description":"APIs for managing git repositories and accessing git objects like commits, trees, blobs, tags, and refs."},{"name":"DNS","description":"APIs for managing DNS records. WIP."}]}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -152,7 +152,7 @@ export class FreestyleSandboxes {
|
|
|
152
152
|
*/
|
|
153
153
|
async executeScript(
|
|
154
154
|
script: string,
|
|
155
|
-
config?: FreestyleExecuteScriptParamsConfiguration
|
|
155
|
+
config?: FreestyleExecuteScriptParamsConfiguration,
|
|
156
156
|
): Promise<FreestyleExecuteScriptResultSuccess> {
|
|
157
157
|
const response = await sandbox_openapi.handleExecuteScript({
|
|
158
158
|
client: this.client,
|
|
@@ -167,7 +167,7 @@ export class FreestyleSandboxes {
|
|
|
167
167
|
}
|
|
168
168
|
throw {
|
|
169
169
|
message: `Failed to execute script: \n\n${script}\n\nError:\n\n${JSON.stringify(
|
|
170
|
-
response
|
|
170
|
+
response,
|
|
171
171
|
)}`,
|
|
172
172
|
error: response.error,
|
|
173
173
|
};
|
|
@@ -181,7 +181,7 @@ export class FreestyleSandboxes {
|
|
|
181
181
|
*/
|
|
182
182
|
async deployWeb(
|
|
183
183
|
source: sandbox_openapi.DeploymentSource,
|
|
184
|
-
config?: FreestyleDeployWebConfiguration
|
|
184
|
+
config?: FreestyleDeployWebConfiguration,
|
|
185
185
|
): Promise<FreestyleDeployWebSuccessResponseV2> {
|
|
186
186
|
const response = await sandbox_openapi.handleDeployWebV2({
|
|
187
187
|
client: this.client,
|
|
@@ -194,7 +194,7 @@ export class FreestyleSandboxes {
|
|
|
194
194
|
return response.data;
|
|
195
195
|
}
|
|
196
196
|
throw new Error(
|
|
197
|
-
`Failed to deploy web project\n\nStatus: ${response.response.status}\n\nMessage: ${response.error?.message}
|
|
197
|
+
`Failed to deploy web project\n\nStatus: ${response.response.status}\n\nMessage: ${response.error?.message}`,
|
|
198
198
|
);
|
|
199
199
|
}
|
|
200
200
|
|
|
@@ -202,7 +202,7 @@ export class FreestyleSandboxes {
|
|
|
202
202
|
* Deploy a Cloudstate project to a sandbox.
|
|
203
203
|
*/
|
|
204
204
|
async deployCloudstate(
|
|
205
|
-
body: FreestyleCloudstateDeployRequest
|
|
205
|
+
body: FreestyleCloudstateDeployRequest,
|
|
206
206
|
): Promise<FreestyleCloudstateDeploySuccessResponse> {
|
|
207
207
|
const response = await sandbox_openapi.handleDeployCloudstate({
|
|
208
208
|
client: this.client,
|
|
@@ -265,7 +265,7 @@ export class FreestyleSandboxes {
|
|
|
265
265
|
* @returns The domain verification token.
|
|
266
266
|
*/
|
|
267
267
|
async createDomainVerificationRequest(
|
|
268
|
-
domain: string
|
|
268
|
+
domain: string,
|
|
269
269
|
): Promise<HandleCreateDomainVerificationResponse> {
|
|
270
270
|
const response = await sandbox_openapi.handleCreateDomainVerification({
|
|
271
271
|
client: this.client,
|
|
@@ -281,7 +281,7 @@ export class FreestyleSandboxes {
|
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
async verifyDomainVerificationRequest(
|
|
284
|
-
id: string
|
|
284
|
+
id: string,
|
|
285
285
|
): Promise<HandleVerifyDomainResponse> {
|
|
286
286
|
const response = await sandbox_openapi.handleVerifyDomain({
|
|
287
287
|
client: this.client,
|
|
@@ -294,7 +294,7 @@ export class FreestyleSandboxes {
|
|
|
294
294
|
return response.data;
|
|
295
295
|
}
|
|
296
296
|
throw new Error(
|
|
297
|
-
`Failed to verify domain verification request with ID ${id}: ${response.error.message}
|
|
297
|
+
`Failed to verify domain verification request with ID ${id}: ${response.error.message}`,
|
|
298
298
|
);
|
|
299
299
|
}
|
|
300
300
|
|
|
@@ -304,7 +304,7 @@ export class FreestyleSandboxes {
|
|
|
304
304
|
* @returns The domain verification request.
|
|
305
305
|
*/
|
|
306
306
|
async verifyDomain(
|
|
307
|
-
domain: string
|
|
307
|
+
domain: string,
|
|
308
308
|
): Promise<HandleVerifyDomainResponse | HandleVerifyDomainError> {
|
|
309
309
|
const response = await sandbox_openapi.handleVerifyDomain({
|
|
310
310
|
client: this.client,
|
|
@@ -316,7 +316,7 @@ export class FreestyleSandboxes {
|
|
|
316
316
|
return response.data;
|
|
317
317
|
}
|
|
318
318
|
throw new Error(
|
|
319
|
-
`Failed to verify domain ${domain}: ${response.error.message}
|
|
319
|
+
`Failed to verify domain ${domain}: ${response.error.message}`,
|
|
320
320
|
);
|
|
321
321
|
}
|
|
322
322
|
|
|
@@ -335,20 +335,20 @@ export class FreestyleSandboxes {
|
|
|
335
335
|
const response = await sandbox_openapi.handleListDomainVerificationRequests(
|
|
336
336
|
{
|
|
337
337
|
client: this.client,
|
|
338
|
-
}
|
|
338
|
+
},
|
|
339
339
|
);
|
|
340
340
|
if (response.data) {
|
|
341
341
|
return response.data;
|
|
342
342
|
}
|
|
343
343
|
|
|
344
344
|
throw new Error(
|
|
345
|
-
`Failed to list domain verification requests\n${response.error.message}
|
|
345
|
+
`Failed to list domain verification requests\n${response.error.message}`,
|
|
346
346
|
);
|
|
347
347
|
}
|
|
348
348
|
|
|
349
349
|
async deleteDomainVerificationRequest(
|
|
350
350
|
domain: string,
|
|
351
|
-
verificationCode: string
|
|
351
|
+
verificationCode: string,
|
|
352
352
|
): Promise<HandleDeleteDomainVerificationResponse> {
|
|
353
353
|
const response = await sandbox_openapi.handleDeleteDomainVerification({
|
|
354
354
|
client: this.client,
|
|
@@ -362,13 +362,13 @@ export class FreestyleSandboxes {
|
|
|
362
362
|
}
|
|
363
363
|
|
|
364
364
|
throw new Error(
|
|
365
|
-
`Failed to delete domain verification request for domain ${domain}: ${response.error.message}
|
|
365
|
+
`Failed to delete domain verification request for domain ${domain}: ${response.error.message}`,
|
|
366
366
|
);
|
|
367
367
|
}
|
|
368
368
|
|
|
369
369
|
async listWebDeployments(
|
|
370
370
|
limit?: number,
|
|
371
|
-
offset?: number
|
|
371
|
+
offset?: number,
|
|
372
372
|
): Promise<HandleListWebDeploysResponse> {
|
|
373
373
|
const response = await sandbox_openapi.handleListWebDeploys({
|
|
374
374
|
client: this.client,
|
|
@@ -383,13 +383,13 @@ export class FreestyleSandboxes {
|
|
|
383
383
|
}
|
|
384
384
|
|
|
385
385
|
throw new Error(
|
|
386
|
-
`Failed to list web deployments\n${response.error.message}
|
|
386
|
+
`Failed to list web deployments\n${response.error.message}`,
|
|
387
387
|
);
|
|
388
388
|
}
|
|
389
389
|
|
|
390
390
|
async listExecuteRuns(
|
|
391
391
|
limit?: number,
|
|
392
|
-
offset?: number
|
|
392
|
+
offset?: number,
|
|
393
393
|
): Promise<HandleListExecuteRunsResponse> {
|
|
394
394
|
const response = await sandbox_openapi.handleListExecuteRuns({
|
|
395
395
|
client: this.client,
|
|
@@ -417,7 +417,7 @@ export class FreestyleSandboxes {
|
|
|
417
417
|
}
|
|
418
418
|
|
|
419
419
|
throw new Error(
|
|
420
|
-
`Failed to get execute run with ID ${id}: ${response.error.message}
|
|
420
|
+
`Failed to get execute run with ID ${id}: ${response.error.message}`,
|
|
421
421
|
);
|
|
422
422
|
}
|
|
423
423
|
|
|
@@ -435,7 +435,7 @@ export class FreestyleSandboxes {
|
|
|
435
435
|
}
|
|
436
436
|
|
|
437
437
|
throw new Error(
|
|
438
|
-
`Failed to provision wildcard for domain ${domain}: ${response.error.message}
|
|
438
|
+
`Failed to provision wildcard for domain ${domain}: ${response.error.message}`,
|
|
439
439
|
);
|
|
440
440
|
}
|
|
441
441
|
|
|
@@ -450,6 +450,7 @@ export class FreestyleSandboxes {
|
|
|
450
450
|
}: {
|
|
451
451
|
name?: string;
|
|
452
452
|
public?: boolean;
|
|
453
|
+
defaultBranch?: string;
|
|
453
454
|
} & (
|
|
454
455
|
| CreateGitRepositorySource
|
|
455
456
|
| CreateGitRepositoryImport
|
|
@@ -469,7 +470,7 @@ export class FreestyleSandboxes {
|
|
|
469
470
|
}
|
|
470
471
|
|
|
471
472
|
throw new Error(
|
|
472
|
-
`Failed to create git repository ${name}: ${response.error}
|
|
473
|
+
`Failed to create git repository ${name}: ${response.error}`,
|
|
473
474
|
);
|
|
474
475
|
}
|
|
475
476
|
|
|
@@ -518,7 +519,7 @@ export class FreestyleSandboxes {
|
|
|
518
519
|
}
|
|
519
520
|
|
|
520
521
|
throw new Error(
|
|
521
|
-
`Failed to delete git repository ${repoId}: ${response.error}
|
|
522
|
+
`Failed to delete git repository ${repoId}: ${response.error}`,
|
|
522
523
|
);
|
|
523
524
|
}
|
|
524
525
|
|
|
@@ -587,7 +588,7 @@ export class FreestyleSandboxes {
|
|
|
587
588
|
}
|
|
588
589
|
|
|
589
590
|
throw new Error(
|
|
590
|
-
`Failed to grant access to git identity ${identityId} for repository ${repoId}: ${response.error}
|
|
591
|
+
`Failed to grant access to git identity ${identityId} for repository ${repoId}: ${response.error}`,
|
|
591
592
|
);
|
|
592
593
|
}
|
|
593
594
|
|
|
@@ -619,7 +620,7 @@ export class FreestyleSandboxes {
|
|
|
619
620
|
}
|
|
620
621
|
|
|
621
622
|
throw new Error(
|
|
622
|
-
`Failed to update permission for git identity ${identityId} for repository ${repoId}: ${response.error}
|
|
623
|
+
`Failed to update permission for git identity ${identityId} for repository ${repoId}: ${response.error}`,
|
|
623
624
|
);
|
|
624
625
|
}
|
|
625
626
|
|
|
@@ -646,7 +647,7 @@ export class FreestyleSandboxes {
|
|
|
646
647
|
}
|
|
647
648
|
|
|
648
649
|
throw new Error(
|
|
649
|
-
`Failed to revoke access to git identity ${identityId} for repository ${repoId}: ${response.error}
|
|
650
|
+
`Failed to revoke access to git identity ${identityId} for repository ${repoId}: ${response.error}`,
|
|
650
651
|
);
|
|
651
652
|
}
|
|
652
653
|
|
|
@@ -670,7 +671,7 @@ export class FreestyleSandboxes {
|
|
|
670
671
|
}
|
|
671
672
|
|
|
672
673
|
throw new Error(
|
|
673
|
-
`Failed to list permissions for git identity ${identityId}: ${response.error}
|
|
674
|
+
`Failed to list permissions for git identity ${identityId}: ${response.error}`,
|
|
674
675
|
);
|
|
675
676
|
}
|
|
676
677
|
|
|
@@ -697,7 +698,7 @@ export class FreestyleSandboxes {
|
|
|
697
698
|
}
|
|
698
699
|
|
|
699
700
|
throw new Error(
|
|
700
|
-
`Failed to get permission for git identity ${identityId} on repository ${repoId}: ${response.error}
|
|
701
|
+
`Failed to get permission for git identity ${identityId} on repository ${repoId}: ${response.error}`,
|
|
701
702
|
);
|
|
702
703
|
}
|
|
703
704
|
|
|
@@ -721,7 +722,7 @@ export class FreestyleSandboxes {
|
|
|
721
722
|
}
|
|
722
723
|
|
|
723
724
|
throw new Error(
|
|
724
|
-
`Failed to create git access token: ${response.error.message}
|
|
725
|
+
`Failed to create git access token: ${response.error.message}`,
|
|
725
726
|
);
|
|
726
727
|
}
|
|
727
728
|
|
|
@@ -750,7 +751,7 @@ export class FreestyleSandboxes {
|
|
|
750
751
|
}
|
|
751
752
|
|
|
752
753
|
throw new Error(
|
|
753
|
-
`Failed to revoke git access token ${tokenId}: ${response.error.message}
|
|
754
|
+
`Failed to revoke git access token ${tokenId}: ${response.error.message}`,
|
|
754
755
|
);
|
|
755
756
|
}
|
|
756
757
|
|
|
@@ -774,7 +775,7 @@ export class FreestyleSandboxes {
|
|
|
774
775
|
}
|
|
775
776
|
|
|
776
777
|
throw new Error(
|
|
777
|
-
`Failed to list git access tokens: ${response.error.message}
|
|
778
|
+
`Failed to list git access tokens: ${response.error.message}`,
|
|
778
779
|
);
|
|
779
780
|
}
|
|
780
781
|
|
|
@@ -798,7 +799,7 @@ export class FreestyleSandboxes {
|
|
|
798
799
|
}
|
|
799
800
|
|
|
800
801
|
throw new Error(
|
|
801
|
-
`Failed to list git triggers for repository ${repoId}: ${response.error.message}
|
|
802
|
+
`Failed to list git triggers for repository ${repoId}: ${response.error.message}`,
|
|
802
803
|
);
|
|
803
804
|
}
|
|
804
805
|
|
|
@@ -830,7 +831,7 @@ export class FreestyleSandboxes {
|
|
|
830
831
|
}
|
|
831
832
|
|
|
832
833
|
throw new Error(
|
|
833
|
-
`Failed to create git trigger for repository ${repoId}: ${response.error.message}
|
|
834
|
+
`Failed to create git trigger for repository ${repoId}: ${response.error.message}`,
|
|
834
835
|
);
|
|
835
836
|
}
|
|
836
837
|
|
|
@@ -850,7 +851,7 @@ export class FreestyleSandboxes {
|
|
|
850
851
|
}
|
|
851
852
|
|
|
852
853
|
throw new Error(
|
|
853
|
-
`Failed to delete git trigger ${triggerId}: ${response.error.message}
|
|
854
|
+
`Failed to delete git trigger ${triggerId}: ${response.error.message}`,
|
|
854
855
|
);
|
|
855
856
|
}
|
|
856
857
|
|
|
@@ -1040,7 +1041,7 @@ export class FreestyleSandboxes {
|
|
|
1040
1041
|
if (response.error) {
|
|
1041
1042
|
throw new Error(
|
|
1042
1043
|
// @ts-ignore
|
|
1043
|
-
`Failed to request dev server: ${response.error.message}
|
|
1044
|
+
`Failed to request dev server: ${response.error.message}`,
|
|
1044
1045
|
);
|
|
1045
1046
|
}
|
|
1046
1047
|
|
|
@@ -1052,7 +1053,7 @@ export class FreestyleSandboxes {
|
|
|
1052
1053
|
action: {
|
|
1053
1054
|
endpoint: formatHook(
|
|
1054
1055
|
response.data?.url!,
|
|
1055
|
-
options.repoUrl || `https://git.freestyle.sh/${rId}
|
|
1056
|
+
options.repoUrl || `https://git.freestyle.sh/${rId}`,
|
|
1056
1057
|
),
|
|
1057
1058
|
action: "webhook",
|
|
1058
1059
|
},
|
|
@@ -1184,12 +1185,12 @@ export class FreestyleSandboxes {
|
|
|
1184
1185
|
kind: devServerInstance.kind,
|
|
1185
1186
|
},
|
|
1186
1187
|
}),
|
|
1187
|
-
}
|
|
1188
|
+
},
|
|
1188
1189
|
);
|
|
1189
1190
|
|
|
1190
1191
|
if (!response.ok) {
|
|
1191
1192
|
throw new Error(
|
|
1192
|
-
`Failed to fetch stream: ${response.status} ${response.statusText}
|
|
1193
|
+
`Failed to fetch stream: ${response.status} ${response.statusText}`,
|
|
1193
1194
|
);
|
|
1194
1195
|
}
|
|
1195
1196
|
|
|
@@ -1259,7 +1260,7 @@ export class FreestyleSandboxes {
|
|
|
1259
1260
|
async writeFile(
|
|
1260
1261
|
path: string,
|
|
1261
1262
|
content: string | ArrayBuffer,
|
|
1262
|
-
encoding: BufferEncoding = "utf-8"
|
|
1263
|
+
encoding: BufferEncoding = "utf-8",
|
|
1263
1264
|
) {
|
|
1264
1265
|
const contentStr =
|
|
1265
1266
|
typeof content === "string"
|
|
@@ -1281,7 +1282,7 @@ export class FreestyleSandboxes {
|
|
|
1281
1282
|
|
|
1282
1283
|
if (response.error) {
|
|
1283
1284
|
throw new Error(
|
|
1284
|
-
`Failed to write file: ${JSON.stringify(response.error)}
|
|
1285
|
+
`Failed to write file: ${JSON.stringify(response.error)}`,
|
|
1285
1286
|
);
|
|
1286
1287
|
}
|
|
1287
1288
|
},
|
|
@@ -1297,7 +1298,7 @@ export class FreestyleSandboxes {
|
|
|
1297
1298
|
command: cmd,
|
|
1298
1299
|
background,
|
|
1299
1300
|
},
|
|
1300
|
-
}
|
|
1301
|
+
},
|
|
1301
1302
|
);
|
|
1302
1303
|
|
|
1303
1304
|
if (response.error) {
|
|
@@ -1334,7 +1335,7 @@ export class FreestyleSandboxes {
|
|
|
1334
1335
|
|
|
1335
1336
|
const url = new URL(
|
|
1336
1337
|
path,
|
|
1337
|
-
this.options.baseUrl ?? "https://api.freestyle.sh"
|
|
1338
|
+
this.options.baseUrl ?? "https://api.freestyle.sh",
|
|
1338
1339
|
);
|
|
1339
1340
|
|
|
1340
1341
|
return fetch(url, {
|