class AzuCLI::Generate::Endpoint

Overview

Endpoint generator that creates Azu::Endpoint structs

Defined in:

azu_cli/generators/endpoint.cr

Constant Summary

OUTPUT_DIR = "./src/endpoints"

Constructors

Instance Method Summary

Constructor Detail

def self.new(name : String, actions : Array(String) = [] of String, endpoint_type : String = "api", scaffold : Bool = false, module_name : String | Nil = nil) #

[View source]

Instance Method Detail

def action : String #

[View source]
def action=(action : String) #

[View source]
def action_path(action : String) : String #

Get path for action


[View source]
def actions : Array(String) #

[View source]
def actions=(actions : Array(String)) #

[View source]
def effective_actions : Array(String) #

Get actions to use (actions are always required)


[View source]
def endpoint_struct_name : String #

Convert name to endpoint struct name (nested under resource module)


[View source]
def endpoint_type : String #

[View source]
def endpoint_type=(endpoint_type : String) #

[View source]
def fields : Hash(String, String) #

[View source]
def fields=(fields : Hash(String, String)) #

[View source]
def full_path(action : String) : String #

Get full path for action


[View source]
def has_actions? : Bool #

Check if endpoint has actions


[View source]
def http_verb(action : String) : String #

Get HTTP verb for action


[View source]
def module_name : String #

[View source]
def module_name=(module_name : String) #

[View source]
def name : String #

[View source]
def name=(name : String) #

[View source]
def render(output_dir : String, force : Bool = false, interactive : Bool = true, list : Bool = false, color : Bool = false) #

Override render to create one file per action


[View source]
def request_type : String #

Get the request/response types based on endpoint type (nested under resource module)


[View source]
def resource_plural : String #

[View source]
def resource_plural=(resource_plural : String) #

[View source]
def resource_singular : String #

[View source]
def resource_singular=(resource_singular : String) #

[View source]
def response_type : String #

[View source]
def scaffold : Bool #

[View source]
def scaffold=(scaffold : Bool) #

[View source]
def scaffold_components : Array(String) #

Get scaffold components to generate


[View source]
def snake_case_name : String #

[View source]
def snake_case_name=(snake_case_name : String) #

[View source]