mirror of
https://github.com/logto-io/logto.git
synced 2025-02-17 22:04:19 -05:00
chore(connector): fix methods params order (#1618)
This commit is contained in:
parent
ad9b3d780c
commit
15af03f45f
5 changed files with 20 additions and 20 deletions
|
@ -52,20 +52,20 @@ export default class AliyunDmConnector implements EmailConnectorInstance<AliyunD
|
|||
|
||||
this.validateConfig(emailConfig);
|
||||
|
||||
return this.sendMessageBy(address, type, data, emailConfig);
|
||||
return this.sendMessageBy(emailConfig, address, type, data);
|
||||
};
|
||||
|
||||
public sendTestMessage: EmailSendTestMessageFunction = async (config, address, type, data) => {
|
||||
this.validateConfig(config);
|
||||
|
||||
return this.sendMessageBy(address, type, data, config);
|
||||
return this.sendMessageBy(config, address, type, data);
|
||||
};
|
||||
|
||||
private readonly sendMessageBy = async (
|
||||
config: AliyunDmConfig,
|
||||
address: string,
|
||||
type: keyof EmailMessageTypes,
|
||||
data: EmailMessageTypes[typeof type],
|
||||
config: AliyunDmConfig
|
||||
data: EmailMessageTypes[typeof type]
|
||||
) => {
|
||||
const { accessKeyId, accessKeySecret, accountName, fromAlias, templates } = config;
|
||||
const template = templates.find((template) => template.usageType === type);
|
||||
|
|
|
@ -47,20 +47,20 @@ export default class AliyunSmsConnector implements SmsConnectorInstance<AliyunSm
|
|||
|
||||
this.validateConfig(smsConfig);
|
||||
|
||||
return this.sendMessageBy(phone, type, data, smsConfig);
|
||||
return this.sendMessageBy(smsConfig, phone, type, data);
|
||||
};
|
||||
|
||||
public sendTestMessage: SmsSendTestMessageFunction = async (config, phone, type, data) => {
|
||||
this.validateConfig(config);
|
||||
|
||||
return this.sendMessageBy(phone, type, data, config);
|
||||
return this.sendMessageBy(config, phone, type, data);
|
||||
};
|
||||
|
||||
private readonly sendMessageBy = async (
|
||||
config: AliyunSmsConfig,
|
||||
phone: string,
|
||||
type: keyof SmsMessageTypes,
|
||||
data: SmsMessageTypes[typeof type],
|
||||
config: AliyunSmsConfig
|
||||
data: SmsMessageTypes[typeof type]
|
||||
) => {
|
||||
const { accessKeyId, accessKeySecret, signName, templates } = config;
|
||||
const template = templates.find(({ usageType }) => usageType === type);
|
||||
|
|
|
@ -53,20 +53,20 @@ export default class SendGridMailConnector implements EmailConnectorInstance<Sen
|
|||
|
||||
this.validateConfig(config);
|
||||
|
||||
return this.sendMessageBy(address, type, data, config);
|
||||
return this.sendMessageBy(config, address, type, data);
|
||||
};
|
||||
|
||||
public sendTestMessage: EmailSendTestMessageFunction = async (config, address, type, data) => {
|
||||
this.validateConfig(config);
|
||||
|
||||
return this.sendMessageBy(address, type, data, config);
|
||||
return this.sendMessageBy(config, address, type, data);
|
||||
};
|
||||
|
||||
private readonly sendMessageBy = async (
|
||||
config: SendGridMailConfig,
|
||||
address: string,
|
||||
type: keyof EmailMessageTypes,
|
||||
data: EmailMessageTypes[typeof type],
|
||||
config: SendGridMailConfig
|
||||
data: EmailMessageTypes[typeof type]
|
||||
) => {
|
||||
const { apiKey, fromEmail, fromName, templates } = config;
|
||||
const template = templates.find((template) => template.usageType === type);
|
||||
|
|
|
@ -47,20 +47,20 @@ export default class SmtpConnector implements EmailConnectorInstance<SmtpConfig>
|
|||
|
||||
this.validateConfig(config);
|
||||
|
||||
return this.sendMessageBy(address, type, data, config);
|
||||
return this.sendMessageBy(config, address, type, data);
|
||||
};
|
||||
|
||||
public sendTestMessage: EmailSendTestMessageFunction = async (config, address, type, data) => {
|
||||
this.validateConfig(config);
|
||||
|
||||
return this.sendMessageBy(address, type, data, config);
|
||||
return this.sendMessageBy(config, address, type, data);
|
||||
};
|
||||
|
||||
private readonly sendMessageBy = async (
|
||||
config: SmtpConfig,
|
||||
address: string,
|
||||
type: keyof EmailMessageTypes,
|
||||
data: EmailMessageTypes[typeof type],
|
||||
config: SmtpConfig
|
||||
data: EmailMessageTypes[typeof type]
|
||||
) => {
|
||||
const { host, port, username, password, fromEmail, replyTo, templates } = config;
|
||||
const template = templates.find((template) => template.usageType === type);
|
||||
|
|
|
@ -46,20 +46,20 @@ export default class TwilioSmsConnector implements SmsConnectorInstance<TwilioSm
|
|||
|
||||
this.validateConfig(config);
|
||||
|
||||
return this.sendMessageBy(phone, type, data, config);
|
||||
return this.sendMessageBy(config, phone, type, data);
|
||||
};
|
||||
|
||||
public sendTestMessage: SmsSendTestMessageFunction = async (config, phone, type, data) => {
|
||||
this.validateConfig(config);
|
||||
|
||||
return this.sendMessageBy(phone, type, data, config);
|
||||
return this.sendMessageBy(config, phone, type, data);
|
||||
};
|
||||
|
||||
private readonly sendMessageBy = async (
|
||||
config: TwilioSmsConfig,
|
||||
phone: string,
|
||||
type: keyof SmsMessageTypes,
|
||||
data: SmsMessageTypes[typeof type],
|
||||
config: TwilioSmsConfig
|
||||
data: SmsMessageTypes[typeof type]
|
||||
) => {
|
||||
const { accountSID, authToken, fromMessagingServiceSID, templates } = config;
|
||||
const template = templates.find((template) => template.usageType === type);
|
||||
|
|
Loading…
Add table
Reference in a new issue