在webpackMissingModule上找不到模块“ ApiClient”

时间:2018-10-14 07:07:34

标签: ionic-framework sendinblue

我想在我的离子项目中使用sendinBlue api,但是在安装sib-api-v3-sdk并在我的项目中使用后,出现此错误:

Cannot find module "ApiClient"
at webpackMissingModule

这是我的代码:

sendMail(){
    var SibApiV3Sdk = require('sib-api-v3-sdk');
    var defaultClient = SibApiV3Sdk.ApiClient.instance;

    var apiKey = defaultClient.authentications['api-key'];
    apiKey.apiKey = 'YOUR_API_V3_KEY';

    var apiInstance = new SibApiV3Sdk.EmailCampaignsApi();
    var emailCampaigns = new SibApiV3Sdk.CreateEmailCampaign();

    emailCampaigns = {
    name: 'Campaign sent via the API',
    subject: 'My subject',
    sender: {name: 'From name', email: 'freelinux98@gmail.com'},
    type: 'classic',

    htmlContent: 'Congratulations! You successfully sent this example 
    campaign via the SendinBlue API.',

    recipients: {listIds: [2, 7]},

    scheduledAt: '2018-01-01 00:00:01'
    }

    apiInstance.createEmailCampaign(emailCampaigns).then(function(data) {
     console.log('API called successfully. Returned data: ' + data);
    }, function(error) {
     console.error(error);
   });
 }

0 个答案:

没有答案