com.mailgun.model.events.EventsQueryOptions Maven / Gradle / Ivy
Show all versions of mailgun-java Show documentation
package com.mailgun.model.events;
import com.mailgun.enums.EventType;
import com.mailgun.enums.Severity;
import com.mailgun.enums.YesNo;
import feign.Param;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
import java.time.ZonedDateTime;
/**
*
* Events Query Options.
*
*
* @see Query Options
*/
@Getter
@ToString
@EqualsAndHashCode
@Builder
public class EventsQueryOptions {
/**
*
* The beginning of the search time range in Linux epoch seconds.
*
*
* @see Time Range
*/
Long begin;
/**
*
* The end of the search time range in Linux epoch seconds.
*
*
* @see Time Range
*/
Long end;
/**
*
* Defines the direction of the search time range and must be provided if the range end time is not specified.
*
* Can be either yes
or no
*
* @see Time Range
*/
String ascending;
/**
*
* Number of entries to return. (300 max)
*
*/
Integer limit;
/**
*
* An event type.
*
*/
String event;
/**
*
* A name of an attached file.
*
*/
String attachment;
/**
*
* Filter Expression for the from
field.
* An email address mentioned in the from
MIME header.
*
*
* The value of the parameter should be a valid Filter Expression.
*
*
* Examples:
*
*
* foo bar
Matches field values that contain both term foo and term bar.
* foo AND bar
Same as above.
* foo OR bar
Matches field values that contain either term foo or term bar.
* “foo bar”
Matches field values that literally contain foo bar.
* NOT foo
Matches field values that do not contain term foo.
*
*
* Note that more then one expression can be used as a filter value and parentheses can be used to specify grouping.
*
*
* E.g.: (Hello AND NOT Rachel) OR (Farewell AND Monica)
.
*
*/
String from;
/**
*
* Filter Expression for the messageId
field.
* A Mailgun message id returned by the messages API.
*
*
* The value of the parameter should be a valid Filter Expression.
*
*
* Examples:
*
*
* foo bar
Matches field values that contain both term foo and term bar.
* foo AND bar
Same as above.
* foo OR bar
Matches field values that contain either term foo or term bar.
* “foo bar”
Matches field values that literally contain foo bar.
* NOT foo
Matches field values that do not contain term foo.
*
*
* Note that more then one expression can be used as a filter value and parentheses can be used to specify grouping.
*
*
* E.g.: (Hello AND NOT Rachel) OR (Farewell AND Monica)
.
*
*/
@Param("message-id")
String messageId;
/**
*
* Filter Expression for the subject
field.
* A subject line.
*
*
* The value of the parameter should be a valid Filter Expression.
*
*
* Examples:
*
*
* foo bar
Matches field values that contain both term foo and term bar.
* foo AND bar
Same as above.
* foo OR bar
Matches field values that contain either term foo or term bar.
* “foo bar”
Matches field values that literally contain foo bar.
* NOT foo
Matches field values that do not contain term foo.
*
*
* Note that more then one expression can be used as a filter value and parentheses can be used to specify grouping.
*
*
* E.g.: (Hello AND NOT Rachel) OR (Farewell AND Monica)
.
*
*/
String subject;
/**
*
* Filter Expression for the to
field.
* An email address mentioned in the to
MIME header.
*
*
* The value of the parameter should be a valid Filter Expression.
*
*
* Examples:
*
*
* foo bar
Matches field values that contain both term foo and term bar.
* foo AND bar
Same as above.
* foo OR bar
Matches field values that contain either term foo or term bar.
* “foo bar”
Matches field values that literally contain foo bar.
* NOT foo
Matches field values that do not contain term foo.
*
*
* Note that more then one expression can be used as a filter value and parentheses can be used to specify grouping.
*
*
* E.g.: (Hello AND NOT Rachel) OR (Farewell AND Monica)
.
*
*/
String to;
/**
*
* Filter Expression for the size
field.
* Message size.
*
*
* The value of the parameter should be a valid Filter Expression.
*
*
* Examples:
*
*
* 10000
Matches values that greater then 10000.
* >10000 <20000
Matches values that are greater then 10000 and less then 20000.
*
*/
String size;
/**
*
* Filter Expression for the recipient
field.
* An email address of a particular recipient.
*
*
* The value of the parameter should be a valid Filter Expression.
*
*
* Examples:
*
*
* foo bar
Matches field values that contain both term foo and term bar.
* foo AND bar
Same as above.
* foo OR bar
Matches field values that contain either term foo or term bar.
* “foo bar”
Matches field values that literally contain foo bar.
* NOT foo
Matches field values that do not contain term foo.
*
*
* Note that more then one expression can be used as a filter value and parentheses can be used to specify grouping.
*
*
* E.g.: (Hello AND NOT Rachel) OR (Farewell AND Monica)
.
*
*/
String recipient;
/**
*
* Filter Expression for the recipients
field.
* Specific to stored events, this field tracks all of the potential message recipients.
*
*
* The value of the parameter should be a valid Filter Expression.
*
*
* Examples:
*
*
* foo bar
Matches field values that contain both term foo and term bar.
* foo AND bar
Same as above.
* foo OR bar
Matches field values that contain either term foo or term bar.
* “foo bar”
Matches field values that literally contain foo bar.
* NOT foo
Matches field values that do not contain term foo.
*
*
* Note that more then one expression can be used as a filter value and parentheses can be used to specify grouping.
*
*
* E.g.: (Hello AND NOT Rachel) OR (Farewell AND Monica)
.
*
*/
String recipients;
/**
*
* Filter Expression for the tags
field.
* User defined tags.
*
*
* The value of the parameter should be a valid Filter Expression.
*
*
* Examples:
*
*
* foo bar
Matches field values that contain both term foo and term bar.
* foo AND bar
Same as above.
* foo OR bar
Matches field values that contain either term foo or term bar.
* “foo bar”
Matches field values that literally contain foo bar.
* NOT foo
Matches field values that do not contain term foo.
*
*
* Note that more then one expression can be used as a filter value and parentheses can be used to specify grouping.
*
*
* E.g.: (Hello AND NOT Rachel) OR (Farewell AND Monica)
.
*
*/
String tags;
/**
*
* Used to filter events based on severity, if exists. (Currently failed events only)
* Temporary
or Permanent
.
*
*/
String severity;
public static class EventsQueryOptionsBuilder {
/**
*
* The beginning of the search time range.
*
*
* @param time The beginning of the search time range.
* @return Returns a reference to this object so that method calls can be chained together.
* @see Time Range
*/
public EventsQueryOptions.EventsQueryOptionsBuilder begin(ZonedDateTime time) {
this.begin = time.toEpochSecond();
return this;
}
/**
*
* The beginning of the search time range in Linux epoch seconds.
*
*
* @param time The beginning of the search time range in Linux epoch seconds.
* @return Returns a reference to this object so that method calls can be chained together.
* @see Time Range
*/
public EventsQueryOptions.EventsQueryOptionsBuilder begin(Long time) {
this.begin = time;
return this;
}
/**
*
* The end of the search time range.
*
*
* @param time The end of the search time range {@link ZonedDateTime}
* @return Returns a reference to this object so that method calls can be chained together.
* @see Time Range
*/
public EventsQueryOptions.EventsQueryOptionsBuilder end(ZonedDateTime time) {
this.end = time.toEpochSecond();
return this;
}
/**
*
* The end of the search time range in Linux epoch seconds.
*
*
* @param time The end of the search time range in Linux epoch seconds.
* @return Returns a reference to this object so that method calls can be chained together.
* @see Time Range
*/
public EventsQueryOptions.EventsQueryOptionsBuilder end(Long time) {
this.end = time;
return this;
}
/**
*
* Defines the direction of the search time range and must be provided if the range end time is not specified.
*
* Can be either true
or false
*
* @param ascending Defines the direction of the search time range and must be provided if the range end time is not specified.
* Can be either true
or false
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EventsQueryOptions.EventsQueryOptionsBuilder ascending(boolean ascending) {
this.ascending = YesNo.getValue(ascending);
return this;
}
/**
*
* An event type.
*
*
* @param event An event type.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EventsQueryOptions.EventsQueryOptionsBuilder event(EventType event) {
this.event = event.getValue();
return this;
}
/**
*
* Filter Expression for the event
field.
*
*
* The value of the parameter should be a valid Filter Expression.
*
*
* Examples:
*
*
* foo bar
Matches field values that contain both term foo and term bar.
* foo AND bar
Same as above.
* foo OR bar
Matches field values that contain either term foo or term bar.
* “foo bar”
Matches field values that literally contain foo bar.
* NOT foo
Matches field values that do not contain term foo.
*
*
* Note that more then one expression can be used as a filter value and parentheses can be used to specify grouping.
*
*
* E.g.: (Hello AND NOT Rachel) OR (Farewell AND Monica)
.
*
*
* @param filterExpression Filter Expression
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EventsQueryOptions.EventsQueryOptionsBuilder eventFieldFilterExpression(String filterExpression) {
this.event = filterExpression;
return this;
}
/**
*
* Used to filter events based on severity, if exists. (Currently failed events only)
* Temporary
or Permanent
.
*
*
* @param severity severity
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EventsQueryOptions.EventsQueryOptionsBuilder severity(Severity severity) {
this.severity = severity.getValue();
return this;
}
/**
*
* Filter Expression for the attachment
field.
* A name of an attached file.
*
*
* The value of the parameter should be a valid Filter Expression.
*
*
* Examples:
*
*
* foo bar
Matches field values that contain both term foo and term bar.
* foo AND bar
Same as above.
* foo OR bar
Matches field values that contain either term foo or term bar.
* “foo bar”
Matches field values that literally contain foo bar.
* NOT foo
Matches field values that do not contain term foo.
*
*
* Note that more then one expression can be used as a filter value and parentheses can be used to specify grouping.
*
*
* E.g.: (Hello AND NOT Rachel) OR (Farewell AND Monica)
.
*
*
* @param filterExpression Filter Expression
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EventsQueryOptions.EventsQueryOptionsBuilder attachment(String filterExpression) {
this.attachment = filterExpression;
return this;
}
/**
*
* Filter Expression for the from
field.
* An email address mentioned in the from
MIME header.
*
*
* The value of the parameter should be a valid Filter Expression.
*
*
* Examples:
*
*
* foo bar
Matches field values that contain both term foo and term bar.
* foo AND bar
Same as above.
* foo OR bar
Matches field values that contain either term foo or term bar.
* “foo bar”
Matches field values that literally contain foo bar.
* NOT foo
Matches field values that do not contain term foo.
*
*
* Note that more then one expression can be used as a filter value and parentheses can be used to specify grouping.
*
*
* E.g.: (Hello AND NOT Rachel) OR (Farewell AND Monica)
.
*
*
* @param filterExpression Filter Expression
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EventsQueryOptions.EventsQueryOptionsBuilder from(String filterExpression) {
this.from = filterExpression;
return this;
}
/**
*
* Filter Expression for the messageId
field.
* A Mailgun message id returned by the messages API.
*
*
* The value of the parameter should be a valid Filter Expression.
*
*
* Examples:
*
*
* foo bar
Matches field values that contain both term foo and term bar.
* foo AND bar
Same as above.
* foo OR bar
Matches field values that contain either term foo or term bar.
* “foo bar”
Matches field values that literally contain foo bar.
* NOT foo
Matches field values that do not contain term foo.
*
*
* Note that more then one expression can be used as a filter value and parentheses can be used to specify grouping.
*
*
* E.g.: (Hello AND NOT Rachel) OR (Farewell AND Monica)
.
*
*
* @param filterExpression Filter Expression
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EventsQueryOptions.EventsQueryOptionsBuilder messageId(String filterExpression) {
this.messageId = filterExpression;
return this;
}
/**
*
* Filter Expression for the subject
field.
* A subject line.
*
*
* The value of the parameter should be a valid Filter Expression.
*
*
* Examples:
*
*
* foo bar
Matches field values that contain both term foo and term bar.
* foo AND bar
Same as above.
* foo OR bar
Matches field values that contain either term foo or term bar.
* “foo bar”
Matches field values that literally contain foo bar.
* NOT foo
Matches field values that do not contain term foo.
*
*
* Note that more then one expression can be used as a filter value and parentheses can be used to specify grouping.
*
*
* E.g.: (Hello AND NOT Rachel) OR (Farewell AND Monica)
.
*
*
* @param filterExpression Filter Expression
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EventsQueryOptions.EventsQueryOptionsBuilder subject(String filterExpression) {
this.subject = filterExpression;
return this;
}
/**
*
* Filter Expression for the to
field.
* An email address mentioned in the to
MIME header.
*
*
* The value of the parameter should be a valid Filter Expression.
*
*
* Examples:
*
*
* foo bar
Matches field values that contain both term foo and term bar.
* foo AND bar
Same as above.
* foo OR bar
Matches field values that contain either term foo or term bar.
* “foo bar”
Matches field values that literally contain foo bar.
* NOT foo
Matches field values that do not contain term foo.
*
*
* Note that more then one expression can be used as a filter value and parentheses can be used to specify grouping.
*
*
* E.g.: (Hello AND NOT Rachel) OR (Farewell AND Monica)
.
*
*
* @param filterExpression Filter Expression
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EventsQueryOptions.EventsQueryOptionsBuilder to(String filterExpression) {
this.to = filterExpression;
return this;
}
/**
*
* Filter Expression for the size
field.
* Message size.
*
*
* The value of the parameter should be a valid Filter Expression.
*
*
* Examples:
*
*
* 10000
Matches values that greater then 10000.
* >10000 <20000
Matches values that are greater then 10000 and less then 20000.
*
*
* @param filterExpression Filter Expression
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EventsQueryOptions.EventsQueryOptionsBuilder size(String filterExpression) {
this.size = filterExpression;
return this;
}
/**
*
* Filter Expression for the recipient
field.
* An email address of a particular recipient.
*
*
* The value of the parameter should be a valid Filter Expression.
*
*
* Examples:
*
*
* foo bar
Matches field values that contain both term foo and term bar.
* foo AND bar
Same as above.
* foo OR bar
Matches field values that contain either term foo or term bar.
* “foo bar”
Matches field values that literally contain foo bar.
* NOT foo
Matches field values that do not contain term foo.
*
*
* Note that more then one expression can be used as a filter value and parentheses can be used to specify grouping.
*
*
* E.g.: (Hello AND NOT Rachel) OR (Farewell AND Monica)
.
*
*
* @param filterExpression Filter Expression
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EventsQueryOptions.EventsQueryOptionsBuilder recipient(String filterExpression) {
this.recipient = filterExpression;
return this;
}
/**
*
* Filter Expression for the recipients
field.
* Specific to stored events, this field tracks all of the potential message recipients.
*
*
* The value of the parameter should be a valid Filter Expression.
*
*
* Examples:
*
*
* foo bar
Matches field values that contain both term foo and term bar.
* foo AND bar
Same as above.
* foo OR bar
Matches field values that contain either term foo or term bar.
* “foo bar”
Matches field values that literally contain foo bar.
* NOT foo
Matches field values that do not contain term foo.
*
*
* Note that more then one expression can be used as a filter value and parentheses can be used to specify grouping.
*
*
* E.g.: (Hello AND NOT Rachel) OR (Farewell AND Monica)
.
*
*
* @param filterExpression Filter Expression
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EventsQueryOptions.EventsQueryOptionsBuilder recipients(String filterExpression) {
this.recipients = filterExpression;
return this;
}
/**
*
* Filter Expression for the tags
field.
* User defined tags.
*
*
* The value of the parameter should be a valid Filter Expression.
*
*
* Examples:
*
*
* foo bar
Matches field values that contain both term foo and term bar.
* foo AND bar
Same as above.
* foo OR bar
Matches field values that contain either term foo or term bar.
* “foo bar”
Matches field values that literally contain foo bar.
* NOT foo
Matches field values that do not contain term foo.
*
*
* Note that more then one expression can be used as a filter value and parentheses can be used to specify grouping.
*
*
* E.g.: (Hello AND NOT Rachel) OR (Farewell AND Monica)
.
*
*
* @param filterExpression Filter Expression
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EventsQueryOptions.EventsQueryOptionsBuilder tags(String filterExpression) {
this.tags = filterExpression;
return this;
}
}
}