-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
26f107b
commit cd4e53b
Showing
11 changed files
with
274 additions
and
114 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
plugin/src/main/groovy/org/bot4j/base/request/BaseConnections.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package org.bot4j.base.request; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
|
||
import java.io.Serializable; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class BaseConnections implements Serializable { | ||
public BaseConnections() { | ||
super(); | ||
} | ||
|
||
private boolean debugging = false; // enable to trace log as debug mode | ||
private boolean skip = false; // skipping the action for sending message | ||
private boolean retry = false; // enable retry REST HTTP API when sending message got failure | ||
private int maxRetries = 2; // retry no. times when sending message, default is 2 times | ||
|
||
public boolean isDebugging() { | ||
return debugging; | ||
} | ||
|
||
public void setDebugging(boolean debugging) { | ||
this.debugging = debugging; | ||
} | ||
|
||
public boolean isSkip() { | ||
return skip; | ||
} | ||
|
||
public void setSkip(boolean skip) { | ||
this.skip = skip; | ||
} | ||
|
||
public boolean isRetry() { | ||
return retry; | ||
} | ||
|
||
public void setRetry(boolean retry) { | ||
this.retry = retry; | ||
} | ||
|
||
public int getMaxRetries() { | ||
return maxRetries; | ||
} | ||
|
||
public void setMaxRetries(int maxRetries) { | ||
this.maxRetries = maxRetries; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.format("connections { debugging: %s, skip: %s, retry: %s, max_retries: %d }", | ||
this.debugging, this.skip, this.retry, this.maxRetries); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
plugin/src/main/groovy/org/bot4j/base/request/BaseOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.bot4j.base.request; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import org.unify4j.common.UniqueId4j; | ||
|
||
import java.io.Serializable; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class BaseOptions implements Serializable { | ||
public BaseOptions() { | ||
super(); | ||
this.setRequestId(String.valueOf(UniqueId4j.getUniqueId19())); | ||
} | ||
|
||
private String requestId; | ||
|
||
public String getRequestId() { | ||
return requestId; | ||
} | ||
|
||
public void setRequestId(String requestId) { | ||
this.requestId = requestId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
plugin/src/main/groovy/org/bot4j/viber/model/builder/ViberConnectionBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.bot4j.viber.model.builder; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import org.bot4j.viber.model.request.ViberConnections; | ||
|
||
import java.io.Serializable; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class ViberConnectionBuilder implements Serializable { | ||
public ViberConnectionBuilder() { | ||
super(); | ||
} | ||
|
||
private boolean debugging = false; // enable to trace log as debug mode | ||
private boolean skip = false; // skipping the action for sending message | ||
private boolean retry = false; // enable retry REST HTTP API when sending message got failure | ||
private int maxRetries = 2; // retry no. times when sending message, default is 2 times | ||
|
||
public ViberConnectionBuilder debugging(boolean value) { | ||
this.debugging = value; | ||
return this; | ||
} | ||
|
||
public ViberConnectionBuilder skip(boolean value) { | ||
this.skip = value; | ||
return this; | ||
} | ||
|
||
public ViberConnectionBuilder retry(boolean value) { | ||
this.retry = value; | ||
return this; | ||
} | ||
|
||
public ViberConnectionBuilder maxRetries(int value) { | ||
this.maxRetries = value; | ||
return this; | ||
} | ||
|
||
public ViberConnections build() { | ||
ViberConnections e = new ViberConnections(); | ||
e.setDebugging(debugging); | ||
e.setSkip(skip); | ||
e.setRetry(retry); | ||
e.setMaxRetries(maxRetries); | ||
return e; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
plugin/src/main/groovy/org/bot4j/viber/model/builder/ViberOptionBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.bot4j.viber.model.builder; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import org.bot4j.viber.model.request.ViberOptions; | ||
import org.unify4j.common.UniqueId4j; | ||
|
||
import java.io.Serializable; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class ViberOptionBuilder implements Serializable { | ||
public ViberOptionBuilder() { | ||
super(); | ||
this.requestId = String.valueOf(UniqueId4j.getUniqueId19()); | ||
} | ||
|
||
private String requestId; | ||
|
||
public ViberOptionBuilder requestId(String value) { | ||
this.requestId = value; | ||
return this; | ||
} | ||
|
||
public ViberOptions build() { | ||
ViberOptions e = new ViberOptions(); | ||
e.setRequestId(this.requestId); | ||
return e; | ||
} | ||
} |
Oops, something went wrong.