@lap v0.3
# Machine-readable API spec. Each @endpoint block is one API call.
@api Twilio SendGrid Templates API
@base https://api.sendgrid.com
@version 1.0.0
@auth Bearer bearer
@common_fields {on-behalf-of: str}
@endpoints 11
@toc templates(11)

@endpoint POST /v3/templates
@required {name: str}
@optional {generation: str(legacy/dynamic)}
@returns(201) {id: str(uuid), name: str, generation: str, updated_at: str, versions: [map], warning: map{message: str}}

@endpoint GET /v3/templates
@required {page_size: num}
@optional {generations: str=legacy, page_token: str}
@returns(200) {result: [map], _metadata: map{prev: str(uri), self: str(uri), next: str(uri), count: int}}
@errors {400}

@endpoint POST /v3/templates/{template_id}
@optional {name: str}
@returns(201) {id: str(uuid), name: str, generation: str, updated_at: str, versions: [map], warning: map{message: str}}

@endpoint GET /v3/templates/{template_id}
@returns(200) {id: str(uuid), name: str, generation: str, updated_at: str, versions: [map], warning: map{message: str}}

@endpoint PATCH /v3/templates/{template_id}
@optional {name: str}
@returns(200) {id: str(uuid), name: str, generation: str, updated_at: str, versions: [map], warning: map{message: str}}

@endpoint DELETE /v3/templates/{template_id}
@returns(204)

@endpoint POST /v3/templates/{template_id}/versions
@required {name: str, subject: str}
@optional {active: int(0/1), html_content: str, plain_content: str=<generated from html_content if left empty>, generate_plain_content: bool=true, editor: str(code/design), test_data: str}
@returns(201) {warnings: [map], active: int, name: str, html_content: str, plain_content: str, generate_plain_content: bool, subject: str, editor: str, test_data: str, id: str(uuid), template_id: str, updated_at: str, thumbnail_url: str}

@endpoint GET /v3/templates/{template_id}/versions/{version_id}
@returns(200) {warnings: [map], active: int, name: str, html_content: str, plain_content: str, generate_plain_content: bool, subject: str, editor: str, test_data: str, id: str(uuid), template_id: str, updated_at: str, thumbnail_url: str}

@endpoint PATCH /v3/templates/{template_id}/versions/{version_id}
@required {name: str, subject: str}
@optional {active: int(0/1), html_content: str, plain_content: str=<generated from html_content if left empty>, generate_plain_content: bool=true, editor: str(code/design), test_data: str}
@returns(200) {warnings: [map], active: int, name: str, html_content: str, plain_content: str, generate_plain_content: bool, subject: str, editor: str, test_data: str, id: str(uuid), template_id: str, updated_at: str, thumbnail_url: str}

@endpoint DELETE /v3/templates/{template_id}/versions/{version_id}
@returns(204)

@endpoint POST /v3/templates/{template_id}/versions/{version_id}/activate
@returns(200) {warnings: [map], active: int, name: str, html_content: str, plain_content: str, generate_plain_content: bool, subject: str, editor: str, test_data: str, id: str(uuid), template_id: str, updated_at: str, thumbnail_url: str}

@end
