AboutMe

AboutMe · GPT アクション

Export To Replit

This is the API spec for allowing partners to surface links to their users to export code to Replit. The API flow is as follows: - Partner sends a POST to /claims with the content - Partner gets back a link and surfaces it to the user - User visits GET /claims/{claimId}/claim - Replit creates a Repl and drops user in with the code The language to create a Repl for is inferred from the file extension of the first file in the provided array. In order for the project to run without extra configuration by the user, the Claims API requires that a file in the array uses the canonical file name for the inferred language, which are listed below. If the array does not contain a file with this name, the Claims API will rename the first file of the correct language to use the canonical file name. - bash - main.sh - c - main.c - csharp - main.cs - cplusplus - main.cpp - css - style.css - dart - main.dart - go - main.go - html - index.html - java - Main.java - javascript (nodejs) - index.js - typescript (nodejs) - index.ts - kotlin - main.kt - php - main.php - python - main.py - ruby - main.rb - rust - main.rs - sqlite - main.sql - swift - main.swift If we detect multiple files, we'll show the user a language picker. In the near future (Q2 2024), we will remove the file name requirement and users will be able to configure their project to support as many languages as they want.

  • POST /claimsCreate a link to claim a Repl with file content
  • GET /claims/{claimId}/checkGet the data for a claim, meant for internal use only
  • GET /claims/{claimId}/claimCreate a repl based on a claim link
元の API スキーマ
{
  "openapi": "3.0.3",
  "info": {
    "title": "Export To Replit",
    "description": "This is the API spec for allowing partners to surface links to their users to export code to Replit. The API flow is as follows:\n- Partner sends a POST to /claims with the content\n- Partner gets back a link and surfaces it to the user\n- User visits GET /claims/{claimId}/claim\n- Replit creates a Repl and drops user in with the code\n\nThe language to create a Repl for is inferred from the file extension of the first file in the provided array.\n\nIn order for the project to run without extra configuration by the user, the Claims API requires that a file in the array uses the canonical file name for the inferred language, which are listed below. If the array does not contain a file with this name, the Claims API will rename the first file of the correct language to use the canonical file name.\n- bash - main.sh\n- c - main.c\n- csharp - main.cs\n- cplusplus - main.cpp\n- css - style.css\n- dart - main.dart\n- go - main.go\n- html - index.html\n- java - Main.java\n- javascript (nodejs) - index.js\n- typescript (nodejs) - index.ts\n- kotlin - main.kt\n- php - main.php\n- python - main.py\n- ruby - main.rb\n- rust - main.rs\n- sqlite - main.sql\n- swift - main.swift\n\nIf we detect multiple files, we'll show the user a language picker.\n\nIn the near future (Q2 2024), we will remove the file name requirement and users will be able to configure their project to support as many languages as they want.\n",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://replit.com/external/v1"
    }
  ],
  "paths": {
    "/claims": {
      "post": {
        "summary": "Create a link to claim a Repl with file content",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateClaimBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "secret claim link created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateClaimLinkSuccess"
                }
              }
            }
          },
          "400": {
            "description": "invalid request body, e.g. missing files required field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateClaimLinkFailed"
                }
              }
            }
          },
          "401": {
            "description": "invalid secret",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateClaimLinkFailed"
                }
              }
            }
          }
        }
      }
    },
    "/claims/{claimId}/check": {
      "get": {
        "summary": "Get the data for a claim, meant for internal use only",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "claimId",
            "in": "path",
            "required": true,
            "style": "simple",
            "explode": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "the contents of the claim",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Claim"
                }
              }
            }
          }
        }
      }
    },
    "/claims/{claimId}/claim": {
      "get": {
        "summary": "Create a repl based on a claim link",
        "parameters": [
          {
            "name": "claimId",
            "in": "path",
            "required": true,
            "style": "simple",
            "explode": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "brings up a page where claim is processed before redirecting to a Repl",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "Claim": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "example": "Python Fibonacci Sequence"
          },
          "description": {
            "type": "string",
            "example": "Fibonnaci implementation in Python that uses Fibonnaci using an iterative approach"
          },
          "conversation": {
            "type": "string",
            "example": "Here is how you write a Fibonacci Sequence in Python using an iterative approach \n```py\n...code...\n```\n"
          },
          "files": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ClaimFile"
            }
          }
        },
        "required": [
          "files"
        ]
      },
      "CreateClaimBody": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Claim"
          },
          {
            "type": "object",
            "properties": {
              "secret": {
                "type": "string",
                "example": "r9As8gqV7KsD21LwZxTcM3oPvEi6bYjnJXQu5FkN4GmRzHfUaA"
              }
            },
            "required": [
              "secret"
            ]
          }
        ]
      },
      "ClaimFile": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "format": "unix-relative-path",
            "example": "src/main.py"
          },
          "content": {
            "type": "string",
            "example": "print(\"hello world\")"
          }
        }
      },
      "CreateClaimLinkSuccess": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "expires": {
            "type": "string",
            "format": "date-time",
            "example": "2023-06-10T10:40:28+00:00"
          },
          "link": {
            "type": "string",
            "format": "uri",
            "example": "https://replit.com/external/v1/claim/NzJfVjMwazYtUmVHbFdR/claim"
          },
          "claimId": {
            "type": "string",
            "example": "NzJfVjMwazYtUmVHbFdR"
          }
        },
        "required": [
          "expires",
          "link",
          "success",
          "claimId"
        ]
      },
      "CreateClaimLinkFailed": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string",
            "example": "Invalid secret"
          }
        }
      }
    }
  }
}

Webpage Generator API

  • POST /create-pageGenerates a webpage based on provided HTML content
元の API スキーマ
{
  "openapi": "3.0.0",
  "info": {
    "title": "Webpage Generator API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://aboutmegpt.replit.app",
      "description": "Main production server"
    }
  ],
  "paths": {
    "/create-page": {
      "post": {
        "summary": "Generates a webpage based on provided HTML content",
        "operationId": "generateWebpage",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "page_code": {
                    "type": "string",
                    "description": "The HTML content for the web page"
                  }
                },
                "required": [
                  "page_code"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webpage successfully generated",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string",
                  "example": "https://example.com/generated_page"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          }
        }
      }
    }
  }
}