Core Definitions

    interface๐Ÿ”—

    Use the interface keyword to define REST API shapes.

    interface API {
    
    }
    

    Multiple definitions are also supported.

    interface API1 {}
    
    interface API2 {}
    

    Each definition is transpiled to the target languageโ€™s equivalent of an interface during code generation.

    function๐Ÿ”—

    Inside an interface, define methods with the function keyword.

    You can specify argument and return types. Arguments map to query parameters.

    interface API {
        /// A method named "hello"
        /// Returns a string
        function hello() -> string
    
        /// You can also take arguments
        /// Use ',' to specify multiple parameters
        function arguments(id: int, name: string)
    }
    

    @body๐Ÿ”—

    Use the @body keyword to specify the HTTP request body type.

    type BodyType {
        id: int
        name: string
    }
    
    interface API {
        function body_test(@body: BodyType)
    }