-
Notifications
You must be signed in to change notification settings - Fork 77
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
Showing
16 changed files
with
415 additions
and
23 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
57 changes: 57 additions & 0 deletions
57
src/main/java/com/github/jaemon/dinger/bytetalk/FeiShuDefinitionGenerator.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 @@ | ||
/* | ||
* Copyright ©2015-2022 Jaemon. All Rights Reserved. | ||
* | ||
* 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.github.jaemon.dinger.bytetalk; | ||
|
||
import com.github.jaemon.dinger.core.DingerDefinition; | ||
import com.github.jaemon.dinger.core.DingerDefinitionGenerator; | ||
import com.github.jaemon.dinger.core.DingerDefinitionGeneratorContext; | ||
import com.github.jaemon.dinger.core.DingerDefinitionHandler; | ||
import com.github.jaemon.dinger.core.annatations.DingerText; | ||
import com.github.jaemon.dinger.core.entity.enums.DingerDefinitionType; | ||
import com.github.jaemon.dinger.core.entity.enums.DingerType; | ||
import com.github.jaemon.dinger.core.entity.xml.MessageTag; | ||
|
||
/** | ||
* 飞书消息体定义生成类 | ||
* | ||
* @author Jaemon | ||
* @since 1.0 | ||
*/ | ||
public class FeiShuDefinitionGenerator extends DingerDefinitionHandler { | ||
/** | ||
* 生成生成注解文本消息体定义 | ||
*/ | ||
public static class AnnotationText extends DingerDefinitionGenerator<DingerText> { | ||
|
||
@Override | ||
public DingerDefinition generator(DingerDefinitionGeneratorContext<DingerText> context) { | ||
return dingerTextHandler(DingerType.BYTETALK, context); | ||
} | ||
} | ||
|
||
|
||
/** | ||
* 生成XML文本消息体定义 | ||
*/ | ||
public static class XmlText extends DingerDefinitionGenerator<MessageTag> { | ||
|
||
@Override | ||
public DingerDefinition generator(DingerDefinitionGeneratorContext<MessageTag> context) { | ||
return xmlHandler(DingerDefinitionType.BYTETALK_XML_TEXT, context); | ||
} | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/com/github/jaemon/dinger/bytetalk/entity/ByteTalkMessage.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,31 @@ | ||
/* | ||
* Copyright ©2015-2022 Jaemon. All Rights Reserved. | ||
* | ||
* 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.github.jaemon.dinger.bytetalk.entity; | ||
|
||
import com.github.jaemon.dinger.core.entity.MsgType; | ||
import com.github.jaemon.dinger.core.entity.enums.DingerType; | ||
|
||
/** | ||
* ByteTalk请求体 | ||
* | ||
* @author Jaemon | ||
* @since 1.0 | ||
*/ | ||
public class ByteTalkMessage extends MsgType { | ||
public ByteTalkMessage() { | ||
setDingerType(DingerType.BYTETALK); | ||
} | ||
} |
114 changes: 114 additions & 0 deletions
114
src/main/java/com/github/jaemon/dinger/bytetalk/entity/ByteText.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,114 @@ | ||
/* | ||
* Copyright ©2015-2022 Jaemon. All Rights Reserved. | ||
* | ||
* 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.github.jaemon.dinger.bytetalk.entity; | ||
|
||
import com.github.jaemon.dinger.bytetalk.entity.enums.ByteTalkMsgType; | ||
import com.github.jaemon.dinger.support.sign.SignBase; | ||
import com.github.jaemon.dinger.support.sign.SignResult; | ||
|
||
import java.io.Serializable; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* 飞书-消息类型-文本类型 | ||
* | ||
* @author Jaemon | ||
* @since 1.0 | ||
*/ | ||
public class ByteText extends ByteTalkMessage { | ||
private String msg_type; | ||
private Content content; | ||
|
||
/** 签名-时间戳 */ | ||
private String timestamp; | ||
/** 签名-秘钥 */ | ||
private String sign; | ||
|
||
public ByteText(Content content) { | ||
this.msg_type = ByteTalkMsgType.TEXT.type(); | ||
this.content = content; | ||
} | ||
|
||
@Override | ||
public void signAttributes(SignBase sign) { | ||
if (sign == null || !(sign instanceof SignResult)) { | ||
return; | ||
} | ||
SignResult signResult = (SignResult) sign; | ||
this.timestamp = String.valueOf(signResult.getTimestamp()); | ||
this.sign = signResult.getSign(); | ||
} | ||
|
||
public Content getContent() { | ||
return content; | ||
} | ||
|
||
public void setContent(Content content) { | ||
this.content = content; | ||
} | ||
|
||
public String getMsg_type() { | ||
return msg_type; | ||
} | ||
|
||
public void setMsg_type(String msg_type) { | ||
this.msg_type = msg_type; | ||
} | ||
|
||
public String getSign() { | ||
return sign; | ||
} | ||
|
||
public void setSign(String sign) { | ||
this.sign = sign; | ||
} | ||
|
||
public String getTimestamp() { | ||
return timestamp; | ||
} | ||
|
||
public void setTimestamp(String timestamp) { | ||
this.timestamp = timestamp; | ||
} | ||
|
||
public static class Content implements Serializable { | ||
/** | ||
* 文本内容,最长不超过2048个字节,必须是utf8编码 | ||
* */ | ||
private String text; | ||
|
||
public String getText() { | ||
return text; | ||
} | ||
|
||
public void setText(String text) { | ||
this.text = text; | ||
} | ||
|
||
public Content() { | ||
} | ||
|
||
public Content(String text) { | ||
this.text = text; | ||
} | ||
} | ||
|
||
@Override | ||
public void transfer(Map<String, Object> params) { | ||
this.content.text = replaceContent(this.content.text, params); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/main/java/com/github/jaemon/dinger/bytetalk/entity/enums/ByteTalkMsgType.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,41 @@ | ||
/* | ||
* Copyright ©2015-2022 Jaemon. All Rights Reserved. | ||
* | ||
* 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.github.jaemon.dinger.bytetalk.entity.enums; | ||
|
||
/** | ||
* ByteTalk支持的消息类型 | ||
* | ||
* @author Jaemon | ||
* @since 1.0 | ||
*/ | ||
public enum ByteTalkMsgType { | ||
/** | ||
* text类型 | ||
*/ | ||
TEXT("text"), | ||
|
||
; | ||
|
||
private String type; | ||
|
||
ByteTalkMsgType(String type) { | ||
this.type = type; | ||
} | ||
|
||
public String type() { | ||
return type; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/com/github/jaemon/dinger/bytetalk/package-info.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,23 @@ | ||
/* | ||
* Copyright ©2015-2022 Jaemon. All Rights Reserved. | ||
* | ||
* 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. | ||
*/ | ||
|
||
/** | ||
* 支持ByteTalk包 | ||
* | ||
* @author Jaemon | ||
* @since 1.0 | ||
*/ | ||
package com.github.jaemon.dinger.bytetalk; |
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
Oops, something went wrong.