Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: make courier.TemplateType an enum #2875

Merged
merged 1 commit into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions courier/email_templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
)

type (
TemplateType string

EmailTemplate interface {
json.Marshaler
EmailSubject(context.Context) (string, error)
Expand All @@ -23,6 +21,11 @@ type (
}
)

// A Template's type
//
// swagger:enum TemplateType
type TemplateType string

const (
TypeRecoveryInvalid TemplateType = "recovery_invalid"
TypeRecoveryValid TemplateType = "recovery_valid"
Expand Down
22 changes: 19 additions & 3 deletions internal/httpclient/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3649,8 +3649,6 @@ components:
title: RecoveryAddressType must not exceed 16 characters as that is the limitation
in the SQL Schema.
type: string
TemplateType:
type: string
Time:
format: date-time
type: string
Expand Down Expand Up @@ -4297,7 +4295,7 @@ components:
recipient: recipient
created_at: 2000-01-23T04:56:07.000+00:00
send_count: 0
template_type: template_type
template_type: recovery_invalid
id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
body: body
properties:
Expand All @@ -4320,7 +4318,25 @@ components:
subject:
type: string
template_type:
enum:
- recovery_invalid
- recovery_valid
- recovery_code_invalid
- recovery_code_valid
- verification_invalid
- verification_valid
- otp
- stub
type: string
x-go-enum-desc: |-
recovery_invalid TypeRecoveryInvalid
recovery_valid TypeRecoveryValid
recovery_code_invalid TypeRecoveryCodeInvalid
recovery_code_valid TypeRecoveryCodeValid
verification_invalid TypeVerificationInvalid
verification_valid TypeVerificationValid
otp TypeOTP
stub TypeTestStub
type:
$ref: '#/components/schemas/courierMessageType'
updated_at:
Expand Down
16 changes: 12 additions & 4 deletions spec/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,6 @@
"title": "RecoveryAddressType must not exceed 16 characters as that is the limitation in the SQL Schema.",
"type": "string"
},
"TemplateType": {
"type": "string"
},
"Time": {
"format": "date-time",
"type": "string"
Expand Down Expand Up @@ -940,7 +937,18 @@
"type": "string"
},
"template_type": {
"$ref": "#/components/schemas/TemplateType"
"enum": [
"recovery_invalid",
"recovery_valid",
"recovery_code_invalid",
"recovery_code_valid",
"verification_invalid",
"verification_valid",
"otp",
"stub"
],
"type": "string",
"x-go-enum-desc": "recovery_invalid TypeRecoveryInvalid\nrecovery_valid TypeRecoveryValid\nrecovery_code_invalid TypeRecoveryCodeInvalid\nrecovery_code_valid TypeRecoveryCodeValid\nverification_invalid TypeVerificationInvalid\nverification_valid TypeVerificationValid\notp TypeOTP\nstub TypeTestStub"
},
"type": {
"$ref": "#/components/schemas/courierMessageType"
Expand Down
16 changes: 12 additions & 4 deletions spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -3059,9 +3059,6 @@
"type": "string",
"title": "RecoveryAddressType must not exceed 16 characters as that is the limitation in the SQL Schema."
},
"TemplateType": {
"type": "string"
},
"UUID": {"type": "string", "format": "uuid4"},
"adminCreateIdentityBody": {
"type": "object",
Expand Down Expand Up @@ -3641,7 +3638,18 @@
"type": "string"
},
"template_type": {
"$ref": "#/definitions/TemplateType"
"type": "string",
"enum": [
"recovery_invalid",
"recovery_valid",
"recovery_code_invalid",
"recovery_code_valid",
"verification_invalid",
"verification_valid",
"otp",
"stub"
],
"x-go-enum-desc": "recovery_invalid TypeRecoveryInvalid\nrecovery_valid TypeRecoveryValid\nrecovery_code_invalid TypeRecoveryCodeInvalid\nrecovery_code_valid TypeRecoveryCodeValid\nverification_invalid TypeVerificationInvalid\nverification_valid TypeVerificationValid\notp TypeOTP\nstub TypeTestStub"
},
"type": {
"$ref": "#/definitions/courierMessageType"
Expand Down