-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add internal dependencies version to bom module * Update missing dependencies * Adding plugin to http and template submodule * Ability to directly set privateKey and certificate content User can set the privateKey and certificate content in bytes array to BdkConfig for bot and app authentication. Only one of path or content should be configured. If user configure both of them, an AuthInitializationException will be thrown. The exception should be thrown at the step of initializing the Authenticator instead of loading config because the BdkConfig can be set programmatically. Unittest added * Fix typo and add documentation * Update documentation * Enhancements on message service Move MessageService to package com.symphony.bdk.core.service.message Make the TemplateException extends RuntimeException -> Remove all the throws TemplateException. Rename MessageService#send(streamId, template, Object) -> MessageService#sendWithTemplate Provide MessageService#send(streamId, template) to send a templated message without passing any parameter instead of passing null to the existing method. Provide method MessageService#send(streamId, message, data, attachment) to send a message with data and attachment (streamId can be replaced by a V4Stream instance) Small fix on webclient api to perform multipart/form-data request. Unittest added * Create message and attachment model to use in MessageService Adding two methods to send message passing a Message instance instead of many parameters Adding ComplexMessageExampleMain.java to show the usage of the Message model. These methods and example is under reviewing. The code will be refactored after review. * Refactor MessageService and update unittest * Provide MessageService#builder to build a message instance from MessageService * Update handling attachments
- Loading branch information
1 parent
fb8f0d1
commit 4e33973
Showing
30 changed files
with
491 additions
and
103 deletions.
There are no files selected for viewing
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
18 changes: 18 additions & 0 deletions
18
...c/main/java/com/symphony/bdk/core/service/message/exception/MessageCreationException.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,18 @@ | ||
package com.symphony.bdk.core.service.message.exception; | ||
|
||
import org.apiguardian.api.API; | ||
|
||
/** | ||
* Exception thrown when a {@link com.symphony.bdk.core.service.message.model.Message} is failed to create. | ||
*/ | ||
@API(status = API.Status.STABLE) | ||
public class MessageCreationException extends RuntimeException { | ||
|
||
public MessageCreationException(String message, Exception e) { | ||
super(message, e); | ||
} | ||
|
||
public MessageCreationException(String message) { | ||
super(message); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
symphony-bdk-core/src/main/java/com/symphony/bdk/core/service/message/model/Attachment.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,27 @@ | ||
package com.symphony.bdk.core.service.message.model; | ||
|
||
import com.symphony.bdk.core.service.message.exception.MessageCreationException; | ||
|
||
import lombok.Getter; | ||
import org.apiguardian.api.API; | ||
|
||
import java.io.InputStream; | ||
|
||
/** | ||
* Attachment model to be used in {@link MessageBuilder} to attach a file to a {@link Message} | ||
*/ | ||
@Getter | ||
@API(status = API.Status.EXPERIMENTAL) | ||
public class Attachment { | ||
|
||
private final InputStream inputStream; | ||
private final String filename; | ||
|
||
public Attachment(InputStream inputStream, String filename) { | ||
this.inputStream = inputStream; | ||
if (filename.split("\\.").length < 2 ) { | ||
throw new MessageCreationException("Invalid attachment's file name."); | ||
} | ||
this.filename = filename; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
symphony-bdk-core/src/main/java/com/symphony/bdk/core/service/message/model/Message.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 com.symphony.bdk.core.service.message.model; | ||
|
||
import com.symphony.bdk.gen.api.model.V4Stream; | ||
|
||
import lombok.Getter; | ||
import org.apiguardian.api.API; | ||
|
||
/** | ||
* Message model to be used in {@link com.symphony.bdk.core.service.message.MessageService#send(V4Stream, Message)} | ||
*/ | ||
@Getter | ||
@API(status = API.Status.EXPERIMENTAL) | ||
public class Message { | ||
|
||
// The version of the MessageML format | ||
private final String version; | ||
private final String content; | ||
private final String data; | ||
private final Attachment attachment; | ||
|
||
protected Message(MessageBuilder builder) { | ||
this.version = builder.version(); | ||
this.content = builder.content(); | ||
this.data = builder.data(); | ||
this.attachment = builder.attachment(); | ||
} | ||
|
||
} |
Oops, something went wrong.