Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": "^.secrets.baseline$",
"lines": null
},
"generated_at": "2025-10-28T04:20:32Z",
"generated_at": "2025-12-09T14:05:00Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down Expand Up @@ -136,7 +136,7 @@
"hashed_secret": "9bf92274d58c3655b80055ad2ab17540f71d3058",
"is_secret": false,
"is_verified": false,
"line_number": 3295,
"line_number": 3373,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ SDK Methods to consume
- [Verify SMTP](#verify-smtp)
- [Metrics](#Metrics)
- [Get Metrics](#get-metrics)
- [Get Bounce Metrics](#get-bounce-metrics)
- [Send Notifications](#send-notifications)

## Source
Expand Down Expand Up @@ -1354,7 +1355,9 @@ GetMetricsOptions getMetricsOptionsModel = new GetMetricsOptions.Builder()
.gte(<gte-timestamp>)
.lte(<lte-timestamp>)
.destinationId(<destination-id>)
.subscriptionId(<subscription-id>)
.emailTo(<email-to>)
.sourceId(<source-id>)
.notificationId(<notification-id>)
.subject(<subject>)
.build();
Expand All @@ -1364,6 +1367,26 @@ Response<Metrics> response = eventNotificationsService.getMetrics(getMetricsOpti
Metrics responseObj = response.getResult();
```

### Get Bounce Metrics

```java
GetBounceMetricsOptions getBounceMetricsOptionsModel = new GetBounceMetricsOptions.Builder()
.instanceId(instanceId)
.destinationType("smtp_custom")
.gte(<gte-timestamp>)
.lte(<lte-timestamp>)
.destinationId(<destination-id>)
.subscriptionId(<subscription-id>)
.emailTo(<email-to>)
.sourceId(<source-id>)
.notificationId(<notification-id>)
.subject(<subject>)
.build();

Response<BounceMetrics> response = eventNotificationsService.getBounceMetrics(getBounceMetricsOptionsModel).execute();
BounceMetrics responseObj = response.getResult();
```

### Send Notifications

```java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import com.google.gson.JsonObject;
import com.ibm.cloud.event_notifications.common.SdkCommon;
import com.ibm.cloud.eventnotifications.event_notifications.v1.model.BounceMetrics;
import com.ibm.cloud.eventnotifications.event_notifications.v1.model.CreateDestinationOptions;
import com.ibm.cloud.eventnotifications.event_notifications.v1.model.CreateIntegrationOptions;
import com.ibm.cloud.eventnotifications.event_notifications.v1.model.CreateSmtpConfigurationOptions;
Expand All @@ -41,6 +42,7 @@
import com.ibm.cloud.eventnotifications.event_notifications.v1.model.DestinationResponse;
import com.ibm.cloud.eventnotifications.event_notifications.v1.model.DestinationTagsSubscriptionResponse;
import com.ibm.cloud.eventnotifications.event_notifications.v1.model.EnabledCountriesResponse;
import com.ibm.cloud.eventnotifications.event_notifications.v1.model.GetBounceMetricsOptions;
import com.ibm.cloud.eventnotifications.event_notifications.v1.model.GetDestinationOptions;
import com.ibm.cloud.eventnotifications.event_notifications.v1.model.GetEnabledCountriesOptions;
import com.ibm.cloud.eventnotifications.event_notifications.v1.model.GetIntegrationOptions;
Expand Down Expand Up @@ -197,6 +199,9 @@ public ServiceCall<Metrics> getMetrics(GetMetricsOptions getMetricsOptions) {
if (getMetricsOptions.destinationId() != null) {
builder.query("destination_id", String.valueOf(getMetricsOptions.destinationId()));
}
if (getMetricsOptions.subscriptionId() != null) {
builder.query("subscription_id", String.valueOf(getMetricsOptions.subscriptionId()));
}
if (getMetricsOptions.sourceId() != null) {
builder.query("source_id", String.valueOf(getMetricsOptions.sourceId()));
}
Expand All @@ -214,6 +219,57 @@ public ServiceCall<Metrics> getMetrics(GetMetricsOptions getMetricsOptions) {
return createServiceCall(builder.build(), responseConverter);
}

/**
* Get bounce metrics.
*
* Get bounce metrics.
*
* @param getBounceMetricsOptions the {@link GetBounceMetricsOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link BounceMetrics}
*/
public ServiceCall<BounceMetrics> getBounceMetrics(GetBounceMetricsOptions getBounceMetricsOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(getBounceMetricsOptions,
"getBounceMetricsOptions cannot be null");
Map<String, String> pathParamsMap = new HashMap<String, String>();
pathParamsMap.put("instance_id", getBounceMetricsOptions.instanceId());
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/instances/{instance_id}/metrics/bounce", pathParamsMap));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("event_notifications", "v1", "getBounceMetrics");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
builder.query("destination_type", String.valueOf(getBounceMetricsOptions.destinationType()));
builder.query("gte", String.valueOf(getBounceMetricsOptions.gte()));
builder.query("lte", String.valueOf(getBounceMetricsOptions.lte()));
if (getBounceMetricsOptions.destinationId() != null) {
builder.query("destination_id", String.valueOf(getBounceMetricsOptions.destinationId()));
}
if (getBounceMetricsOptions.subscriptionId() != null) {
builder.query("subscription_id", String.valueOf(getBounceMetricsOptions.subscriptionId()));
}
if (getBounceMetricsOptions.sourceId() != null) {
builder.query("source_id", String.valueOf(getBounceMetricsOptions.sourceId()));
}
if (getBounceMetricsOptions.emailTo() != null) {
builder.query("email_to", String.valueOf(getBounceMetricsOptions.emailTo()));
}
if (getBounceMetricsOptions.notificationId() != null) {
builder.query("notification_id", String.valueOf(getBounceMetricsOptions.notificationId()));
}
if (getBounceMetricsOptions.subject() != null) {
builder.query("subject", String.valueOf(getBounceMetricsOptions.subject()));
}
if (getBounceMetricsOptions.limit() != null) {
builder.query("limit", String.valueOf(getBounceMetricsOptions.limit()));
}
if (getBounceMetricsOptions.offset() != null) {
builder.query("offset", String.valueOf(getBounceMetricsOptions.offset()));
}
ResponseConverter<BounceMetrics> responseConverter =
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<BounceMetrics>() { }.getType());
return createServiceCall(builder.build(), responseConverter);
}

/**
* Send a notification.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/*
* (C) Copyright IBM Corp. 2025.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package com.ibm.cloud.eventnotifications.event_notifications.v1.model;

import java.util.Date;

import com.google.gson.annotations.SerializedName;
import com.ibm.cloud.sdk.core.service.model.GenericModel;

/**
* Bounce metric object.
*/
public class BounceMetricItem extends GenericModel {

@SerializedName("email_address")
protected String emailAddress;
protected String subject;
@SerializedName("error_message")
protected String errorMessage;
@SerializedName("ip_address")
protected String ipAddress;
@SerializedName("subscription_id")
protected String subscriptionId;
protected Date timestamp;

protected BounceMetricItem() { }

/**
* Gets the emailAddress.
*
* Email address.
*
* @return the emailAddress
*/
public String getEmailAddress() {
return emailAddress;
}

/**
* Gets the subject.
*
* Subject.
*
* @return the subject
*/
public String getSubject() {
return subject;
}

/**
* Gets the errorMessage.
*
* Error message.
*
* @return the errorMessage
*/
public String getErrorMessage() {
return errorMessage;
}

/**
* Gets the ipAddress.
*
* IP address.
*
* @return the ipAddress
*/
public String getIpAddress() {
return ipAddress;
}

/**
* Gets the subscriptionId.
*
* Subscription ID.
*
* @return the subscriptionId
*/
public String getSubscriptionId() {
return subscriptionId;
}

/**
* Gets the timestamp.
*
* Bounced at.
*
* @return the timestamp
*/
public Date getTimestamp() {
return timestamp;
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* (C) Copyright IBM Corp. 2025.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package com.ibm.cloud.eventnotifications.event_notifications.v1.model;

import java.util.List;

import com.google.gson.annotations.SerializedName;
import com.ibm.cloud.sdk.core.service.model.GenericModel;

/**
* Payload describing bounce metrics.
*/
public class BounceMetrics extends GenericModel {

protected List<BounceMetricItem> metrics;
@SerializedName("total_count")
protected Long totalCount;

protected BounceMetrics() { }

/**
* Gets the metrics.
*
* array of bounce metrics.
*
* @return the metrics
*/
public List<BounceMetricItem> getMetrics() {
return metrics;
}

/**
* Gets the totalCount.
*
* total number of bounce metrics.
*
* @return the totalCount
*/
public Long getTotalCount() {
return totalCount;
}
}

Loading
Loading