-
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
6c25952
commit fe5ff49
Showing
6 changed files
with
93 additions
and
84 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
src/main/java/io/github/ctlove0523/gotify/GotifyClientBuilder.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,45 @@ | ||
package io.github.ctlove0523.gotify; | ||
|
||
/** | ||
* @author chentong | ||
*/ | ||
public class GotifyClientBuilder { | ||
private String endpoint; | ||
|
||
private String userName; | ||
|
||
private String password; | ||
|
||
public GotifyClientBuilder endpoint(String endpoint) { | ||
this.endpoint = endpoint; | ||
return this; | ||
} | ||
|
||
public GotifyClientBuilder userName(String userName) { | ||
this.userName = userName; | ||
return this; | ||
} | ||
|
||
public GotifyClientBuilder password(String password) { | ||
this.password = password; | ||
return this; | ||
} | ||
|
||
public GotifyClient build() { | ||
GotifyClientConfig config = new GotifyClientConfig.Builder() | ||
.credential(new Credential() { | ||
@Override | ||
public String getUserName() { | ||
return userName; | ||
} | ||
|
||
@Override | ||
public String getPassword() { | ||
return password; | ||
} | ||
}) | ||
.endpoint(this.endpoint) | ||
.build(); | ||
return new GotifyClientImpl(config); | ||
} | ||
} |
43 changes: 9 additions & 34 deletions
43
src/main/java/io/github/ctlove0523/gotify/GotifyClientConfig.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
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
27 changes: 20 additions & 7 deletions
27
src/main/java/io/github/ctlove0523/gotify/MessageClientImpl.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
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