-
Notifications
You must be signed in to change notification settings - Fork 37
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
Support twilio api key #5039
base: main
Are you sure you want to change the base?
Support twilio api key #5039
Changes from all commits
a09807b
0ffb49f
588f1e9
15ac8da
e054de0
050ef48
6a29778
213d10a
57cc7b7
8a37b6b
6e4b529
bad7507
e405995
bbc1b73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,8 +12,11 @@ import ( | |
) | ||
|
||
type TwilioClientCredentials struct { | ||
CredentialType *config.TwilioCredentialType | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the non-pointer type here. |
||
AccountSID string | ||
AuthToken string | ||
APIKeySID string | ||
APIKeySecret string | ||
MessagingServiceSID string | ||
} | ||
|
||
|
@@ -198,9 +201,13 @@ func (r *ClientResolver) clientsFromAuthgearSecretsYAML() (*nexmo.NexmoClient, * | |
} | ||
|
||
if r.AuthgearSecretsYAMLTwilioCredentials != nil { | ||
credtyp := r.AuthgearSecretsYAMLTwilioCredentials.GetCredentialType() | ||
twilioClientCredentials = &TwilioClientCredentials{ | ||
CredentialType: &credtyp, | ||
AccountSID: r.AuthgearSecretsYAMLTwilioCredentials.AccountSID, | ||
AuthToken: r.AuthgearSecretsYAMLTwilioCredentials.AuthToken, | ||
APIKeySID: r.AuthgearSecretsYAMLTwilioCredentials.APIKeySID, | ||
APIKeySecret: r.AuthgearSecretsYAMLTwilioCredentials.APIKeySecret, | ||
MessagingServiceSID: r.AuthgearSecretsYAMLTwilioCredentials.MessagingServiceSID, | ||
} | ||
} | ||
|
@@ -229,9 +236,13 @@ func (r *ClientResolver) clientsFromEnv() (*nexmo.NexmoClient, *NexmoClientCrede | |
} | ||
|
||
if r.EnvironmentTwilioCredentials != (config.SMSGatewayEnvironmentTwilioCredentials{}) { | ||
credtyp := config.TwilioCredentialTypeAuthToken | ||
twilioClientCredentials = &TwilioClientCredentials{ | ||
CredentialType: &credtyp, | ||
AccountSID: r.EnvironmentTwilioCredentials.AccountSID, | ||
AuthToken: r.EnvironmentTwilioCredentials.AuthToken, | ||
APIKeySID: "", | ||
APIKeySecret: "", | ||
MessagingServiceSID: r.EnvironmentTwilioCredentials.MessagingServiceSID, | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -172,16 +172,37 @@ var samlSpSigningSecret = graphql.NewObject(graphql.ObjectConfig{ | |
}, | ||
}) | ||
|
||
var twilioCredentialType = graphql.NewEnum(graphql.EnumConfig{ | ||
Name: "TwilioCredentialType", | ||
Values: graphql.EnumValueConfigMap{ | ||
string(config.TwilioCredentialTypeAPIKey): &graphql.EnumValueConfig{ | ||
Value: config.TwilioCredentialTypeAPIKey, | ||
}, | ||
string(config.TwilioCredentialTypeAuthToken): &graphql.EnumValueConfig{ | ||
Value: config.TwilioCredentialTypeAuthToken, | ||
}, | ||
}, | ||
}) | ||
|
||
var smsProviderTwilioCredentials = graphql.NewObject(graphql.ObjectConfig{ | ||
Name: "SMSProviderTwilioCredentials", | ||
Description: "Twilio credentials", | ||
Fields: graphql.Fields{ | ||
"credentialType": &graphql.Field{ | ||
Type: graphql.NewNonNull(twilioCredentialType), | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to write a custom resolver that calls |
||
"accountSID": &graphql.Field{ | ||
Type: graphql.NewNonNull(graphql.String), | ||
}, | ||
"authToken": &graphql.Field{ | ||
Type: graphql.String, | ||
}, | ||
"apiKeySID": &graphql.Field{ | ||
Type: graphql.NewNonNull(graphql.String), | ||
}, | ||
"apiKeySecret": &graphql.Field{ | ||
Type: graphql.String, | ||
}, | ||
"messagingServiceSID": &graphql.Field{ | ||
Type: graphql.NewNonNull(graphql.String), | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,12 +52,21 @@ var smsProviderConfigurationInput = graphql.NewInputObject(graphql.InputObjectCo | |
var smsProviderConfigurationTwilioInput = graphql.NewInputObject(graphql.InputObjectConfig{ | ||
Name: "SMSProviderConfigurationTwilioInput", | ||
Fields: graphql.InputObjectConfigFieldMap{ | ||
"credentialType": &graphql.InputObjectFieldConfig{ | ||
Type: graphql.NewNonNull(twilioCredentialType), | ||
}, | ||
"accountSID": &graphql.InputObjectFieldConfig{ | ||
Type: graphql.NewNonNull(graphql.String), | ||
}, | ||
"authToken": &graphql.InputObjectFieldConfig{ | ||
Type: graphql.NewNonNull(graphql.String), | ||
}, | ||
"apiKeySID": &graphql.InputObjectFieldConfig{ | ||
Type: graphql.NewNonNull(graphql.String), | ||
}, | ||
"apiKeySecret": &graphql.InputObjectFieldConfig{ | ||
Type: graphql.NewNonNull(graphql.String), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't authToken, apiKeySID, apiKeySecret all be nullable? |
||
}, | ||
"messagingServiceSID": &graphql.InputObjectFieldConfig{ | ||
Type: graphql.String, | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,7 @@ | |
.providerGrid { | ||
@apply grid gap-4 grid-cols-2; | ||
} | ||
|
||
.textFieldInOption { | ||
@apply ml-6 my-1; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename this to
CredentialType_WriteOnly