Java4Example GPT

Java4Example GPT · GPT Actions

JDoodle API

Interacts with JDoodle services for code compilation and credit checking.

  • POST /credit-spentgetCreditsSpent

    Check the number of credits spent

  • POST /executeExecute Program

    Endpoint to execute code

原始 API 定义
{
  "openapi": "3.1.0",
  "info": {
    "title": "JDoodle API",
    "description": "Interacts with JDoodle services for code compilation and credit checking.",
    "version": "v1.0.0"
  },
  "servers": [
    {
      "url": "https://api.jdoodle.com/v1"
    }
  ],
  "paths": {
    "/credit-spent": {
      "post": {
        "description": "Check the number of credits spent",
        "operationId": "getCreditsSpent",
        "requestBody": {
          "description": "Client ID and Secret for authentication",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "clientId": {
                    "type": "string",
                    "description": "The client ID for JDoodle API"
                  },
                  "clientSecret": {
                    "type": "string",
                    "description": "The client secret for JDoodle API"
                  }
                },
                "required": [
                  "clientId",
                  "clientSecret"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response with credit details",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "used": {
                      "type": "integer",
                      "description": "Number of credits used"
                    },
                    "allowed": {
                      "type": "integer",
                      "description": "Total allowed credits"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized request"
          }
        }
      }
    },
    "/execute": {
      "post": {
        "operationId": "executeProgram",
        "summary": "Execute Program",
        "description": "Endpoint to execute code",
        "tags": [
          "execute"
        ],
        "requestBody": {
          "description": "the body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "clientId": {
                    "type": "string"
                  },
                  "clientSecret": {
                    "type": "string"
                  },
                  "script": {
                    "type": "string"
                  },
                  "stdin": {
                    "type": "string"
                  },
                  "language": {
                    "type": "string"
                  },
                  "versionIndex": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Execution success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "output": {
                      "type": "string",
                      "description": "Output"
                    },
                    "statusCode": {
                      "type": "integer",
                      "description": "Status Code"
                    },
                    "memory": {
                      "type": "number",
                      "description": "Memory used"
                    },
                    "cpuTime": {
                      "type": "number",
                      "description": "CPU Time used"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "429": {
            "description": "Daily limit reached"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {}
  }
}