Skip to content

Commit 4989160

Browse files
committed
Merge branch 'develop' into update-from-template-merged
2 parents d8672c7 + 99a6690 commit 4989160

File tree

570 files changed

+212252
-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

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

0 commit comments

Comments
 (0)