@@ -1188,6 +1188,125 @@ const messagingUpdateMsg91Provider = async ({providerId,name,enabled,templateId,
11881188
11891189 return response ;
11901190
1191+ }
1192+ /**
1193+ * @typedef {Object } MessagingCreateResendProviderRequestParams
1194+ * @property {string } providerId Provider ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
1195+ * @property {string } name Provider name.
1196+ * @property {string } apiKey Resend API key.
1197+ * @property {string } fromName Sender Name.
1198+ * @property {string } fromEmail Sender email address.
1199+ * @property {string } replyToName Name set in the reply to field for the mail. Default value is sender name.
1200+ * @property {string } replyToEmail Email set in the reply to field for the mail. Default value is sender email.
1201+ * @property {boolean } enabled Set as enabled.
1202+ * @property {boolean } overrideForCli
1203+ * @property {boolean } parseOutput
1204+ * @property {libClient | undefined } sdk
1205+ */
1206+
1207+ /**
1208+ * @param {MessagingCreateResendProviderRequestParams } params
1209+ */
1210+ const messagingCreateResendProvider = async ( { providerId, name, apiKey, fromName, fromEmail, replyToName, replyToEmail, enabled, parseOutput = true , overrideForCli = false , sdk = undefined } ) => {
1211+ let client = ! sdk ? await sdkForProject ( ) :
1212+ sdk ;
1213+ let apiPath = '/messaging/providers/resend' ;
1214+ let payload = { } ;
1215+ if ( typeof providerId !== 'undefined' ) {
1216+ payload [ 'providerId' ] = providerId ;
1217+ }
1218+ if ( typeof name !== 'undefined' ) {
1219+ payload [ 'name' ] = name ;
1220+ }
1221+ if ( typeof apiKey !== 'undefined' ) {
1222+ payload [ 'apiKey' ] = apiKey ;
1223+ }
1224+ if ( typeof fromName !== 'undefined' ) {
1225+ payload [ 'fromName' ] = fromName ;
1226+ }
1227+ if ( typeof fromEmail !== 'undefined' ) {
1228+ payload [ 'fromEmail' ] = fromEmail ;
1229+ }
1230+ if ( typeof replyToName !== 'undefined' ) {
1231+ payload [ 'replyToName' ] = replyToName ;
1232+ }
1233+ if ( typeof replyToEmail !== 'undefined' ) {
1234+ payload [ 'replyToEmail' ] = replyToEmail ;
1235+ }
1236+ if ( typeof enabled !== 'undefined' ) {
1237+ payload [ 'enabled' ] = enabled ;
1238+ }
1239+
1240+ let response = undefined ;
1241+
1242+ response = await client . call ( 'post' , apiPath , {
1243+ 'content-type' : 'application/json' ,
1244+ } , payload ) ;
1245+
1246+ if ( parseOutput ) {
1247+ parse ( response )
1248+ }
1249+
1250+ return response ;
1251+
1252+ }
1253+ /**
1254+ * @typedef {Object } MessagingUpdateResendProviderRequestParams
1255+ * @property {string } providerId Provider ID.
1256+ * @property {string } name Provider name.
1257+ * @property {boolean } enabled Set as enabled.
1258+ * @property {string } apiKey Resend API key.
1259+ * @property {string } fromName Sender Name.
1260+ * @property {string } fromEmail Sender email address.
1261+ * @property {string } replyToName Name set in the Reply To field for the mail. Default value is Sender Name.
1262+ * @property {string } replyToEmail Email set in the Reply To field for the mail. Default value is Sender Email.
1263+ * @property {boolean } overrideForCli
1264+ * @property {boolean } parseOutput
1265+ * @property {libClient | undefined } sdk
1266+ */
1267+
1268+ /**
1269+ * @param {MessagingUpdateResendProviderRequestParams } params
1270+ */
1271+ const messagingUpdateResendProvider = async ( { providerId, name, enabled, apiKey, fromName, fromEmail, replyToName, replyToEmail, parseOutput = true , overrideForCli = false , sdk = undefined } ) => {
1272+ let client = ! sdk ? await sdkForProject ( ) :
1273+ sdk ;
1274+ let apiPath = '/messaging/providers/resend/{providerId}' . replace ( '{providerId}' , providerId ) ;
1275+ let payload = { } ;
1276+ if ( typeof name !== 'undefined' ) {
1277+ payload [ 'name' ] = name ;
1278+ }
1279+ if ( typeof enabled !== 'undefined' ) {
1280+ payload [ 'enabled' ] = enabled ;
1281+ }
1282+ if ( typeof apiKey !== 'undefined' ) {
1283+ payload [ 'apiKey' ] = apiKey ;
1284+ }
1285+ if ( typeof fromName !== 'undefined' ) {
1286+ payload [ 'fromName' ] = fromName ;
1287+ }
1288+ if ( typeof fromEmail !== 'undefined' ) {
1289+ payload [ 'fromEmail' ] = fromEmail ;
1290+ }
1291+ if ( typeof replyToName !== 'undefined' ) {
1292+ payload [ 'replyToName' ] = replyToName ;
1293+ }
1294+ if ( typeof replyToEmail !== 'undefined' ) {
1295+ payload [ 'replyToEmail' ] = replyToEmail ;
1296+ }
1297+
1298+ let response = undefined ;
1299+
1300+ response = await client . call ( 'patch' , apiPath , {
1301+ 'content-type' : 'application/json' ,
1302+ } , payload ) ;
1303+
1304+ if ( parseOutput ) {
1305+ parse ( response )
1306+ }
1307+
1308+ return response ;
1309+
11911310}
11921311/**
11931312 * @typedef {Object } MessagingCreateSendgridProviderRequestParams
@@ -2619,6 +2738,32 @@ messaging
26192738 . option ( `--auth-key <auth-key>` , `Msg91 auth key.` )
26202739 . action ( actionRunner ( messagingUpdateMsg91Provider ) )
26212740
2741+ messaging
2742+ . command ( `create-resend-provider` )
2743+ . description ( `Create a new Resend provider.` )
2744+ . requiredOption ( `--provider-id <provider-id>` , `Provider ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.` )
2745+ . requiredOption ( `--name <name>` , `Provider name.` )
2746+ . option ( `--api-key <api-key>` , `Resend API key.` )
2747+ . option ( `--from-name <from-name>` , `Sender Name.` )
2748+ . option ( `--from-email <from-email>` , `Sender email address.` )
2749+ . option ( `--reply-to-name <reply-to-name>` , `Name set in the reply to field for the mail. Default value is sender name.` )
2750+ . option ( `--reply-to-email <reply-to-email>` , `Email set in the reply to field for the mail. Default value is sender email.` )
2751+ . option ( `--enabled [value]` , `Set as enabled.` , ( value ) => value === undefined ? true : parseBool ( value ) )
2752+ . action ( actionRunner ( messagingCreateResendProvider ) )
2753+
2754+ messaging
2755+ . command ( `update-resend-provider` )
2756+ . description ( `Update a Resend provider by its unique ID.` )
2757+ . requiredOption ( `--provider-id <provider-id>` , `Provider ID.` )
2758+ . option ( `--name <name>` , `Provider name.` )
2759+ . option ( `--enabled [value]` , `Set as enabled.` , ( value ) => value === undefined ? true : parseBool ( value ) )
2760+ . option ( `--api-key <api-key>` , `Resend API key.` )
2761+ . option ( `--from-name <from-name>` , `Sender Name.` )
2762+ . option ( `--from-email <from-email>` , `Sender email address.` )
2763+ . option ( `--reply-to-name <reply-to-name>` , `Name set in the Reply To field for the mail. Default value is Sender Name.` )
2764+ . option ( `--reply-to-email <reply-to-email>` , `Email set in the Reply To field for the mail. Default value is Sender Email.` )
2765+ . action ( actionRunner ( messagingUpdateResendProvider ) )
2766+
26222767messaging
26232768 . command ( `create-sendgrid-provider` )
26242769 . description ( `Create a new Sendgrid provider.` )
@@ -2895,6 +3040,8 @@ module.exports = {
28953040 messagingUpdateMailgunProvider,
28963041 messagingCreateMsg91Provider,
28973042 messagingUpdateMsg91Provider,
3043+ messagingCreateResendProvider,
3044+ messagingUpdateResendProvider,
28983045 messagingCreateSendgridProvider,
28993046 messagingUpdateSendgridProvider,
29003047 messagingCreateSMTPProvider,
0 commit comments