All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gdscript.api_doc_example.handlebars Maven / Gradle / Ivy

The newest version!
```gdscript

# Customize configuration
var config := {{>partials/api_config_class_name}}.new()
config.host = "localhost"
config.port = 8080
#config.tls_enabled = true
#config.trusted_chain = preload("res://my_cert_chain.crt")

# Instantiate the api
var api = {{{classname}}}.new(config)
# You can also provide your own HTTPClient, to re-use it across apis.
#var api = {{{classname}}}.new(config, client)

{{#each bodyParams}}
{{#if dataType}}
{{#if isModel}}
var {{paramName}} = {{dataType}}.new()
# … fill model {{paramName}} with data
{{/if}}
{{/if}}
{{/each}}

# Invoke an endpoint
api.{{{operationIdSnakeCase}}}(
{{#each allParams}}
	# {{paramName}}{{#if dataType}}: {{dataType}}{{/if}}{{#if defaultValue}} = {{{defaultValue}}}{{/if}}{{#if example}}   Eg: {{{example}}}{{/if}}
    {{~#if description}}

	# {{{description}}}{{/if}}
	{{paramName}},
{{/each}}
	# On Success
	func(response):{{#with returnProperty}}  # response is {{>partials/api_response_class_name}}{{/with}}
		prints("Success!", "{{operationIdSnakeCase}}", response)
		{{#with returnProperty}}assert(response.data is {{>partials/complex_type}}){{/with}}
		pass  # do things, make stuff
		,
	# On Error
	func(error):  # error is {{>partials/api_error_class_name}}
		push_error(str(error))
		,
)

```




© 2015 - 2024 Weber Informatics LLC | Privacy Policy