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.

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"
}

// Response
{
  "svg": "
    
    
  "
}

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"
}

// Response
{
  "function": "function factorial(number) {
    if (number === 0 || number === 1) {
      return 1;
    }
    return number * factorial(number - 1);
  }"
}

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"
}

// Response
{
  "text": "Artificial Intelligence (AI) has emerged as one of the most transformative technologies of the 21st century. This field of computer science focuses on creating intelligent machines that can perform tasks that typically require human intelligence. From voice assistants to autonomous vehicles, AI is rapidly changing the way we live and work..."
}

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"
}

// Response
{
  "image_url": "https://api.example.com/generated_images/serene_lake_12345.jpg"
}

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"
}

// Response
{
  "code": "def is_prime(n):
    if n < 2:
        return False
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0:
            return False
    return True"
}

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
}

// Response
{
  "data": "[
    {
      \"name\": \"John Doe\",
      \"age\": 30,
      \"email\": \"john.doe@example.com\"
    },
    {
      \"name\": \"Jane Smith\",
      \"age\": 28,
      \"email\": \"jane.smith@example.com\"
    }
  ]"
}

This concludes the comprehensive API documentation for content generation functions. These endpoints provide powerful tools to create various types of content programmatically. Happy generating!