Content Generation API Documentation

Welcome to the comprehensive API documentation for content generation functions. This guide covers various endpoints designed to assist in creating and manipulating different types of content. Each endpoint now includes a "Try it" button to test the API directly.

Table of Contents

  1. SVG Creator
  2. Function Creator
  3. Text Generation
  4. Image Generation
  5. Code Generation
  6. Data Generation

1. SVG Creator

POST /api/svg_creator

Generates and returns a raw SVG element based on a given concept.

Request Body

{
  "concept": "string",
  "width": number,
  "height": number,
  "style": "string" // optional, e.g., "minimalist", "detailed", "abstract"
}

Response

{
  "svg": "string (raw SVG content)"
}

Example

// Request
{
  "concept": "tree",
  "width": 200,
  "height": 300,
  "style": "minimalist"
}

2. Function Creator

POST /api/function_creator

Generates and returns JavaScript code for a described function that can be used directly in an eval statement.

Request Body

{
  "description": "string",
  "parameters": ["string"],
  "returnType": "string"
}

Response

{
  "function": "string (JavaScript function code)"
}

Example

// Request
{
  "description": "Calculate the factorial of a number",
  "parameters": ["number"],
  "returnType": "number"
}

3. Text Generation

POST /api/generate_text

Generates text based on given parameters.

Request Body

{
  "type": "string", // e.g., "article", "story", "poem"
  "topic": "string",
  "length": number, // word count
  "style": "string" // optional, e.g., "formal", "casual", "humorous"
}

Response

{
  "text": "string (generated text)"
}

Example

// Request
{
  "type": "article",
  "topic": "Artificial Intelligence",
  "length": 200,
  "style": "formal"
}

4. Image Generation

POST /api/generate_image

Generates an image based on a text description.

Request Body

{
  "description": "string",
  "width": number,
  "height": number,
  "style": "string" // optional, e.g., "photorealistic", "cartoon", "abstract"
}

Response

{
  "image_url": "string (URL to the generated image)"
}

Example

// Request
{
  "description": "A serene lake surrounded by mountains at sunset",
  "width": 800,
  "height": 600,
  "style": "photorealistic"
}

5. Code Generation

POST /api/generate_code

Generates code snippets based on a description.

Request Body

{
  "language": "string", // e.g., "python", "javascript", "java"
  "description": "string",
  "complexity": "string" // optional, e.g., "basic", "intermediate", "advanced"
}

Response

{
  "code": "string (generated code snippet)"
}

Example

// Request
{
  "language": "python",
  "description": "A function to check if a number is prime",
  "complexity": "intermediate"
}

6. Data Generation

POST /api/generate_data

Generates sample data based on specified parameters.

Request Body

{
  "type": "string", // e.g., "json", "csv", "xml"
  "schema": {}, // object describing the data structure
  "rows": number // number of data entries to generate
}

Response

{
  "data": "string (generated data in specified format)"
}

Example

// Request
{
  "type": "json",
  "schema": {
    "name": "string",
    "age": "number",
    "email": "email"
  },
  "rows": 2
}

This concludes the comprehensive API documentation for content generation functions. These endpoints provide powerful tools to create various types of content programmatically. Each endpoint now includes a "Try it" button that allows you to test the API directly from this documentation page.

Remember to replace the API endpoint URLs with your actual server address when implementing these functions in your own projects. The examples provided here are for demonstration purposes and may need to be adjusted based on your specific implementation and security requirements.

Happy generating!