修正一些实体类的名称并添加一些 API 注释

This commit is contained in:
czp 2017-11-07 15:51:17 +08:00
parent 3210a50b37
commit 725b17b1f1
5 changed files with 41 additions and 81 deletions

View File

@ -4,7 +4,12 @@ import com.hiczp.bilibili.api.live.entity.*;
import retrofit2.Call;
import retrofit2.http.*;
/* 常见参数含义
mid: 用户 id, 也可能是指主播的用户 id
cid: 房间 id, 可以指 room_id 也可以指 show_room_id, 推荐所有 API 都使用 room_id 进行访问
*/
public interface LiveService {
//type 必须是 "all", 否则返回的所有字段的值都是 0
@GET("AppRoom/danmuConfig")
Call<BulletScreenConfigEntity> getBulletScreenConfig(@Query("type") String type);
@ -15,7 +20,7 @@ public interface LiveService {
Call<LiveRoomInfoEntity> getRoomInfo(@Query("room_id") int roomId);
@POST("feed/v1/feed/isFollowed")
Call<IsFollowedResponseEntity> isFollowed(@Query("follow") int follow);
Call<IsFollowedResponseEntity> isFollowed(@Query("follow") int hostUserId);
@GET("AppBag/sendDaily")
Call<SendDailyResponseEntity> sendDaily();
@ -23,18 +28,23 @@ public interface LiveService {
@GET("AppIndex/getAllItem")
Call<ItemsEntity> getAllItem();
// API 的返回值意义不明确, 所有房间似乎都一样, 且返回的 code -400
@GET("AppSmallTV/index")
Call<AppSmallTVEntity> getAppSmallTV();
//这里的 Title 是头衔的意思
@GET("appUser/getTitle")
Call<TitlesEntity> getTitle();
//这个 API 不是很明确, 所有房间都一样
@GET("SpecialGift/room/{roomId}")
Call<SpecialGiftEntity> getSpecialGift(@Path("roomId") int roomId);
@GET("mobile/getUser")
Call<UserEntity> getUserInfo();
Call<UserInfoEntity> getUserInfo();
//这里的 cid 必须用实际的 room_id, 不能使用 show_room_id, 否则得不到 playUrl. 实际 room_id 要首先通过 getRoomInfo() 获取
//outputType 为固定值 "json", 否则返回的内容不可解析
@GET("api/playurl")
Call<PlayUrlEntity> getPlayUrl(@Query("cid") int cid, @Query("otype") String outputType);
@ -107,6 +117,7 @@ public interface LiveService {
@GET("AppRoom/getGiftTop")
Call<GiftTopEntity> getGiftTop(@Query("room_id") int roomId);
//无论是否已经签到, 返回的 code 都是 0. 除了字符串比对, 要想知道是否已经签到要通过 getUserInfo().getIsSign()
@GET("AppUser/getSignInfo")
Call<SignInfoEntity> getSignInfo();
}

View File

@ -8,6 +8,7 @@ public class BulletScreenEntity {
private int mid = BilibiliRESTAPI.getMid();
//弹幕长度限制为 LiveRoomInfoEntity.getData().getMsgLength(), 但是实际上所有房间的弹幕长度限制都是 20
@SerializedName("msg")
private String message;
@ -15,8 +16,16 @@ public class BulletScreenEntity {
@SerializedName("rnd")
private long random = (long) (Math.random() * (999999999 - (-999999999)) + (-999999999));
//1 普通
//4 底端
//5 顶端
//6 逆向
//7 特殊
//9 高级
//一些模式需要 VIP
private int mode = 1;
//尚且只见过为 0 的情况
private int pool = 0;
private String type = "json";

View File

@ -92,7 +92,7 @@ public class LiveHistoryBulletScreensEntity {
@SerializedName("timeline")
private String timeline;
@SerializedName("isadmin")
private int isadmin;
private int isAdmin;
@SerializedName("vip")
private int vip;
@SerializedName("svip")
@ -100,7 +100,7 @@ public class LiveHistoryBulletScreensEntity {
@SerializedName("rank")
private int rank;
@SerializedName("teamid")
private int teamid;
private int teamId;
@SerializedName("rnd")
private long rnd;
@SerializedName("user_title")
@ -146,12 +146,12 @@ public class LiveHistoryBulletScreensEntity {
this.timeline = timeline;
}
public int getIsadmin() {
return isadmin;
public int getIsAdmin() {
return isAdmin;
}
public void setIsadmin(int isadmin) {
this.isadmin = isadmin;
public void setIsAdmin(int isAdmin) {
this.isAdmin = isAdmin;
}
public int getVip() {
@ -178,12 +178,12 @@ public class LiveHistoryBulletScreensEntity {
this.rank = rank;
}
public int getTeamid() {
return teamid;
public int getTeamId() {
return teamId;
}
public void setTeamid(int teamid) {
this.teamid = teamid;
public void setTeamId(int teamId) {
this.teamId = teamId;
}
public long getRnd() {

View File

@ -3,6 +3,7 @@ package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
import java.util.List;
import java.util.Map;
public class LiveRoomInfoEntity {
/**
@ -1054,7 +1055,7 @@ public class LiveRoomInfoEntity {
@SerializedName("super_num")
private int superNum;
@SerializedName("count_map")
private CountMapEntity countMap;
private Map<String, String> countMap;
public int getId() {
return id;
@ -1136,11 +1137,11 @@ public class LiveRoomInfoEntity {
this.superNum = superNum;
}
public CountMapEntity getCountMap() {
public Map<String, String> getCountMap() {
return countMap;
}
public void setCountMap(CountMapEntity countMap) {
public void setCountMap(Map<String, String> countMap) {
this.countMap = countMap;
}
@ -1160,67 +1161,6 @@ public class LiveRoomInfoEntity {
this.gold = gold;
}
}
public static class CountMapEntity {
/**
* 1 :
* 2 :
* 3 :
* 4 :
* 5 :
*/
@SerializedName("1")
private String $1;
@SerializedName("2")
private String $2;
@SerializedName("3")
private String $3;
@SerializedName("4")
private String $4;
@SerializedName("5")
private String $5;
public String get$1() {
return $1;
}
public void set$1(String $1) {
this.$1 = $1;
}
public String get$2() {
return $2;
}
public void set$2(String $2) {
this.$2 = $2;
}
public String get$3() {
return $3;
}
public void set$3(String $3) {
this.$3 = $3;
}
public String get$4() {
return $4;
}
public void set$4(String $4) {
this.$4 = $4;
}
public String get$5() {
return $5;
}
public void set$5(String $5) {
this.$5 = $5;
}
}
}
public static class IgnoreGiftEntity {

View File

@ -2,7 +2,7 @@ package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
public class UserEntity {
public class UserInfoEntity {
/**
* code : 0
* message : ok
@ -14,7 +14,7 @@ public class UserEntity {
@SerializedName("message")
private String message;
@SerializedName("data")
private DataEntity data;
private UserEntity data;
public int getCode() {
return code;
@ -32,15 +32,15 @@ public class UserEntity {
this.message = message;
}
public DataEntity getData() {
public UserEntity getData() {
return data;
}
public void setData(DataEntity data) {
public void setData(UserEntity data) {
this.data = data;
}
public static class DataEntity {
public static class UserEntity {
/**
* silver : 1896
* gold : 0