Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support additional api for llonebot #113

Open
wants to merge 3 commits into
base: dev/main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Copyright (c) 2024. ForteScarlet.
*
* This file is part of simbot-component-onebot.
*
* simbot-component-onebot is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* simbot-component-onebot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with simbot-component-onebot.
* If not, see <https://www.gnu.org/licenses/>.
*/

package love.forte.simbot.component.gocqhttp.core.api

import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.builtins.serializer
import love.forte.simbot.common.id.ID
import love.forte.simbot.component.onebot.v11.core.api.OneBotApi
import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult
import kotlin.jvm.JvmStatic

/**
* [`create_group_file_folder`-创建群文件文件夹](https://docs.go-cqhttp.org/api/#创建群文件文件夹)
*
* @author kuku
*/
public class CreateGroupFileFolderApi private constructor(
override val body: Any,
): OneBotApi<Unit> {

override val action: String
get() = ACTION

override val resultDeserializer: DeserializationStrategy<Unit>
get() = Unit.serializer()

override val apiResultDeserializer: DeserializationStrategy<OneBotApiResult<Unit>>
get() = OneBotApiResult.emptySerializer()


public companion object Factory {
private const val ACTION: String = "create_group_file_folder"

/**
* 构建一个 [CreateGroupFileFolderApi].
*
* @param groupId 群号
* @param name 文件夹名称
*/
@JvmStatic
public fun create(groupId: ID, name: String): CreateGroupFileFolderApi =
CreateGroupFileFolderApi(Body(groupId, name))

}

/**
* @property groupId 群号
* @property name 文件夹名称
* @property parentId 仅能为 /
*/
@Serializable
internal data class Body(
@SerialName("group_id")
internal val groupId: ID,
@SerialName("name")
internal val name: String,
@SerialName("parent_id")
internal val parentId: String = "/"
)

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Copyright (c) 2024. ForteScarlet.
*
* This file is part of simbot-component-onebot.
*
* simbot-component-onebot is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* simbot-component-onebot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with simbot-component-onebot.
* If not, see <https://www.gnu.org/licenses/>.
*/

package love.forte.simbot.component.gocqhttp.core.api

import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.builtins.serializer
import love.forte.simbot.common.id.ID
import love.forte.simbot.component.onebot.v11.core.api.OneBotApi
import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult
import kotlin.jvm.JvmStatic

/**
* [`delete_essence_msg`-移出精华消息](https://docs.go-cqhttp.org/api/#移出精华消息)
*
* @author kuku
*/
public class DeleteEssenceMsgApi private constructor(
override val body: Any,
): OneBotApi<Unit> {

override val action: String
get() = ACTION

override val resultDeserializer: DeserializationStrategy<Unit>
get() = Unit.serializer()

override val apiResultDeserializer: DeserializationStrategy<OneBotApiResult<Unit>>
get() = OneBotApiResult.emptySerializer()

public companion object Factory {
private const val ACTION: String = "delete_essence_msg"


/**
* 构建一个 [DeleteEssenceMsgApi].
*
* @param messageId 消息ID
*/
@JvmStatic
public fun create(messageId: ID): DeleteEssenceMsgApi =
DeleteEssenceMsgApi(Body(messageId))

}

/**
* @property messageId 消息ID
*/
@Serializable
internal data class Body(
@SerialName("message_id")
internal val messageId: ID
)

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* Copyright (c) 2024. ForteScarlet.
*
* This file is part of simbot-component-onebot.
*
* simbot-component-onebot is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* simbot-component-onebot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with simbot-component-onebot.
* If not, see <https://www.gnu.org/licenses/>.
*/

package love.forte.simbot.component.gocqhttp.core.api

import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.builtins.serializer
import love.forte.simbot.common.id.ID
import love.forte.simbot.component.onebot.v11.core.api.OneBotApi
import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult
import kotlin.jvm.JvmStatic

/**
* [`delete_group_file`-删除群文件](https://docs.go-cqhttp.org/api/#删除群文件)
*
* @author kuku
*/
public class DeleteGroupFileApi private constructor(
override val body: Any,
): OneBotApi<Unit> {

override val action: String
get() = ACTION

override val resultDeserializer: DeserializationStrategy<Unit>
get() = Unit.serializer()

override val apiResultDeserializer: DeserializationStrategy<OneBotApiResult<Unit>>
get() = OneBotApiResult.emptySerializer()


public companion object Factory {
private const val ACTION: String = "delete_group_file"

/**
* 构建一个 [DeleteGroupFileApi].
*
* @param groupId 群号
* @param fileId 文件ID 参考 File 对象
* @param busid 文件类型 参考 File 对象
*/
@JvmStatic
public fun create(groupId: ID, fileId: String, busid: String): DeleteGroupFileApi =
DeleteGroupFileApi(Body(groupId, fileId, busid))

}

/**
* @property groupId 群号
* @property fileId 文件ID 参考 File 对象
* @property busid 文件类型 参考 File 对象
*/
@Serializable
internal data class Body(
@SerialName("group_id")
internal val groupId: ID,
@SerialName("file_id")
internal val fileId: String,
@SerialName("busid")
internal val busid: String
)

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Copyright (c) 2024. ForteScarlet.
*
* This file is part of simbot-component-onebot.
*
* simbot-component-onebot is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* simbot-component-onebot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with simbot-component-onebot.
* If not, see <https://www.gnu.org/licenses/>.
*/

package love.forte.simbot.component.gocqhttp.core.api

import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.builtins.serializer
import love.forte.simbot.common.id.ID
import love.forte.simbot.component.onebot.v11.core.api.OneBotApi
import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult
import kotlin.jvm.JvmStatic

/**
* [`delete_group_folder`-删除群文件文件夹](https://docs.go-cqhttp.org/api/#删除群文件文件夹)
*
* @author kuku
*/
public class DeleteGroupFolderApi private constructor(
override val body: Any,
): OneBotApi<Unit> {

override val action: String
get() = ACTION

override val resultDeserializer: DeserializationStrategy<Unit>
get() = Unit.serializer()

override val apiResultDeserializer: DeserializationStrategy<OneBotApiResult<Unit>>
get() = OneBotApiResult.emptySerializer()


public companion object Factory {
private const val ACTION: String = "delete_group_folder"

/**
* 构建一个 [CreateGroupFileFolderApi].
*
* @param groupId 群号
* @param folderId 文件夹ID 参考 Folder 对象
*/
@JvmStatic
public fun create(groupId: ID, folderId: String): DeleteGroupFolderApi =
DeleteGroupFolderApi(Body(groupId, folderId))

}

/**
* @property groupId 群号
* @property folderId 文件夹ID 参考 Folder 对象
*/
@Serializable
internal data class Body(
@SerialName("group_id")
internal val groupId: ID,
@SerialName("folder_id")
internal val folderId: String,
)

}

Loading
Loading