0
Fork 0
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:
Darcy Ye 2022-07-20 13:42:52 +08:00 committed by GitHub
parent ad9b3d780c
commit 15af03f45f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 20 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);