所以我正在尝试使用这个sendinblue
API。它被安装,文档说我需要将它链接到我的项目,所以我去包目录,运行npm link
,然后我去我想使用它的文件夹并运行npm link sib-api-v3-sdk
它导致标题中的错误。
我试着反过来做,也不管用。我没有使用 webpack。
var SibV3ApiSdk = require("sib-api-v3-sdk")
var defaultClient = SibApiV3Sdk.ApiClient.instance;
// Configure API key authorization: api-key
var apiKey = defaultClient.authentications['api-key'];
apiKey.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix['api-key'] = "Token"
// Configure API key authorization: partner-key
var partnerKey = defaultClient.authentications['partner-key'];
partnerKey.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//partnerKey.apiKeyPrefix['partner-key'] = "Token"
var api = new SibApiV3Sdk.AccountApi()
api.getAccount().then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});