Skip to content

Commit 09bd3ff

Browse files
committed
Network snapshot
1 parent 5b50c85 commit 09bd3ff

File tree

5 files changed

+25
-7
lines changed

5 files changed

+25
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ allprojects {
1616
Add the dependency
1717
```
1818
dependencies {
19-
implementation 'com.github.MixinNetwork:bot-api-kotlin-client:v0.4.6'
19+
implementation 'com.github.MixinNetwork:bot-api-kotlin-client:v0.4.7'
2020
}
2121
```
2222

library/src/main/kotlin/one/mixin/bot/api/call/SnapshotCallService.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package one.mixin.bot.api.call
22

33
import one.mixin.bot.api.MixinResponse
44
import one.mixin.bot.api.SnapshotService.Companion.LIMIT
5+
import one.mixin.bot.vo.NetworkSnapshot
56
import one.mixin.bot.vo.Snapshot
67
import one.mixin.bot.vo.TransferRequest
78
import one.mixin.bot.vo.WithdrawalRequest
@@ -51,13 +52,13 @@ interface SnapshotCallService {
5152
): Call<MixinResponse<List<Snapshot>>>
5253

5354
@GET("/network/snapshots/{id}")
54-
fun networkSnapshotCall(@Path("id") snapshotId: String): Call<MixinResponse<Snapshot>>
55+
fun networkSnapshotCall(@Path("id") snapshotId: String): Call<MixinResponse<NetworkSnapshot>>
5556

5657
@GET("/network/snapshots/")
5758
fun networkSnapshotsCall(
5859
@Query("asset") assetId: String,
5960
@Query("offset") offset: String? = null,
6061
@Query("limit") limit: Int = LIMIT,
6162
@Query("order") order: String? = null
62-
): Call<MixinResponse<List<Snapshot>>>
63+
): Call<MixinResponse<List<NetworkSnapshot>>>
6364
}

library/src/main/kotlin/one/mixin/bot/api/coroutine/SnapshotCoroutineService.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package one.mixin.bot.api.coroutine
22

33
import one.mixin.bot.api.MixinResponse
44
import one.mixin.bot.api.SnapshotService
5+
import one.mixin.bot.vo.NetworkSnapshot
56
import one.mixin.bot.vo.Snapshot
67
import one.mixin.bot.vo.TransferRequest
78
import one.mixin.bot.vo.WithdrawalRequest
@@ -50,13 +51,13 @@ interface SnapshotCoroutineService {
5051
): MixinResponse<List<Snapshot>>
5152

5253
@GET("/network/snapshots/{id}")
53-
suspend fun networkSnapshot(@Path("id") snapshotId: String): MixinResponse<Snapshot>
54+
suspend fun networkSnapshot(@Path("id") snapshotId: String): MixinResponse<NetworkSnapshot>
5455

5556
@GET("/network/snapshots/")
5657
suspend fun networkSnapshots(
5758
@Query("asset") assetId: String,
5859
@Query("offset") offset: String? = null,
5960
@Query("limit") limit: Int = SnapshotService.LIMIT,
6061
@Query("order") order: String? = null
61-
): MixinResponse<List<Snapshot>>
62+
): MixinResponse<List<NetworkSnapshot>>
6263
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package one.mixin.bot.vo
2+
3+
import com.google.gson.annotations.SerializedName
4+
5+
data class NetworkSnapshot(
6+
@SerializedName("snapshot_id")
7+
val snapshotId: String,
8+
val type: String,
9+
val amount: String,
10+
@SerializedName("created_at")
11+
val createdAt: String,
12+
@SerializedName("asset")
13+
val asset: Asset,
14+
@SerializedName("source")
15+
val source: String
16+
)

samples/src/main/java/jvmMain/java/Sample.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ private static void transactions(HttpClient client, List<String> receivers, Stri
259259
}
260260

261261
private static void networkSnapshot(HttpClient client, String snapshotId) throws IOException {
262-
MixinResponse<Snapshot> snapshotResponse = client.getSnapshotService().networkSnapshotCall(snapshotId).execute().body();
262+
MixinResponse<NetworkSnapshot> snapshotResponse = client.getSnapshotService().networkSnapshotCall(snapshotId).execute().body();
263263
assert snapshotResponse != null;
264264
if (snapshotResponse.isSuccess()) {
265265
System.out.printf("Success: %s%n", Objects.requireNonNull(snapshotResponse.getData()).getSnapshotId());
@@ -269,7 +269,7 @@ private static void networkSnapshot(HttpClient client, String snapshotId) throws
269269
}
270270

271271
private static void networkSnapshots(HttpClient client, String assetId) throws IOException {
272-
MixinResponse<List<Snapshot>> snapshotResponse = client.getSnapshotService().networkSnapshotsCall(assetId, null, 10, "ASC").execute().body();
272+
MixinResponse<List<NetworkSnapshot>> snapshotResponse = client.getSnapshotService().networkSnapshotsCall(assetId, null, 10, "ASC").execute().body();
273273
assert snapshotResponse != null;
274274
if (snapshotResponse.isSuccess()) {
275275
System.out.printf("Success: %d%n", Objects.requireNonNull(snapshotResponse.getData()).size());

0 commit comments

Comments
 (0)