Skip to content

Commit

Permalink
modify: change NetworkHandler
Browse files Browse the repository at this point in the history
feat: update to 4.1.5.4000
  • Loading branch information
MidCoard committed Jan 6, 2024
1 parent a69ae5d commit c61591f
Showing 3 changed files with 29 additions and 21 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -63,14 +63,14 @@ Maven 依赖
<dependency>
<groupId>top.focess</groupId>
<artifactId>focess-qq</artifactId>
<version>4.1.5.3000</version>
<version>4.1.5.4000</version>
</dependency>
```

Gradle 依赖

```gradle
implementation 'top.focess:focess-qq:4.1.5.3000'
implementation 'top.focess:focess-qq:4.1.5.4000'
```

开发文档移步本项目[Wiki](https://github.com/MIdCoard/MiraiQQ/wiki)
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
<description>A simple QQ Bot framework</description>
<groupId>top.focess</groupId>
<artifactId>focess-qq</artifactId>
<version>4.1.5.3000</version>
<version>4.1.5.4000</version>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
@@ -26,13 +26,13 @@
<maven.compiler.target>8</maven.compiler.target>
<mirai.version>2.16.0</mirai.version>
<poi.version>5.2.2</poi.version>
<logback.version>1.2.11</logback.version>
<logback.version>1.4.14</logback.version>
<checker.version>3.21.3</checker.version>
<errorprone.version>9+181-r4173-1</errorprone.version>
<kotlin.version>1.6.0</kotlin.version>
<kotlin.native>native-mt</kotlin.native>
<command.version>1.3.2</command.version>
<util.version>1.1.18</util.version>
<util.version>1.1.19</util.version>
<scheduler.version>1.2.4</scheduler.version>
<sysout.version>1.0.2</sysout.version>
<socket.version>1.1.0</socket.version>
40 changes: 24 additions & 16 deletions src/main/java/top/focess/qq/api/util/network/NetworkHandler.java
Original file line number Diff line number Diff line change
@@ -44,13 +44,13 @@ public NetworkHandler(final Plugin plugin, final top.focess.util.network.Network
this.networkHandler = new top.focess.util.network.NetworkHandler(options);
this.networkHandler.addHandler(new HttpHandler() {
@Override
public void handle(final String url, final Map<String, Object> data, final Map<String, String> header, final String body) {
LOGGER.debug(ChatConstants.NETWORK_DEBUG_HEADER + "[" + plugin.getName() + "] " + url + " Get: " + data + " with Header: " + header + ", Response: " + body);
public void handle(final String url, final String data, final Map<String, String> header, final String body) {
LOGGER.debug(ChatConstants.NETWORK_DEBUG_HEADER + "[" + plugin.getName() + "] " + url + " Request: " + data + " with Header: " + header + ", Response: " + body);
}

@Override
public void handleException(final String url, final Map<String, Object> data, final Map<String, String> header, final Exception e) {
LOGGER.debug(ChatConstants.NETWORK_DEBUG_HEADER + "[" + plugin.getName() + "] " + url + " Post: " + data + " with Header: " + header + ", Error: " + e.getMessage());
public void handleException(final String url, final String data, final Map<String, String> header, final Exception e) {
LOGGER.debug(ChatConstants.NETWORK_DEBUG_HEADER + "[" + plugin.getName() + "] " + url + " Request: " + data + " with Header: " + header + ", Error: " + e.getMessage());
}
});
}
@@ -67,27 +67,35 @@ public Plugin getPlugin() {
return this.plugin;
}

public HttpResponse request(final String url, final Map<String, Object> data, final top.focess.util.network.NetworkHandler.RequestType requestType) {
return this.networkHandler.request(url, data, requestType);
public HttpResponse request(String url, Map<String, Object> data, top.focess.util.network.NetworkHandler.RequestType requestType) {
return networkHandler.request(url, data, requestType);
}

public HttpResponse request(final String url, final top.focess.util.network.NetworkHandler.RequestType requestType) {
return this.networkHandler.request(url, requestType);
public HttpResponse request(String url, top.focess.util.network.NetworkHandler.RequestType requestType) {
return networkHandler.request(url, requestType);
}

public HttpResponse request(final String url, final Map<String, Object> data, final Map<String, String> header, final MediaType mediaType, final top.focess.util.network.NetworkHandler.RequestType requestType) {
return this.networkHandler.request(url, data, header, mediaType, requestType);
public HttpResponse request(String url, Map<String, Object> data, Map<String, String> header, MediaType mediaType, top.focess.util.network.NetworkHandler.RequestType requestType) {
return networkHandler.request(url, data, header, mediaType, requestType);
}

public HttpResponse put(final String url, final Map<String, Object> data, final Map<String, String> header, @NotNull final MediaType mediaType) {
return this.networkHandler.put(url, data, header, mediaType);
public HttpResponse request(String url, String data, Map<String, String> header, MediaType mediaType, top.focess.util.network.NetworkHandler.RequestType requestType) {
return networkHandler.request(url, data, header, mediaType, requestType);
}

public HttpResponse post(final String url, final Map<String, Object> data, final Map<String, String> header, @NotNull final MediaType mediaType) {
return this.networkHandler.post(url, data, header, mediaType);
public HttpResponse put(String url, String data, Map<String, String> header, @NotNull MediaType mediaType) {
return networkHandler.put(url, data, header, mediaType);
}

public HttpResponse get(final String url, @NotNull final Map<String, Object> data, final Map<String, String> header) {
return this.networkHandler.get(url, data, header);
public HttpResponse post(String url, String data, Map<String, String> header, @NotNull MediaType mediaType) {
return networkHandler.post(url, data, header, mediaType);
}

public HttpResponse delete(String url, String data, Map<String, String> header, @NotNull MediaType mediaType) {
return networkHandler.delete(url, data, header, mediaType);
}

public HttpResponse get(String url, @NotNull Map<String, Object> data, Map<String, String> header) {
return networkHandler.get(url, data, header);
}
}

0 comments on commit c61591f

Please sign in to comment.