Giter VIP home page Giter VIP logo

apiv3-java-library's Introduction

SendinBlue's API v3 Java Library

SendinBlue's API exposes the entire SendinBlue features via a standardized programmatic interface. Please refer to the full documentation to learn more.

This is the wrapper for the API. It implements all the features of the API v3.

SendinBlue's API matches the OpenAPI v2 definition. The specification can be downloaded here.

Installation

To install the API client library to your local Maven repository, simply execute:

mvn install

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>com.sendinblue</groupId>
  <artifactId>sib-api-v3-sdk</artifactId>
  <version>7.0.0</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "com.sendinblue:sib-api-v3-sdk:7.0.0"

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/sib-api-v3-sdk-7.0.0.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:

import sendinblue.*;
import sendinblue.auth.*;
import sibModel.*;
import sibApi.AccountApi;

import java.io.File;
import java.util.*;

public class AccountApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        
        // Configure API key authorization: api-key
        ApiKeyAuth apiKey = (ApiKeyAuth) defaultClient.getAuthentication("api-key");
        apiKey.setApiKey("YOUR API KEY");
        // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
        //apiKey.setApiKeyPrefix("Token");

        // Configure API key authorization: partner-key
        ApiKeyAuth partnerKey = (ApiKeyAuth) defaultClient.getAuthentication("partner-key");
        partnerKey.setApiKey("YOUR PARTNER KEY");
        // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
        //partnerKey.setApiKeyPrefix("Token");

        AccountApi apiInstance = new AccountApi();
        try {
            GetAccount result = apiInstance.getAccount();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#getAccount");
            e.printStackTrace();
        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://api.sendinblue.com/v3

Class Method HTTP request Description
AccountApi getAccount GET /account Get your account information, plan and credits details
CompaniesApi companiesAttributesGet GET /companies/attributes Get company attributes
CompaniesApi companiesGet GET /companies Get all companies
CompaniesApi companiesIdDelete DELETE /companies/{id} Delete a company
CompaniesApi companiesIdGet GET /companies/{id} Get a company
CompaniesApi companiesIdPatch PATCH /companies/{id} Update a company
CompaniesApi companiesLinkUnlinkIdPatch PATCH /companies/link-unlink/{id} Link and Unlink company with contacts and deals
CompaniesApi companiesPost POST /companies Create a company
ContactsApi addContactToList POST /contacts/lists/{listId}/contacts/add Add existing contacts to a list
ContactsApi createAttribute POST /contacts/attributes/{attributeCategory}/{attributeName} Create contact attribute
ContactsApi createContact POST /contacts Create a contact
ContactsApi createDoiContact POST /contacts/doubleOptinConfirmation Create Contact via DOI (Double-Opt-In) Flow
ContactsApi createFolder POST /contacts/folders Create a folder
ContactsApi createList POST /contacts/lists Create a list
ContactsApi deleteAttribute DELETE /contacts/attributes/{attributeCategory}/{attributeName} Delete an attribute
ContactsApi deleteContact DELETE /contacts/{identifier} Delete a contact
ContactsApi deleteFolder DELETE /contacts/folders/{folderId} Delete a folder (and all its lists)
ContactsApi deleteList DELETE /contacts/lists/{listId} Delete a list
ContactsApi getAttributes GET /contacts/attributes List all attributes
ContactsApi getContactInfo GET /contacts/{identifier} Get a contact's details
ContactsApi getContactStats GET /contacts/{identifier}/campaignStats Get email campaigns' statistics for a contact
ContactsApi getContacts GET /contacts Get all the contacts
ContactsApi getContactsFromList GET /contacts/lists/{listId}/contacts Get contacts in a list
ContactsApi getFolder GET /contacts/folders/{folderId} Returns a folder's details
ContactsApi getFolderLists GET /contacts/folders/{folderId}/lists Get lists in a folder
ContactsApi getFolders GET /contacts/folders Get all folders
ContactsApi getList GET /contacts/lists/{listId} Get a list's details
ContactsApi getLists GET /contacts/lists Get all the lists
ContactsApi importContacts POST /contacts/import Import contacts
ContactsApi removeContactFromList POST /contacts/lists/{listId}/contacts/remove Delete a contact from a list
ContactsApi requestContactExport POST /contacts/export Export contacts
ContactsApi updateAttribute PUT /contacts/attributes/{attributeCategory}/{attributeName} Update contact attribute
ContactsApi updateBatchContacts POST /contacts/batch Update multiple contacts
ContactsApi updateContact PUT /contacts/{identifier} Update a contact
ContactsApi updateFolder PUT /contacts/folders/{folderId} Update a folder
ContactsApi updateList PUT /contacts/lists/{listId} Update a list
ConversationsApi conversationsAgentOnlinePingPost POST /conversations/agentOnlinePing Sets agent’s status to online for 2-3 minutes
ConversationsApi conversationsMessagesIdDelete DELETE /conversations/messages/{id} Delete a message sent by an agent
ConversationsApi conversationsMessagesIdGet GET /conversations/messages/{id} Get a message
ConversationsApi conversationsMessagesIdPut PUT /conversations/messages/{id} Update a message sent by an agent
ConversationsApi conversationsMessagesPost POST /conversations/messages Send a message as an agent
ConversationsApi conversationsPushedMessagesIdDelete DELETE /conversations/pushedMessages/{id} Delete an automated message
ConversationsApi conversationsPushedMessagesIdGet GET /conversations/pushedMessages/{id} Get an automated message
ConversationsApi conversationsPushedMessagesIdPut PUT /conversations/pushedMessages/{id} Update an automated message
ConversationsApi conversationsPushedMessagesPost POST /conversations/pushedMessages Send an automated message to a visitor
DealsApi crmAttributesDealsGet GET /crm/attributes/deals Get deal attributes
DealsApi crmDealsGet GET /crm/deals Get all deals
DealsApi crmDealsIdDelete DELETE /crm/deals/{id} Delete a deal
DealsApi crmDealsIdGet GET /crm/deals/{id} Get a deal
DealsApi crmDealsIdPatch PATCH /crm/deals/{id} Update a deal
DealsApi crmDealsLinkUnlinkIdPatch PATCH /crm/deals/link-unlink/{id} Link and Unlink a deal with contacts and companies
DealsApi crmDealsPost POST /crm/deals Create a deal
DealsApi crmPipelineDetailsGet GET /crm/pipeline/details Get pipeline stages
EcommerceApi createBatchOrder POST /orders/status/batch Create orders in batch
EcommerceApi createOrder POST /orders/status Managing the status of the order
EcommerceApi createUpdateBatchCategory POST /categories/batch Create categories in batch
EcommerceApi createUpdateBatchProducts POST /products/batch Create products in batch
EcommerceApi createUpdateCategory POST /categories Create/Update a category
EcommerceApi createUpdateProduct POST /products Create/Update a product
EcommerceApi ecommerceActivatePost POST /ecommerce/activate Activate the eCommerce app
EcommerceApi getCategories GET /categories Return all your categories
EcommerceApi getCategoryInfo GET /categories/{id} Get a category details
EcommerceApi getProductInfo GET /products/{id} Get a product's details
EcommerceApi getProducts GET /products Return all your products
EmailCampaignsApi createEmailCampaign POST /emailCampaigns Create an email campaign
EmailCampaignsApi deleteEmailCampaign DELETE /emailCampaigns/{campaignId} Delete an email campaign
EmailCampaignsApi emailExportRecipients POST /emailCampaigns/{campaignId}/exportRecipients Export the recipients of an email campaign
EmailCampaignsApi getAbTestCampaignResult GET /emailCampaigns/{campaignId}/abTestCampaignResult Get an A/B test email campaign results
EmailCampaignsApi getEmailCampaign GET /emailCampaigns/{campaignId} Get an email campaign report
EmailCampaignsApi getEmailCampaigns GET /emailCampaigns Return all your created email campaigns
EmailCampaignsApi getSharedTemplateUrl GET /emailCampaigns/{campaignId}/sharedUrl Get a shared template url
EmailCampaignsApi sendEmailCampaignNow POST /emailCampaigns/{campaignId}/sendNow Send an email campaign immediately, based on campaignId
EmailCampaignsApi sendReport POST /emailCampaigns/{campaignId}/sendReport Send the report of a campaign
EmailCampaignsApi sendTestEmail POST /emailCampaigns/{campaignId}/sendTest Send an email campaign to your test list
EmailCampaignsApi updateCampaignStatus PUT /emailCampaigns/{campaignId}/status Update an email campaign status
EmailCampaignsApi updateEmailCampaign PUT /emailCampaigns/{campaignId} Update an email campaign
EmailCampaignsApi uploadImageToGallery POST /emailCampaigns/images Upload an image to your account's image gallery
FilesApi crmFilesGet GET /crm/files Get all files
FilesApi crmFilesIdDataGet GET /crm/files/{id}/data Get file details
FilesApi crmFilesIdDelete DELETE /crm/files/{id} Delete a file
FilesApi crmFilesIdGet GET /crm/files/{id} Download a file
FilesApi crmFilesPost POST /crm/files Upload a file
InboundParsingApi getInboundEmailAttachment GET /inbound/attachments/{downloadToken} Retrieve inbound attachment with download token.
InboundParsingApi getInboundEmailEvents GET /inbound/events Get the list of all the events for the received emails.
InboundParsingApi getInboundEmailEventsByUuid GET /inbound/events/{uuid} Fetch all events history for one particular received email.
MasterAccountApi corporateMasterAccountGet GET /corporate/masterAccount Get the details of requested master account
MasterAccountApi corporateSubAccountGet GET /corporate/subAccount Get the list of all the sub-accounts of the master account.
MasterAccountApi corporateSubAccountIdDelete DELETE /corporate/subAccount/{id} Delete a sub-account
MasterAccountApi corporateSubAccountIdGet GET /corporate/subAccount/{id} Get sub-account details
MasterAccountApi corporateSubAccountIdPlanPut PUT /corporate/subAccount/{id}/plan Update sub-account plan
MasterAccountApi corporateSubAccountKeyPost POST /corporate/subAccount/key Create an API key for a sub-account
MasterAccountApi corporateSubAccountPost POST /corporate/subAccount Create a new sub-account under a master account.
MasterAccountApi corporateSubAccountSsoTokenPost POST /corporate/subAccount/ssoToken Generate SSO token to access Sendinblue
NotesApi crmNotesGet GET /crm/notes Get all notes
NotesApi crmNotesIdDelete DELETE /crm/notes/{id} Delete a note
NotesApi crmNotesIdGet GET /crm/notes/{id} Get a note
NotesApi crmNotesIdPatch PATCH /crm/notes/{id} Update a note
NotesApi crmNotesPost POST /crm/notes Create a note
ProcessApi getProcess GET /processes/{processId} Return the informations for a process
ProcessApi getProcesses GET /processes Return all the processes for your account
ResellerApi addCredits POST /reseller/children/{childIdentifier}/credits/add Add Email and/or SMS credits to a specific child account
ResellerApi associateIpToChild POST /reseller/children/{childIdentifier}/ips/associate Associate a dedicated IP to the child
ResellerApi createChildDomain POST /reseller/children/{childIdentifier}/domains Create a domain for a child account
ResellerApi createResellerChild POST /reseller/children Creates a reseller child
ResellerApi deleteChildDomain DELETE /reseller/children/{childIdentifier}/domains/{domainName} Delete the sender domain of the reseller child based on the childIdentifier and domainName passed
ResellerApi deleteResellerChild DELETE /reseller/children/{childIdentifier} Delete a single reseller child based on the child identifier supplied
ResellerApi dissociateIpFromChild POST /reseller/children/{childIdentifier}/ips/dissociate Dissociate a dedicated IP to the child
ResellerApi getChildAccountCreationStatus GET /reseller/children/{childIdentifier}/accountCreationStatus Get the status of a reseller's child account creation, whether it is successfully created (exists) or not based on the identifier supplied
ResellerApi getChildDomains GET /reseller/children/{childIdentifier}/domains Get all sender domains for a specific child account
ResellerApi getChildInfo GET /reseller/children/{childIdentifier} Get a child account's details
ResellerApi getResellerChilds GET /reseller/children Get the list of all children accounts
ResellerApi getSsoToken GET /reseller/children/{childIdentifier}/auth Get session token to access Sendinblue (SSO)
ResellerApi removeCredits POST /reseller/children/{childIdentifier}/credits/remove Remove Email and/or SMS credits from a specific child account
ResellerApi updateChildAccountStatus PUT /reseller/children/{childIdentifier}/accountStatus Update info of reseller's child account status based on the childIdentifier supplied
ResellerApi updateChildDomain PUT /reseller/children/{childIdentifier}/domains/{domainName} Update the sender domain of reseller's child based on the childIdentifier and domainName passed
ResellerApi updateResellerChild PUT /reseller/children/{childIdentifier} Update info of reseller's child based on the child identifier supplied
SendersApi createSender POST /senders Create a new sender
SendersApi deleteSender DELETE /senders/{senderId} Delete a sender
SendersApi getIps GET /senders/ips Get all the dedicated IPs for your account
SendersApi getIpsFromSender GET /senders/{senderId}/ips Get all the dedicated IPs for a sender
SendersApi getSenders GET /senders Get the list of all your senders
SendersApi updateSender PUT /senders/{senderId} Update a sender
SmsCampaignsApi createSmsCampaign POST /smsCampaigns Creates an SMS campaign
SmsCampaignsApi deleteSmsCampaign DELETE /smsCampaigns/{campaignId} Delete an SMS campaign
SmsCampaignsApi getSmsCampaign GET /smsCampaigns/{campaignId} Get an SMS campaign
SmsCampaignsApi getSmsCampaigns GET /smsCampaigns Returns the information for all your created SMS campaigns
SmsCampaignsApi requestSmsRecipientExport POST /smsCampaigns/{campaignId}/exportRecipients Export an SMS campaign's recipients
SmsCampaignsApi sendSmsCampaignNow POST /smsCampaigns/{campaignId}/sendNow Send your SMS campaign immediately
SmsCampaignsApi sendSmsReport POST /smsCampaigns/{campaignId}/sendReport Send an SMS campaign's report
SmsCampaignsApi sendTestSms POST /smsCampaigns/{campaignId}/sendTest Send a test SMS campaign
SmsCampaignsApi updateSmsCampaign PUT /smsCampaigns/{campaignId} Update an SMS campaign
SmsCampaignsApi updateSmsCampaignStatus PUT /smsCampaigns/{campaignId}/status Update a campaign's status
TasksApi crmTasksGet GET /crm/tasks Get all tasks
TasksApi crmTasksIdDelete DELETE /crm/tasks/{id} Delete a task
TasksApi crmTasksIdGet GET /crm/tasks/{id} Get a task
TasksApi crmTasksIdPatch PATCH /crm/tasks/{id} Update a task
TasksApi crmTasksPost POST /crm/tasks Create a task
TasksApi crmTasktypesGet GET /crm/tasktypes Get all task types
TransactionalEmailsApi blockNewDomain POST /smtp/blockedDomains Add a new domain to the list of blocked domains
TransactionalEmailsApi createSmtpTemplate POST /smtp/templates Create an email template
TransactionalEmailsApi deleteBlockedDomain DELETE /smtp/blockedDomains/{domain} Unblock an existing domain from the list of blocked domains
TransactionalEmailsApi deleteHardbounces POST /smtp/deleteHardbounces Delete hardbounces
TransactionalEmailsApi deleteScheduledEmailById DELETE /smtp/email/{identifier} Delete scheduled emails by batchId or messageId
TransactionalEmailsApi deleteSmtpTemplate DELETE /smtp/templates/{templateId} Delete an inactive email template
TransactionalEmailsApi getAggregatedSmtpReport GET /smtp/statistics/aggregatedReport Get your transactional email activity aggregated over a period of time
TransactionalEmailsApi getBlockedDomains GET /smtp/blockedDomains Get the list of blocked domains
TransactionalEmailsApi getEmailEventReport GET /smtp/statistics/events Get all your transactional email activity (unaggregated events)
TransactionalEmailsApi getScheduledEmailByBatchId GET /smtp/emailStatus/{batchId} Fetch scheduled emails by batchId
TransactionalEmailsApi getScheduledEmailByMessageId GET /smtp/emailStatus/{messageId} Fetch scheduled email by messageId
TransactionalEmailsApi getSmtpReport GET /smtp/statistics/reports Get your transactional email activity aggregated per day
TransactionalEmailsApi getSmtpTemplate GET /smtp/templates/{templateId} Returns the template information
TransactionalEmailsApi getSmtpTemplates GET /smtp/templates Get the list of email templates
TransactionalEmailsApi getTransacBlockedContacts GET /smtp/blockedContacts Get the list of blocked or unsubscribed transactional contacts
TransactionalEmailsApi getTransacEmailContent GET /smtp/emails/{uuid} Get the personalized content of a sent transactional email
TransactionalEmailsApi getTransacEmailsList GET /smtp/emails Get the list of transactional emails on the basis of allowed filters
TransactionalEmailsApi sendTestTemplate POST /smtp/templates/{templateId}/sendTest Send a template to your test list
TransactionalEmailsApi sendTransacEmail POST /smtp/email Send a transactional email
TransactionalEmailsApi smtpBlockedContactsEmailDelete DELETE /smtp/blockedContacts/{email} Unblock or resubscribe a transactional contact
TransactionalEmailsApi smtpLogMessageIdDelete DELETE /smtp/log/{messageId} Delete an SMTP transactional log
TransactionalEmailsApi updateSmtpTemplate PUT /smtp/templates/{templateId} Update an email template
TransactionalSmsApi getSmsEvents GET /transactionalSMS/statistics/events Get all your SMS activity (unaggregated events)
TransactionalSmsApi getTransacAggregatedSmsReport GET /transactionalSMS/statistics/aggregatedReport Get your SMS activity aggregated over a period of time
TransactionalSmsApi getTransacSmsReport GET /transactionalSMS/statistics/reports Get your SMS activity aggregated per day
TransactionalSmsApi sendTransacSms POST /transactionalSMS/sms Send SMS message to a mobile number
WebhooksApi createWebhook POST /webhooks Create a webhook
WebhooksApi deleteWebhook DELETE /webhooks/{webhookId} Delete a webhook
WebhooksApi getWebhook GET /webhooks/{webhookId} Get a webhook details
WebhooksApi getWebhooks GET /webhooks Get all webhooks
WebhooksApi updateWebhook PUT /webhooks/{webhookId} Update a webhook
WhatsappCampaignsApi deleteWhatsappCampaign DELETE /whatsappCampaigns/{campaignId} Delete a whatsapp campaign
WhatsappCampaignsApi getWhatsappCampaign GET /whatsappCampaigns/{campaignId} Get Whatsapp campaign Overview

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

api-key

  • Type: API key
  • API key parameter name: api-key
  • Location: HTTP header

partner-key

  • Type: API key
  • API key parameter name: partner-key
  • Location: HTTP header

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Support and Feedback

Be sure to visit the SendinBlue official documentation website for additional information about our API.

If you find a bug, please post the issue on Github.

As always, if you need additional assistance, drop us a note here.

apiv3-java-library's People

Contributors

amitsendinblue avatar ashvini-sib avatar ekta-slit avatar kool-hussain avatar mimiiix avatar swrnm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

apiv3-java-library's Issues

`NoSuchFieldError: Companion` when packaged in WAR

We've added sib-api-v3-sdk to an older project using Maven served on tomcat 7.

<dependency>
	<groupId>com.sendinblue</groupId>
	<artifactId>sib-api-v3-sdk</artifactId>
	<version>7.0.0</version>
</dependency>

When run with mvn clean tomcat7:run everything seems fine.

Packaged as a war mvn clean tomcat7:run-war it fails with:

Caused by: java.lang.NoSuchFieldError: Companion
	at okhttp3.internal.Util.<clinit>(Util.kt:70)
	at okhttp3.OkHttpClient.<clinit>(OkHttpClient.kt:1073)
	at sendinblue.ApiClient.<init>(ApiClient.java:80)
	at sendinblue.Configuration.<clinit>(Configuration.java:18)

Attaching a debugger and evaluating Configuration.getDefaultApiClient(); gives:

Method threw 'java.lang.NoClassDefFoundError' exception.
Could not initialize class sendinblue.Configuration
sendinblue.Configuration.getDefaultApiClient(Configuration.java:27)

Looking at mvn dependency:tree:

[INFO] +- com.sendinblue:sib-api-v3-sdk:jar:7.0.0:compile
[INFO] |  +- io.swagger:swagger-annotations:jar:1.5.18:compile
[INFO] |  +- com.squareup.okhttp3:okhttp:jar:4.10.0:compile
[INFO] |  |  +- com.squareup.okio:okio-jvm:jar:3.0.0:compile
[INFO] |  |  |  \- org.jetbrains.kotlin:kotlin-stdlib-common:jar:1.5.31:compile
[INFO] |  |  \- org.jetbrains.kotlin:kotlin-stdlib:jar:1.6.20:compile
[INFO] |  |     \- org.jetbrains:annotations:jar:13.0:compile
[INFO] |  +- com.squareup.okio:okio:jar:1.14.0:compile
[INFO] |  +- com.squareup.okhttp3:logging-interceptor:jar:4.10.0:compile
[INFO] |  |  \- org.jetbrains.kotlin:kotlin-stdlib-jdk8:jar:1.6.10:compile
[INFO] |  |     \- org.jetbrains.kotlin:kotlin-stdlib-jdk7:jar:1.6.10:compile
[INFO] |  +- com.google.code.gson:gson:jar:2.8.9:compile
[INFO] |  +- io.gsonfire:gson-fire:jar:1.8.2:compile
[INFO] |  +- org.threeten:threetenbp:jar:1.3.5:compile
[INFO] |  +- org.apache.commons:commons-lang3:jar:3.0:compile
[INFO] |  \- org.apache.maven.plugins:maven-gpg-plugin:jar:1.5:compile
[INFO] |     +- org.apache.maven:maven-plugin-api:jar:2.0.6:compile
[INFO] |     +- org.apache.maven:maven-project:jar:2.0.6:compile
[INFO] |     |  +- org.apache.maven:maven-settings:jar:2.0.6:compile
[INFO] |     |  +- org.apache.maven:maven-profile:jar:2.0.6:compile
[INFO] |     |  +- org.apache.maven:maven-artifact-manager:jar:2.0.6:compile
[INFO] |     |  |  +- org.apache.maven:maven-repository-metadata:jar:2.0.6:compile
[INFO] |     |  |  \- org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2:compile
[INFO] |     |  \- org.apache.maven:maven-plugin-registry:jar:2.0.6:compile
[INFO] |     +- org.apache.maven:maven-artifact:jar:2.0.6:compile
[INFO] |     +- org.apache.maven:maven-model:jar:2.0.6:compile
[INFO] |     \- org.codehaus.plexus:plexus-utils:jar:3.0.15:compile

All the jars are present in the war file WEB_INF/lib/ and there don't appear to be differing versions aside from those requested above.

Any suggestions?

It's a frustrating issue and it seems a waste of time to bypass your library and go direct to the API even though we would then get proper typing and far fewer dependencies ;-)

Targeting language level 1.8 on OpenJDK-11

Fix your dependencies, please!

Hi,
I tried to update your library from 6.0.0 to 7.0.0 recently and was surprised to see that you ship now maven-gpg-plugin and all its transitive dependencies. Why on earth do you do that?

Could you please check your dependencies and only ship those which are really needed for compiling and using your library.

Update maven-gpg-plugin to avoid CVE-2017-1000487

org.apache.maven.plugins:maven-gpg-plugin should be updated because 1.5 depends on a vulnerable version of org.codehaus.plexus:plexus-utils
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-1000487

Plexus-utils before 3.0.16 is vulnerable to command injection because it does not correctly process the contents of double quoted strings.

Plexus utils makes it into your output jar which means when people depend on Sendinblue it will trigger any automated security monitoring such as AWS Inspector.

It doesn't really make sense to me that a maven plugin you seem to be using to sign your artifacts is also shipped out inside those artifacts, but I'm not familiar with Maven so maybe that's normal.

Deprecated function: Return type of SendinBlue\Client\Model\CreateContact::offsetExists($offset)

I'm using this with the Drupal 9 SendinBlue module and I'm getting this error message about a deprecated function when I update the user. Still seems to be working.
Deprecated function: Return type of SendinBlue\Client\Model\CreateContact::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in include() (line 43 of /app/vendor/sendinblue/api-v3-sdk/lib/Model/CreateContact.php).

Stuck trying to send pdf with SmtpApi

Hi, thanks for this library,
I'm trying to send a PDF through Smtp, I have a template and successfully sent an email without attachment but when I try to add the attachment it gets stuck and never reaches the send part, this is the code I'm using (Already tested that file exists):

            SmtpApi apiInstance = new SmtpApi();

            SendSmtpEmail sendSmtpEmail = new SendSmtpEmail(); // SendSmtpEmail | Values to send a transactional email
            sendSmtpEmail.setTemplateId(1L);
            SendSmtpEmailTo remitent = new SendSmtpEmailTo();
            remitent.email("[email protected]");
            sendSmtpEmail.setTo(new ArrayList(Arrays.asList(remitent)));
            SendSmtpEmailAttachment attachment = new SendSmtpEmailAttachment();
            try {
                File f = new File(Environment.getExternalStorageDirectory() + "/someFolder/test.pdf");
                InputStream fis = new FileInputStream(f);
                long length = f.length();
                if (length > Integer.MAX_VALUE) {
                    Log.e("MainActivity", "cannnottt   readddd");
                }
                byte[] bytes = new byte[(int) length];
                int offset = 0;
                int numRead = 0;
                while (offset < bytes.length && (numRead = fis.read(bytes, offset, bytes.length - offset)) >= 0) {
                    offset += numRead;
                }
                attachment.setContent(bytes);
            } catch (Exception ex) {
                ex.printStackTrace();
            }
           
            sendSmtpEmail.setAttachment(Collections.singletonList(attachment));
            try {
                CreateSmtpEmail result = apiInstance.sendTransacEmail(sendSmtpEmail);
                System.out.println(result);
            } catch (ApiException e) {
                System.err.println("Exception when calling SmtpApi#sendTransacEmail");
                e.printStackTrace();
            } 

sendSmtpEmail.setAttachment(Collections.singletonList(attachment)); is the problematic line

Example Code for sendTransacEmail not working

The example provided for sendTransacEmail does not work.

If I run the current example, a Bad Request is returned.
Can you please give a complete working example that can run immediately which does not need any further configurations?

Upgrade to okhttp3

Is it possible to update the library to use okhttp3 instead of okhttp2 like it currently does. I am using Retrofit (com.squareup.retrofit2:retrofit:jar:2.6.2) already in my application which depends on okhttp3 (com.squareup.okhttp3:okhttp:jar:3.14.4)

sendinblue depends on okhttp2 (com.squareup.okhttp:okhttp:jar:2.7.5) and this gives problems in my application.

Given that okhttp 3 was already released in 2016 and there is even a version 4 already, it might be good to update.

Another alternative might be to shade the dependencies to avoid clashes.

Params cannot take complex objects

Following the guide for using control tags in email templates here we need to be able to submit more than String value pairs to params on SendSmtpEmail

Eg I need to list out products I'd use a template like;

Dear {{params.NAME}}
Thanks for the order, here is your invoice;
{% for item in params.ITEMS %}
{{item.name}} - {{item.amount}} - {{item.price}}
{% endfor %}

And use this api as;

List<Item> items = new ArrayList<>();
items.add(new Item("Cogs", "2", "$40"));
items.add(new Item("Spanners", "6", "$2));

Map<String, Object> params = new HashMap<>();
params .put("name", "Joe's Hardware");
params .put("items", items);

SmtpApi api = new SmtpApi();
SendSmtpEmail email = new SendSmtpEmail();
email.addToItem(new SendSmtpEmailTo().email(to));
email.templateId(templateId);
email.params(params ); <------- compilation error, params only takes Map<String, String> !!!
api.sendTransacEmail(email);

Unfortunately as pointed out params only takes a Map<String, String> which makes it impossible to send in deeper lists for iteration etc. Is there another approach that is better suited? For now I have forked this repo and changed the Map to <String, Object> and it solved my issue but I'm not sure if it would create more issues in other uses of the API.

Use htmlContent on MessageVersions

Hi !

I try to the bach of transactionnal emails as decribed in this documentation. But I am not able to find any setHtmlContent or something similar in the SendSmtpEmailMessageVersions. Is not implemented or available in another class ?
Thank you for your help.

Issue when migrating to okhttp3

Error stacktrace:
java.lang.UnsupportedOperationException: null
at java.base/java.util.Collections$UnmodifiableCollection.add(Collections.java:1067)
at sibApi.ContactsApi.createContactCall(ContactsApi.java:389)
at sibApi.ContactsApi.createContactValidateBeforeCall(ContactsApi.java:413)
at sibApi.ContactsApi.createContactAsync(ContactsApi.java:472)

image

Solution:
square/okhttp#2219

Non-typed return values for a few of your api calls

i.e.

public class GetFolders {
  @SerializedName("folders")
  private List<Object> folders = null;

  public GetFolders folders(List<Object> folders) {
    this.folders = folders;
    return this;
  }

i.e.

public class GetFolderLists {
  @SerializedName("lists")
  private List<Object> lists = null;

  public GetFolderLists lists(List<Object> lists) {
    this.lists = lists;
    return this;
  }

Your openspec apis also are not providing any properly types response objects for GetFolders, GetLists etc.

Is there a reason for this?

'createContact' with updateEnabled doesn't fallback to the updateContact behavior

Hi, I'm trying to update a contact informations and add it to a new list. I don't know if this contact is already in my contact list so I'm using 'createContact' with updateEnabled: true (sendinblue/APIv3-php-library#29) otherwise, updateContact will failed with a 'Contact does not exist' message.

The documentation said: listIds: Ids of the lists to add the contact to so I'm expecting the user to be add to the lists and not set the lists of the contact

Problem

If the contact exists and is already in a list, the contact's listIds is override.

Example:

Initial contact informations:

{
  "email": "[email protected]",
  "id": 1,
  "emailBlacklisted": false,
  "smsBlacklisted": false,
  "attributes": {
  },
  "listIds": [
    12
  ],
  "statistics": {}
}

I'm using something like:

CreateContact createContact = new CreateContact();
createContact.setEmail("[email protected]");
createContact.setListIds(Arrays.asList(24L));
createContact.setUpdateEnabled(true);

contactsApi.createContact(createContact);

Current behavior:

{
  "email": "[email protected]",
  "id": 1,
  "emailBlacklisted": false,
  "smsBlacklisted": false,
  "attributes": {
  },
  "listIds": [
    24
  ],
  "statistics": {}
}

Expected behavior:

{
  "email": "[email protected]",
  "id": 1,
  "emailBlacklisted": false,
  "smsBlacklisted": false,
  "attributes": {
  },
  "listIds": [
    12,
    24
  ],
  "statistics": {}
}

Am I missing something ?

Thanks!

Bad Request in logs not very informative

Hi,

I use the following code snippet:

public String sendMail(String toEmail, String toName, Long templateId, Object params)
			throws ServiceImplException, NotAllowedException {
			ApiClient defaultClient = Configuration.getDefaultApiClient(); 
			// ApiKeyAuth apiKey = (ApiKeyAuth) defaultClient.getAuthentication("api-key");
			// apiKey.setApiKey(mailerApiKey);
			defaultClient.setApiKey(mailerApiKey);
			SmtpApi apiInstance = new SmtpApi();
			apiInstance.setApiClient(defaultClient);
			// ApiClient defaultClient = Configuration.getDefaultApiClient();
			// defaultClient.setApiKey(mailerApiKey);
			// apiInstance.setApiClient(defaultClient);

			SendSmtpEmail sendEmail = new SendSmtpEmail();

			sendEmail.setTemplateId(templateId);

			List<SendSmtpEmailTo> to = new ArrayList<>();
			SendSmtpEmailTo recipient = new SendSmtpEmailTo();
			recipient.setEmail(toEmail);
			recipient.setName(toName);
			to.add(recipient);
			sendEmail.setTo(to);

			List<SendSmtpEmailBcc> bccList = new ArrayList<>();
			SendSmtpEmailBcc bcc = new SendSmtpEmailBcc();
			bcc.setEmail("[email protected]");
			bccList.add(bcc);
			sendEmail.setBcc(bccList);

			SendSmtpEmailReplyTo replyTo = new SendSmtpEmailReplyTo();
			replyTo.setEmail("[email protected]");
			replyTo.setName("EXAMPLE");
			sendEmail.setReplyTo(replyTo);

			try {
				CreateSmtpEmail result = apiInstance.sendTransacEmail(sendEmail);
				LOGGER.info("[Email] templateId " + templateId + " to " + toEmail + " (" + toName
						+ ") with params + " + params + " successfully sent. Result messageId: "
						+ result.getMessageId());
				return result.getMessageId();
			} catch (ApiException ex) {
				throw new ServiceImplException(
						"[Email] templateId " + templateId + " to " + toEmail + " (" + toName + ") failed", ex);
			}
}

and receive an exception sendinblue.ApiException: Bad Request without more information. Could it be possible to return more helpful message about what exactly in the message was incorrect? Is it authentification? Is it something else?
How can I log the JSON that's attempting to be sent? (if it can ever get serialized?)

Example Fails

Trying to use Java API. What is th partner key?
I alos get NoClassDefFound: okio/Source

When sending transaction email, params are not taken into account

I use the version 6

<dependency>
   <groupId>com.sendinblue</groupId>
   <artifactId>sib-api-v3-sdk</artifactId>
   <version>6.0.0</version>
</dependency>

And i am trying to use existing template with params:

SendSmtpEmail email = new SendSmtpEmail();
email.setTemplateId(3L);
...

final Properties properties = new Properties();
properties.setProperty("firstName", "my name");
properties.setProperty("url", "myURL");
email.setParams(params);

new SendSmtpEmailSender().sendTransacEmail(email)

but finally my email is coming including the bindings:

Part of email:

Hello {{ firstName }}
This is you link to reset your password
....

What's the problem?

apiInstance.getTransacEmailContent allways returning NotFound exception

I am trying to get personalized content of email using messageId i got as response from calling transactionalEmailsApi.sendTransacEmail but i am always getting Not Found exception on API call.

MessageIds i get in response of sending transactional email are in format like: [email protected]

I have tried using transactionalEmailsApi.sendTransacEmail method with these versions of id and non of them worked:

Also tried to generate uuid out of those versions using UUID.nameUUIDFromBytes and non of them gave correct UUID

Can you tell me how should i parse messageId so i can use this API?

Missing from Maven repo

Hi,

I've tried to include this as per instructions and it seems like it's missing from maven repo.

Any idea as to when it will be published.

Thanks
Simon

This version of API compiled for Java 8. May I submit braanch with Java 7 version and get it published as separate artifact.

This version of API compiled for Java 8. May I submit braanch with Java 7 version and get it published as separate artifact.
In exapmle version in this case would be 3.0.1.j7

The only reason to be J8 compatible as far as I understand is Base64 class for encoding decoding.
However I found solution for j7 https://stackoverflow.com/questions/14413169/which-java-library-provides-base64-encoding-decoding

I need this version for no more than year. While we complete migration to latest java

How to disable HTTP logs

When using this library, there are huge payloads and headers in the standard ouput (those ending with END POST or END HTTP.

Is there a way to disable those?

Thank you.

OSGI Support

Hello,

currently we are unable to use this library within an OSGI environment. There are at least two reasons.

  1. The lib uses com.google.gson.internal.bind.util.ISO8601Utils in json.java
  2. The lib doesn't provide an OSGI MANIFEST.MF file

Workaround:
Create your own project, build a fatjar containing all dependencies.

kind regards

UpdateContact, boolean attributes are not updating

Hello!

I cannot get boolean attributes to update when using the updateContact endpoint of the ContactsApi ith this SDK.

What value are you supposed to send in the Properties object? I Have tried true, TRUE, 1, Yes and nothing works. It just send 204 like all is okay but nothing happens. Below are the code. Its Kotlin, but its just the same. the user.sharingShopping field is a Boolean type.

val params = UpdateContact().apply {
    attributes = Properties().apply {
        setProperty("SHARING_SHOPPING", user.sharingShopping.toString())
    }
}
apiInstance.updateContact(user.userEmail, params)

emailCampaignsApi.getEmailCampaign(ID) parseException

First, I send an Email campagain as draft in sendinblue without field sechudledAt.

Next, i'm trying to get the campaign using

EmailCampaignsApi apiInstance = new EmailCampaignsApi();
GetEmailCampaign result = apiInstance.getEmailCampaign(campaignId);

Then I have the error Exception in thread "main" org.threeten.bp.format.DateTimeParseException: Text '' could not be parsed at index 0

It's because you should not serialize the field scheduledAtwith an empty String but NULL

Thanks

Error when calling campaignApi.getEmailCampaign(id) for campaign without scheduled date

Hello,
I'm using the latest version of this api (v5.0.0) for creating campaigns and got a following issue.
a) I'm creating a campaign using api without 'scheduledAt' field being assigned. This field is not mandatory so campaign is created and I can see it in SendinBlue UI.
b) now when I'm trying to load campaign info using campaignApi.getEmailCampaign(id) I'm getting error from whithin an api:

org.threeten.bp.format.DateTimeParseException: Text '' could not be parsed at index 0
	at org.threeten.bp.format.DateTimeFormatter.parseToBuilder(DateTimeFormatter.java:1587)
	at org.threeten.bp.format.DateTimeFormatter.parse(DateTimeFormatter.java:1491)
	at org.threeten.bp.OffsetDateTime.parse(OffsetDateTime.java:359)
	at sendinblue.Json$OffsetDateTimeTypeAdapter.read(Json.java:196)
	at sendinblue.Json$OffsetDateTimeTypeAdapter.read(Json.java:160)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:129)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220)
	at com.google.gson.Gson.fromJson(Gson.java:887)
	at com.google.gson.Gson.fromJson(Gson.java:852)
	at com.google.gson.Gson.fromJson(Gson.java:801)
	at sendinblue.Json.deserialize(Json.java:126)
	at sendinblue.ApiClient.deserialize(ApiClient.java:713)
	at sendinblue.ApiClient.handleResponse(ApiClient.java:916)
	at sendinblue.ApiClient.execute(ApiClient.java:843)
	at sibApi.EmailCampaignsApi.getEmailCampaignWithHttpInfo(EmailCampaignsApi.java:649)
	at sibApi.EmailCampaignsApi.getEmailCampaign(EmailCampaignsApi.java:635)

The only date field on campaign is scheduledAt so I tested this here and there and found that when 'scheduledAt' is not assigned, campaign can't be deserialized in GSon. For our use case we can't assign 'scheduledAt' when creating campaign so then it fails when trying to read it using an api. Can you fixed this or do you have any workaround?

btw. I can see it was reported already here: #13 for an older version ...

Thanks,
David Marko

How to send an email

How to send an email?

I didn't see any send email function on your README file.

Thanks

Whatsapp fecha sozinho

Estou com problema no wpp, ele fecha sozinho e informa erro. Comprei um Xiaomi 12 256 gb 8gb ram, ele está novíssimo. Cosigo entrar na conversa através do contato do telefone mas quando abro o app ele não fica nem 2 seg aberto e fecha ,já procurei uma caralhada de coisa e nada, deixo aqui o erro que aparece, eu não manjo de programação então meio que não sei o que fazder mais
Screenshot_2024-01-09-11-19-37-756_com miui bugreport (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.