AutoBE
    Preparing search index...

    API operation statement for SDK function calls with automatic response handling and data capture.

    This statement type handles the complete lifecycle of API operations including:

    1. Executing API function calls through the SDK
    2. Automatically capturing the response in a variable (when variableName is provided)
    3. Performing runtime type assertion using typia.assert() for type safety

    This is the primary mechanism for all API interactions in E2E test scenarios, providing integrated data capture that eliminates the need for separate variable declarations.

    The statement automatically handles the complex pattern of API calling, response capturing, and type validation that is essential for robust E2E testing.

    AI function calling importance: Use this for ALL SDK API operations to ensure proper response handling, automatic data capture, and type safety in business test scenarios.

    interface IApiOperateStatement {
        argument?: null | IObjectLiteralExpression;
        endpoint: IEndpoint;
        type: "apiOperateStatement";
        variableName?: null | string & CamelPattern;
    }
    Index

    Properties

    argument?: null | IObjectLiteralExpression

    Single argument object for the API function call.

    CRITICAL: All API functions accept exactly one object parameter that contains all necessary data for the operation. This argument object is constructed based on the API operation's specification and follows a standardized structure.

    ⚠️ CRITICAL AI RESTRICTION: This MUST be an AST expression, NOT a JSON value! ⚠️ ❌ WRONG: { "name": "John", "age": 30 } (raw JSON object) ✅ CORRECT: IObjectLiteralExpression with proper AST structure

    Object Structure Rules:

    The argument object is constructed by combining path parameters and request body data according to the following rules based on the target AutoBeOpenApi.IOperation:

    1. Path Parameters: Each parameter from AutoBeOpenApi.IOperation.parameters becomes a property in the argument object, where:

      • Property name: AutoBeOpenApi.IParameter.name
      • Property value: Expression matching AutoBeOpenApi.IParameter.schema
      • Example: { saleId: "uuid-string", customerId: "another-uuid" }
    2. Request Body: If AutoBeOpenApi.IOperation.requestBody exists:

      • Add a body property containing the request body data
      • Value type: Object literal matching the requestBody's typeName schema
      • Example: { body: { name: "Product Name", price: 99.99 } }
    3. Combined Structure: When both path parameters and request body exist:

      {
      // Path parameters as individual properties
      "saleId": "uuid-value",
      "customerId": "another-uuid",
      // Request body as 'body' property
      "body": {
      "name": "Updated Product",
      "price": 149.99,
      "description": "Enhanced product description"
      }
      }

    Special Cases:

    • No Parameters: When parameters is empty array AND requestBody is null, set this to null (the API function requires no arguments)
    • Only Path Parameters: When requestBody is null but parameters exist, create object with only path parameter properties
    • Only Request Body: When parameters is empty but requestBody exists, create object with only the body property

    AI Construction Strategy:

    1. Analyze the target AutoBeOpenApi.IOperation specification
    2. Extract all path parameters and create corresponding object properties
    3. If request body exists, add it as the body property
    4. Ensure all property values match the expected types from OpenAPI schema
    5. Use realistic business data that reflects actual API usage patterns

    Type Safety Requirements:

    • Path parameter values must match their schema types (string, integer, etc.)
    • Request body structure must exactly match the referenced schema type
    • All required properties must be included with valid values
    • Optional properties can be omitted or included based on test scenario needs

    Business Context Examples:

    // GET /customers/{customerId}/orders/{orderId} (no request body)
    {
    customerId: "cust-123",
    orderId: "order-456"
    }

    // POST /customers (only request body)
    {
    body: {
    name: "John Doe",
    email: "john@example.com",
    phone: "+1-555-0123"
    }
    }

    // PUT /customers/{customerId}/orders/{orderId} (both path params and body)
    {
    customerId: "cust-123",
    orderId: "order-456",
    body: {
    status: "shipped",
    trackingNumber: "TRACK123",
    estimatedDelivery: "2024-12-25"
    }
    }

    // GET /health (no parameters or body)
    null
    endpoint: IEndpoint

    API endpoint specification defining the operation to be called.

    Contains the HTTP method and path information that identifies which specific API operation from the OpenAPI specification should be invoked. This corresponds to operations defined in the AutoBeOpenApi.IDocument.

    The endpoint determines the expected parameter types, request body schema, and response body schema for proper type validation.

    type: "apiOperateStatement"

    Type discriminator.

    variableName?: null | string & CamelPattern

    Optional variable name for capturing the API response with automatic data handling.

    Conditional Usage:

    • string: When API operation returns data that needs to be captured

      • Creates: const variableName: ApiResponseType = typia.assert<ResponseType>(await api.operation(...))
      • The response is automatically type-validated using typia.assert
      • Variable can be referenced in subsequent test steps for data flow
    • null: When API operation returns void or response is not needed

      • Creates: await api.operation(...)
      • No variable assignment or type assertion is performed
      • Typically used for operations like delete, logout, or fire-and-forget calls

    AI Decision Logic:

    • Set to meaningful variable name when the response contains business data needed for subsequent operations
    • Set to null when the operation is void or side-effect only
    • Consider if subsequent test steps need to reference the response data for business logic or validations

    Variable naming should follow business domain conventions (e.g., "customer", "order", "product") rather than technical naming. This automatic data capture eliminates the need for separate variable declaration statements.