|
@@ -4,11 +4,10 @@ import com.alibaba.fastjson.JSONObject;
|
|
import com.bosshand.virgo.api.workark.util.OkHttpUtils;
|
|
import com.bosshand.virgo.api.workark.util.OkHttpUtils;
|
|
import com.bosshand.virgo.core.response.Response;
|
|
import com.bosshand.virgo.core.response.Response;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
@Api(tags = {"v0接口管理"})
|
|
@Api(tags = {"v0接口管理"})
|
|
@RestController
|
|
@RestController
|
|
@@ -41,5 +40,21 @@ public class V0Controller {
|
|
return Response.ok(JSONObject.parseObject(sync));
|
|
return Response.ok(JSONObject.parseObject(sync));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @ApiOperation(value = "发送消息")
|
|
|
|
+ @PostMapping({"/chats/{chatId}/messages"})
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "chatId", value = "要向其发送消息的聊天的唯一标识符")
|
|
|
|
+ })
|
|
|
|
+ public Response chatsMessages(@RequestBody JSONObject jsonObject, @PathVariable String chatId) {
|
|
|
|
+ String sync = OkHttpUtils.builder().url("https://api.v0.dev/v1/chats/"+chatId+"/messages")
|
|
|
|
+ .addParam(jsonObject)
|
|
|
|
+ // 也可以添加多个
|
|
|
|
+ .addHeader("Content-Type", "application/json; charset=utf-8")
|
|
|
|
+ .addHeader("Authorization", "Bearer v1:OdiTOd4JMzwdd6mQ4FIo4QTh:r16t2Epsy3eR51SmnPoKDvNN")
|
|
|
|
+ .post(true)
|
|
|
|
+ .sync();
|
|
|
|
+ return Response.ok(JSONObject.parseObject(sync));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|