Skip to content

Commit 06516dc

Browse files
committed
Merge branch 'develop' into update-from-template-merged
2 parents 37f7c7a + 2afabff commit 06516dc

File tree

570 files changed

+212330
-52
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

570 files changed

+212330
-52
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ body:
1515
attributes:
1616
label: "Checklist"
1717
options:
18-
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/template-placeholder/releases/latest)"
18+
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/brevo-java-client/releases/latest)"
1919
required: true
20-
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
20+
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/brevo-java-client/issues) or [closed](https://github.com/xdev-software/brevo-java-client/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
2121
required: true
2222
- label: "I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise."
2323
required: true

.github/ISSUE_TEMPLATE/enhancement.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ body:
1313
attributes:
1414
label: "Checklist"
1515
options:
16-
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
16+
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/brevo-java-client/issues) or [closed](https://github.com/xdev-software/brevo-java-client/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
1717
required: true
1818
- label: "I have taken the time to fill in all the required details. I understand that the feature request will be dismissed otherwise."
1919
required: true

.github/ISSUE_TEMPLATE/question.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ body:
1212
attributes:
1313
label: "Checklist"
1414
options:
15-
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
15+
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/brevo-java-client/issues) or [closed](https://github.com/xdev-software/brevo-java-client/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
1616
required: true
1717
- label: "I have taken the time to fill in all the required details. I understand that the question will be dismissed otherwise."
1818
required: true

.run/Run Demo.run.xml

Lines changed: 0 additions & 16 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# 1.1.0
2+
* Updated generated code from Brevo's openapi.yml
3+
* Updated references to "new" official Brevo client #
4+
* Updated dependencies
5+
6+
# 1.0.4
7+
* Migrated deployment to _Sonatype Maven Central Portal_ [#155](https://github.com/xdev-software/standard-maven-template/issues/155)
8+
* Updated dependencies
9+
10+
# 1.0.3
11+
* Updated dependencies
12+
* Updated to OpenAPI Generator 7.12
13+
14+
# 1.0.2
15+
* Updated dependencies
16+
* Updated to OpenAPI Generator 7.8
17+
18+
# 1.0.1
19+
* Updated dependencies
20+
* Updated to OpenAPI Generator 7.4
21+
22+
# 1.0.0
23+
Initial release

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ You should have the following things installed:
3434
* Ensure that the JDK/Java-Version is correct
3535

3636

37-
## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/template-placeholder/release.yml?branch=master)](https://github.com/xdev-software/template-placeholder/actions/workflows/release.yml)
37+
## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/brevo-java-client/release.yml?branch=master)](https://github.com/xdev-software/brevo-java-client/actions/workflows/release.yml)
3838

3939
Before releasing:
40-
* Consider doing a [test-deployment](https://github.com/xdev-software/template-placeholder/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing.
40+
* Consider doing a [test-deployment](https://github.com/xdev-software/brevo-java-client/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing.
4141
* Check the [changelog](CHANGELOG.md)
4242

4343
If the ``develop`` is ready for release, create a pull request to the ``master``-Branch and merge the changes

README.md

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,38 @@
1-
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/template-placeholder?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/template-placeholder)
2-
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/template-placeholder/check-build.yml?branch=develop)](https://github.com/xdev-software/template-placeholder/actions/workflows/check-build.yml?query=branch%3Adevelop)
3-
[![API Specification Editor](https://img.shields.io/badge/API--Spec-Editor-85ea2d?logo=swagger)](https://editor.swagger.io/?url=https://raw.githubusercontent.com/xdev-software/template-placeholder/develop/openapi/openapi.yml)
1+
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/brevo-java-client?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/brevo-java-client)
2+
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/brevo-java-client/check-build.yml?branch=develop)](https://github.com/xdev-software/brevo-java-client/actions/workflows/check-build.yml?query=branch%3Adevelop)
3+
[![API Specification Editor](https://img.shields.io/badge/API--Spec-Editor-85ea2d?logo=swagger)](https://editor.swagger.io/?url=https://raw.githubusercontent.com/xdev-software/brevo-java-client/develop/openapi/openapi.yml)
44

5-
# template-placeholder
5+
# <img src="https://corp-backend.brevo.com/wp-content/uploads/2023/05/favicon.svg" height="28" /> Java Client for [Brevo](https://www.brevo.com/?r=t)
66

7-
This client [is generated](./template-placeholder/pom.xml) from an [``openapi.yml``](./openapi/openapi.yml) using [OpenAPI Generator](https://openapi-generator.tech/).
7+
A Java client for the [Brevo](https://www.brevo.com/?r=t) (formerly SendinBlue) API
8+
9+
> [!IMPORTANT]
10+
> An API-Key is required.<br/>
11+
> You can get it at https://app.brevo.com/settings/keys/api
12+
13+
This client [is generated](./brevo-java-client/pom.xml) from an [``openapi.yml``](./openapi/openapi.yml) using [OpenAPI Generator](https://openapi-generator.tech/).
14+
15+
> [!NOTE]
16+
> <details><summary>Why did you create this API client and not use the <a href="https://github.com/sendinblue/APIv3-java-library">the official</a>/<a href="https://github.com/getbrevo/brevo-java">new official</a> one?</summary>
17+
>
18+
> We had some problems (as of July 2025) with the "official" client:
19+
> * The (old) client looks seriously outdated:
20+
> * it is still called "SendinBlue"
21+
> * was last updated over a year ago and there was no activity (on issues/PR) since then
22+
> * There is at least one CVE in the underlying HTTP client
23+
> * It looks like there are problems with the underlying dependencies:
24+
> * ``maven-gpg-plugin`` is declared as compile dependency
25+
> * There is a [dependency for Java 7](https://www.threeten.org/threetenbp/) however the client is built for Java 8+
26+
> * There is an extremely outdated version of Apache Commons Lang in use
27+
> * ...
28+
>
29+
> </details>
830
931
## Installation
10-
[Installation guide for the latest release](https://github.com/xdev-software/template-placeholder/releases/latest#Installation)
32+
[Installation guide for the latest release](https://github.com/xdev-software/brevo-java-client/releases/latest#Installation)
1133

1234
## Demo
13-
A minimal demo is also available [here](./template-placeholder-demo/src/main/java/software/xdev/Application.java).
35+
A minimal demo is also available [here](./brevo-java-client-demo/src/main/java/software/xdev/Application.java).
1436

1537
## Support
1638
If you need support as soon as possible and you can't wait for any pull request, feel free to use [our support](https://xdev.software/en/services/support).
@@ -19,4 +41,6 @@ If you need support as soon as possible and you can't wait for any pull request,
1941
See the [contributing guide](./CONTRIBUTING.md) for detailed instructions on how to get started with our project.
2042

2143
## Dependencies and Licenses
22-
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/template-placeholder/dependencies)
44+
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/brevo-java-client/dependencies)
45+
46+
<sub>Disclaimer: This is not an official Brevo product and not associated with Brevo</sub>

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
## Reporting a Vulnerability
44

5-
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/template-placeholder/security/advisories/new).
5+
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/brevo-java-client/security/advisories/new).

template-placeholder-demo/pom.xml renamed to brevo-java-client-demo/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
<parent>
88
<groupId>software.xdev</groupId>
9-
<artifactId>template-placeholder-root</artifactId>
10-
<version>1.0.0-SNAPSHOT</version>
9+
<artifactId>brevo-java-client-root</artifactId>
10+
<version>1.1.1-SNAPSHOT</version>
1111
</parent>
1212

13-
<artifactId>template-placeholder-demo</artifactId>
14-
<version>1.0.0-SNAPSHOT</version>
13+
<artifactId>brevo-java-client-demo</artifactId>
14+
<version>1.1.1-SNAPSHOT</version>
1515
<packaging>jar</packaging>
1616

1717
<organization>
@@ -34,7 +34,7 @@
3434
<dependencies>
3535
<dependency>
3636
<groupId>software.xdev</groupId>
37-
<artifactId>template-placeholder</artifactId>
37+
<artifactId>brevo-java-client</artifactId>
3838
<version>${project.version}</version>
3939
</dependency>
4040

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
package software.xdev;
2+
3+
import java.util.List;
4+
import java.util.Optional;
5+
import java.util.Scanner;
6+
import java.util.function.Function;
7+
8+
import org.apache.hc.core5.http.HttpStatus;
9+
import org.slf4j.Logger;
10+
import org.slf4j.LoggerFactory;
11+
12+
import software.xdev.brevo.api.ContactsApi;
13+
import software.xdev.brevo.client.ApiClient;
14+
import software.xdev.brevo.client.ApiException;
15+
import software.xdev.brevo.model.CreateContact;
16+
import software.xdev.brevo.model.CreateUpdateContactModel;
17+
import software.xdev.brevo.model.GetContactInfoIdentifierParameter;
18+
import software.xdev.brevo.model.GetExtendedContactDetails;
19+
import software.xdev.brevo.model.UpdateContact;
20+
21+
22+
public final class Application
23+
{
24+
private static final Logger LOG = LoggerFactory.getLogger(Application.class);
25+
26+
static Scanner scanner = new Scanner(System.in);
27+
28+
// Tries to add an email/contact to a list
29+
public static void main(final String[] args)
30+
{
31+
final ApiClient apiClient = new ApiClient();
32+
apiClient.setApiKey(getProperty("API-KEY", Function.identity()));
33+
apiClient.setUserAgent("Brevo Java Client");
34+
35+
final long listId = getProperty("LIST-ID", Long::parseLong);
36+
final String email = getProperty("EMAIL-FOR-LIST", Function.identity());
37+
38+
final ContactsApi contactsApi = new ContactsApi(apiClient);
39+
try
40+
{
41+
final GetContactInfoIdentifierParameter identifier =
42+
new GetContactInfoIdentifierStringParameter(email);
43+
final GetExtendedContactDetails contactInfo = contactsApi.getContactInfo(
44+
identifier,
45+
null,
46+
null,
47+
null);
48+
LOG.info("Got contact[email={},listIds={}]", contactInfo.getEmail(), contactInfo.getListIds());
49+
if(!contactInfo.getListIds().contains(listId))
50+
{
51+
contactsApi.updateContact(
52+
identifier,
53+
new UpdateContact().listIds(List.of(listId)),
54+
null);
55+
LOG.info("Updated contact to include listId={}", listId);
56+
}
57+
}
58+
catch(final ApiException ex)
59+
{
60+
if(ex.getCode() == HttpStatus.SC_NOT_FOUND)
61+
{
62+
final CreateUpdateContactModel createdContact = contactsApi.createContact(new CreateContact()
63+
.email(email)
64+
.listIds(List.of(listId)));
65+
LOG.info("Created contact[id={}, email={},listIds={}]", createdContact.getId(), email, listId);
66+
}
67+
}
68+
}
69+
70+
private static <T> T getProperty(final String identifier, final Function<String, T> caster)
71+
{
72+
String value = Optional.ofNullable(System.getenv(identifier))
73+
.orElseGet(() -> System.getProperty(identifier));
74+
if(value == null)
75+
{
76+
LOG.error("Required {} not set in environment variables or system properties", identifier);
77+
78+
LOG.info("Please provide {} over console:", identifier);
79+
value = scanner.nextLine();
80+
81+
if(value == null || value.isBlank())
82+
{
83+
LOG.error("Invalid input; Aborting");
84+
System.exit(1);
85+
}
86+
}
87+
return caster.apply(value);
88+
}
89+
90+
private Application()
91+
{
92+
}
93+
94+
@SuppressWarnings("java:S2160")
95+
public static class GetContactInfoIdentifierStringParameter extends GetContactInfoIdentifierParameter
96+
{
97+
private final String value;
98+
99+
public GetContactInfoIdentifierStringParameter(final String value)
100+
{
101+
this.value = value;
102+
}
103+
104+
@Override
105+
public String toString()
106+
{
107+
return this.value;
108+
}
109+
}
110+
}

0 commit comments

Comments
 (0)