> BaseCallback(@NonNull Event event) {
39 | this.event = event;
40 | }
41 |
42 | /**
43 | * Invoked for a received HTTP response.
44 | *
45 | * Note: An HTTP response may still indicate an application-level failure such as a 404 or 500.
46 | * Call {@link Response#isSuccessful()} to determine if the response indicates success.
47 | *
48 | * @param call
49 | * @param response
50 | */
51 | @Override
52 | public void onResponse(Call call, Response response) {
53 | if (response.isSuccessful())
54 | EventBus.getDefault().post(event.setEvent(response.code(), response.body()));
55 | else {
56 | EventBus.getDefault().post(event.setEvent(response.code(), null));
57 | }
58 | }
59 |
60 | /**
61 | * Invoked when a network exception occurred talking to the server or when an unexpected
62 | * exception occurred creating the request or processing the response.
63 | *
64 | * @param call
65 | * @param t
66 | */
67 | @Override
68 | public void onFailure(Call call, Throwable t) {
69 | EventBus.getDefault().post(event.setEvent(-1, null));
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/base/callback/TokenCallback.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.base.callback;
24 |
25 | import android.support.annotation.NonNull;
26 |
27 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
28 | import com.gcssloop.diycode_sdk.api.login.bean.Token;
29 | import com.gcssloop.diycode_sdk.utils.CacheUtil;
30 |
31 | import org.greenrobot.eventbus.EventBus;
32 |
33 | import retrofit2.Call;
34 | import retrofit2.Response;
35 |
36 | /**
37 | * 为 token 设置的 callback,相比于 BaseCallback,多了一个缓存。
38 | */
39 | public class TokenCallback extends BaseCallback {
40 | private CacheUtil cacheUtil;
41 |
42 | public > TokenCallback(@NonNull CacheUtil cacheUtil, @NonNull Event event) {
43 | super(event);
44 | this.cacheUtil = cacheUtil;
45 | }
46 |
47 | @Override
48 | public void onResponse(Call call, Response response) {
49 | if (response.isSuccessful()) {
50 | Token token = response.body();
51 | cacheUtil.saveToken(token); // 请求成功后token缓存起来
52 | EventBus.getDefault().post(event.setEvent(response.code(), token));
53 | } else {
54 | EventBus.getDefault().post(event.setEvent(response.code(), null));
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/likes/api/LikesAPI.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.likes.api;
24 |
25 | import android.support.annotation.NonNull;
26 |
27 | import com.gcssloop.diycode_sdk.api.likes.event.*;
28 |
29 | public interface LikesAPI {
30 |
31 | /**
32 | * 赞
33 | *
34 | * @param obj_type 值范围["topic", "reply", "news"]
35 | * @param obj_id 唯一id
36 | * @see LikeEvent
37 | */
38 | String like(@NonNull String obj_type, @NonNull Integer obj_id);
39 |
40 |
41 | /**
42 | * 取消之前的赞
43 | *
44 | * @param obj_type 值范围["topic", "reply", "news"]
45 | * @param obj_id 唯一id
46 | * @see UnLikeEvent
47 | */
48 | String unLike(@NonNull String obj_type, @NonNull Integer obj_id);
49 | }
50 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/likes/api/LikesImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.likes.api;
24 |
25 | import android.content.Context;
26 | import android.support.annotation.NonNull;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.bean.State;
29 | import com.gcssloop.diycode_sdk.api.base.callback.BaseCallback;
30 | import com.gcssloop.diycode_sdk.api.base.impl.BaseImpl;
31 | import com.gcssloop.diycode_sdk.api.likes.event.LikeEvent;
32 | import com.gcssloop.diycode_sdk.api.likes.event.UnLikeEvent;
33 | import com.gcssloop.diycode_sdk.utils.UUIDGenerator;
34 |
35 | public class LikesImpl extends BaseImpl implements LikesAPI {
36 |
37 | public LikesImpl(Context context) {
38 | super(context);
39 | }
40 |
41 | /**
42 | * 赞
43 | *
44 | * @param obj_type 值范围["topic", "reply", "news"]
45 | * @param obj_id 唯一id
46 | * @see LikeEvent
47 | */
48 | @Override
49 | public String like(@NonNull String obj_type, @NonNull Integer obj_id) {
50 | final String uuid = UUIDGenerator.getUUID();
51 | mService.like(obj_type, obj_id).enqueue(new BaseCallback<>(new LikeEvent(uuid)));
52 | return uuid;
53 | }
54 |
55 | /**
56 | * 取消之前的赞
57 | *
58 | * @param obj_type 值范围["topic", "reply", "news"]
59 | * @param obj_id 唯一id
60 | * @see UnLikeEvent
61 | */
62 | @Override
63 | public String unLike(@NonNull String obj_type, @NonNull Integer obj_id) {
64 | final String uuid = UUIDGenerator.getUUID();
65 | mService.unLike(obj_type, obj_id).enqueue(new BaseCallback(new UnLikeEvent(uuid)));
66 | return uuid;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/likes/api/LikesService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.likes.api;
24 |
25 | import com.gcssloop.diycode_sdk.api.base.bean.State;
26 |
27 | import retrofit2.Call;
28 | import retrofit2.http.Field;
29 | import retrofit2.http.FormUrlEncoded;
30 | import retrofit2.http.HTTP;
31 | import retrofit2.http.POST;
32 |
33 | interface LikesService {
34 |
35 |
36 | /**
37 | * 赞
38 | *
39 | * @param obj_type ["topic", "reply", "news"]
40 | * @param obj_id id
41 | * @return 是否成功
42 | */
43 | @POST("likes.json")
44 | @FormUrlEncoded
45 | Call like(@Field("obj_type") String obj_type, @Field("obj_id") Integer obj_id);
46 |
47 | /**
48 | * 取消赞
49 | *
50 | * @param obj_type ["topic", "reply", "news"]
51 | * @param obj_id id
52 | * @return 是否成功
53 | */
54 | // @DELETE("likes.json")
55 | @FormUrlEncoded
56 | @HTTP(method = "DELETE", path = "likes.json", hasBody = true)
57 | Call unLike(@Field("obj_type") String obj_type, @Field("obj_id") Integer obj_id);
58 | }
59 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/likes/event/LikeEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.likes.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.bean.State;
29 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
30 |
31 | public class LikeEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public LikeEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param state 实体数据
43 | */
44 | public LikeEvent(@Nullable String uuid, @NonNull Integer code, @Nullable State state) {
45 | super(uuid, code, state);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/likes/event/UnLikeEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.likes.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.bean.State;
29 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
30 |
31 | public class UnLikeEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public UnLikeEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param state 实体数据
43 | */
44 | public UnLikeEvent(@Nullable String uuid, @NonNull Integer code, @Nullable State state) {
45 | super(uuid, code, state);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/login/api/LoginAPI.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.login.api;
24 |
25 | import android.support.annotation.NonNull;
26 |
27 | import com.gcssloop.diycode_sdk.api.login.bean.Token;
28 | import com.gcssloop.diycode_sdk.api.login.event.LoginEvent;
29 | import com.gcssloop.diycode_sdk.api.login.event.RefreshTokenEvent;
30 |
31 | public interface LoginAPI {
32 |
33 | //--- login ------------------------------------------------------------------------------------
34 |
35 | /**
36 | * 登录时调用
37 | * 返回一个 token,用于获取各类私有信息使用,该 token 用 LoginEvent 接收。
38 | *
39 | * @param user_name 用户名
40 | * @param password 密码
41 | * @see LoginEvent
42 | */
43 | String login(@NonNull String user_name, @NonNull String password);
44 |
45 | /**
46 | * 用户登出
47 | */
48 | void logout();
49 |
50 | /**
51 | * 是否登录
52 | * @return 是否登录
53 | */
54 | boolean isLogin();
55 |
56 | //--- token ------------------------------------------------------------------------------------
57 |
58 | /**
59 | * 刷新 token
60 | *
61 | * @see RefreshTokenEvent
62 | */
63 | String refreshToken();
64 |
65 | /**
66 | * 获取当前缓存的 token
67 | *
68 | * @return 当前缓存的 token
69 | */
70 | Token getCacheToken();
71 |
72 |
73 | //--- devices ----------------------------------------------------------------------------------
74 |
75 | /**
76 | * 更新设备信息
77 | * 记录用户 Device 信息,用于 Push 通知。
78 | * 请在每次用户打开 App 的时候调用此 API 以便更新 Token 的 last_actived_at 让服务端知道这个设备还活着。
79 | * Push 将会忽略那些超过两周的未更新的设备。
80 | */
81 | String updateDevices();
82 |
83 | /**
84 | * 删除 Device 信息,请注意在用户登出或删除应用的时候调用,以便能确保清理掉。
85 | */
86 | String deleteDevices();
87 |
88 |
89 | }
90 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/login/api/LoginService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.login.api;
24 |
25 | import com.gcssloop.diycode_sdk.api.base.bean.State;
26 | import com.gcssloop.diycode_sdk.api.login.bean.Token;
27 | import com.gcssloop.diycode_sdk.utils.Constant;
28 |
29 | import retrofit2.Call;
30 | import retrofit2.http.DELETE;
31 | import retrofit2.http.Field;
32 | import retrofit2.http.FormUrlEncoded;
33 | import retrofit2.http.POST;
34 |
35 | interface LoginService {
36 |
37 | //--- Token ------------------------------------------------------------------------------------
38 |
39 | /**
40 | * 获取 Token (一般在登录时调用)
41 | *
42 | * @param client_id 客户端 id
43 | * @param client_secret 客户端私钥
44 | * @param grant_type 授权方式 - 密码
45 | * @param username 用户名
46 | * @param password 密码
47 | * @return Token 实体类
48 | */
49 | @POST(Constant.OAUTH_URL)
50 | @FormUrlEncoded
51 | Call getToken(
52 | @Field("client_id") String client_id, @Field("client_secret") String client_secret,
53 | @Field("grant_type") String grant_type, @Field("username") String username,
54 | @Field("password") String password);
55 |
56 | /**
57 | * 刷新 token
58 | *
59 | * @param client_id 客户端 id
60 | * @param client_secret 客户端私钥
61 | * @param grant_type 授权方式 - Refresh Token
62 | * @param refresh_token token 信息
63 | * @return Token 实体类
64 | */
65 | @POST(Constant.OAUTH_URL)
66 | @FormUrlEncoded
67 | Call refreshToken(@Field("client_id") String client_id, @Field("client_secret") String client_secret,
68 | @Field("grant_type") String grant_type, @Field("refresh_token") String refresh_token);
69 |
70 |
71 | //--- devices -------------------------------------------------------------------------------
72 |
73 | /**
74 | * 记录用户 Device 信息,用于 Push 通知。
75 | * 请在每次用户打开 App 的时候调用此 API 以便更新 Token 的 last_actived_at 让服务端知道这个设备还活着。
76 | * Push 将会忽略那些超过两周的未更新的设备。
77 | *
78 | * @param platform 平台 ["ios", "android"]
79 | * @param token 令牌 token
80 | * @return 是否成功
81 | */
82 | @POST("devices.json")
83 | @FormUrlEncoded
84 | Call updateDevices(@Field("platform") String platform, @Field("token") String token);
85 |
86 | /**
87 | * 删除 Device 信息,请注意在用户登出或删除应用的时候调用,以便能确保清理掉
88 | *
89 | * @param platform 平台 ["ios", "android"]
90 | * @param token 令牌 token
91 | * @return 是否成功
92 | */
93 | @DELETE("devices.json")
94 | Call deleteDevices(@Field("platform") String platform, @Field("token") String token);
95 |
96 |
97 | }
98 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/login/bean/Token.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.login.bean;
24 |
25 | import java.io.Serializable;
26 |
27 | /**
28 | * 令牌
29 | */
30 | public class Token implements Serializable {
31 |
32 | private String access_token; // 用户令牌(获取相关数据使用)
33 | private String token_type; // 令牌类型
34 | private int expires_in; // 过期时间
35 | private String refresh_token; // 刷新令牌(获取新的令牌)
36 | private int created_at; // 创建时间
37 |
38 | public String getAccess_token() {
39 | return access_token;
40 | }
41 |
42 | public void setAccess_token(String access_token) {
43 | this.access_token = access_token;
44 | }
45 |
46 | public String getToken_type() {
47 | return token_type;
48 | }
49 |
50 | public void setToken_type(String token_type) {
51 | this.token_type = token_type;
52 | }
53 |
54 | public int getExpires_in() {
55 | return expires_in;
56 | }
57 |
58 | public void setExpires_in(int expires_in) {
59 | this.expires_in = expires_in;
60 | }
61 |
62 | public String getRefresh_token() {
63 | return refresh_token;
64 | }
65 |
66 | public void setRefresh_token(String refresh_token) {
67 | this.refresh_token = refresh_token;
68 | }
69 |
70 | public int getCreated_at() {
71 | return created_at;
72 | }
73 |
74 | public void setCreated_at(int created_at) {
75 | this.created_at = created_at;
76 | }
77 |
78 | @Override
79 | public String toString() {
80 | return "Token{" +
81 | "access_token='" + access_token + '\'' +
82 | ", token_type='" + token_type + '\'' +
83 | ", expires_in=" + expires_in +
84 | ", refresh_token='" + refresh_token + '\'' +
85 | ", created_at=" + created_at +
86 | '}';
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/login/event/DeleteDevicesEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.login.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.bean.State;
29 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
30 |
31 | public class DeleteDevicesEvent extends BaseEvent {
32 | public DeleteDevicesEvent(@Nullable String uuid) {
33 | super(uuid);
34 | }
35 |
36 | public DeleteDevicesEvent(@Nullable String uuid, @NonNull Integer code, @Nullable State state) {
37 | super(uuid, code, state);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/login/event/LoginEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.login.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.login.bean.Token;
30 |
31 | /**
32 | * 登录
33 | */
34 | public class LoginEvent extends BaseEvent {
35 |
36 | /**
37 | * @param uuid 唯一识别码
38 | */
39 | public LoginEvent(@Nullable String uuid) {
40 | super(uuid);
41 | }
42 |
43 | /**
44 | * @param uuid 唯一识别码
45 | * @param code 网络返回码
46 | * @param token 实体数据
47 | */
48 | public LoginEvent(@Nullable String uuid, @NonNull Integer code, @Nullable Token token) {
49 | super(uuid, code, token);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/login/event/LogoutEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-22 14:26:22
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.login.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 |
30 | public class LogoutEvent extends BaseEvent {
31 | /**
32 | * @param uuid 唯一识别码
33 | */
34 | public LogoutEvent(@Nullable String uuid) {
35 | super(uuid);
36 | }
37 |
38 | /**
39 | * @param uuid 唯一识别码
40 | * @param code 网络返回码
41 | * @param s 实体数据
42 | */
43 | public LogoutEvent(@Nullable String uuid, @NonNull Integer code, @Nullable String s) {
44 | super(uuid, code, s);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/login/event/RefreshTokenEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.login.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.login.bean.Token;
30 |
31 | public class RefreshTokenEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public RefreshTokenEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param token 实体数据
43 | */
44 | public RefreshTokenEvent(@Nullable String uuid, @NonNull Integer code, @Nullable Token token) {
45 | super(uuid, code, token);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/login/event/UpdateDevicesEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.login.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.bean.State;
29 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
30 |
31 | public class UpdateDevicesEvent extends BaseEvent {
32 | public UpdateDevicesEvent(@Nullable String uuid) {
33 | super(uuid);
34 | }
35 |
36 | public UpdateDevicesEvent(@Nullable String uuid, @NonNull Integer code, @Nullable State state) {
37 | super(uuid, code, state);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/news/api/NewsAPI.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.news.api;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.news.event.*;
29 |
30 | public interface NewsAPI {
31 |
32 | /**
33 | * 获取 news 列表
34 | *
35 | * @param node_id 如果你需要只看某个节点的,请传此参数, 如果不传 则返回全部
36 | * @param offset 偏移数值,默认值 0
37 | * @param limit 数量极限,默认值 20,值范围 1..150
38 | * @see GetNewsListEvent
39 | */
40 | String getNewsList(@Nullable Integer node_id, @Nullable Integer offset, @Nullable Integer limit);
41 |
42 | /**
43 | * 创建一个 new (分享)
44 | *
45 | * @param title 标题
46 | * @param address 地址(网址链接)
47 | * @param node_id 节点 id
48 | * @see CreateNewsEvent
49 | */
50 | String createNews(@NonNull String title, @NonNull String address, @NonNull Integer node_id);
51 |
52 | /**
53 | * 获取 news 回帖列表
54 | *
55 | * @param id id
56 | * @param offset 偏移数值 默认 0
57 | * @param limit 数量极限,默认值 20,值范围 1...150
58 | * @see GetNewsRepliesListEvent
59 | */
60 | String getNewsRepliesList(@NonNull int id, @Nullable Integer offset, @Nullable Integer limit);
61 |
62 | /**
63 | * 创建 news 回帖 (暂不可用, 没有api)
64 | *
65 | * @param id id
66 | * @param body 回帖内容, markdown格式
67 | * @see CreateNewsReplyEvent
68 | */
69 | @Deprecated
70 | String createNewsReply(@NonNull int id, @NonNull Integer body);
71 |
72 | /**
73 | * 获取 news 回帖详情
74 | *
75 | * @param id id
76 | * @see GetNewsReplyEvent
77 | */
78 | String getNewsReply(@NonNull int id);
79 |
80 | /**
81 | * 更新 news 回帖
82 | *
83 | * @param id id
84 | * @param body 回帖内容
85 | * @see UpdateNewsReplyEvent
86 | */
87 | String updateNewsReply(@NonNull int id, @NonNull String body);
88 |
89 | /**
90 | * 删除 news 回帖
91 | *
92 | * @param id id
93 | * @see DeleteNewsReplyEvent
94 | */
95 | String deleteNewsReply(@NonNull int id);
96 |
97 | /**
98 | * 获取 news 分类列表
99 | *
100 | * @see GetNewsNodesListEvent
101 | */
102 | String getNewsNodesList();
103 | }
104 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/news/bean/NewReply.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.news.bean;
24 |
25 | import com.gcssloop.diycode_sdk.api.base.bean.Abilities;
26 | import com.gcssloop.diycode_sdk.api.user.bean.User;
27 |
28 | import java.io.Serializable;
29 |
30 | public class NewReply implements Serializable {
31 |
32 | /**
33 | * id : 395
34 | * body_html : 最近在做一个新的产品,然后想起很早之前 coding 的这个文章,整个流程和思路都很有借鉴意义。
35 | * created_at : 2017-02-26T23:42:34.758+08:00
36 | * updated_at : 2017-02-26T23:42:34.758+08:00
37 | * deleted : false
38 | * news_id : 2037
39 | * user : {"id":1,"login":"jixiaohua","name":"寂小桦","avatar_url":"https://diycode.b0.upaiyun.com/user/large_avatar/2.jpg"}
40 | * likes_count : 0
41 | * abilities : {"update":false,"destroy":false}
42 | */
43 |
44 | private int id; // 回复 的 id
45 | private String body_html; // 回复内容详情(HTML)
46 | private String created_at; // 创建时间
47 | private String updated_at; // 更新时间
48 | private boolean deleted; // 是否已经删除
49 | private int news_id; // new 的 id
50 | private User user; // 创建该回复的用户信息
51 | private int likes_count; // 喜欢的人数
52 | private Abilities abilities; // 当前用户所拥有的权限
53 |
54 |
55 | public int getId() {
56 | return id;
57 | }
58 |
59 | public void setId(int id) {
60 | this.id = id;
61 | }
62 |
63 | public String getBody_html() {
64 | return body_html;
65 | }
66 |
67 | public void setBody_html(String body_html) {
68 | this.body_html = body_html;
69 | }
70 |
71 | public String getCreated_at() {
72 | return created_at;
73 | }
74 |
75 | public void setCreated_at(String created_at) {
76 | this.created_at = created_at;
77 | }
78 |
79 | public String getUpdated_at() {
80 | return updated_at;
81 | }
82 |
83 | public void setUpdated_at(String updated_at) {
84 | this.updated_at = updated_at;
85 | }
86 |
87 | public boolean isDeleted() {
88 | return deleted;
89 | }
90 |
91 | public void setDeleted(boolean deleted) {
92 | this.deleted = deleted;
93 | }
94 |
95 | public int getNews_id() {
96 | return news_id;
97 | }
98 |
99 | public void setNews_id(int news_id) {
100 | this.news_id = news_id;
101 | }
102 |
103 | public User getUser() {
104 | return user;
105 | }
106 |
107 | public void setUser(User user) {
108 | this.user = user;
109 | }
110 |
111 | public int getLikes_count() {
112 | return likes_count;
113 | }
114 |
115 | public void setLikes_count(int likes_count) {
116 | this.likes_count = likes_count;
117 | }
118 |
119 | public Abilities getAbilities() {
120 | return abilities;
121 | }
122 |
123 | public void setAbilities(Abilities abilities) {
124 | this.abilities = abilities;
125 | }
126 |
127 | }
128 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/news/event/CreateNewsEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 23:56:43
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.news.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.news.bean.New;
30 |
31 | public class CreateNewsEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public CreateNewsEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param aNew 实体数据
43 | */
44 | public CreateNewsEvent(@Nullable String uuid, @NonNull Integer code, @Nullable New aNew) {
45 | super(uuid, code, aNew);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/news/event/CreateNewsReplyEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 00:06:36
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.news.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.news.bean.NewReply;
30 |
31 |
32 | public class CreateNewsReplyEvent extends BaseEvent {
33 | /**
34 | * @param uuid 唯一识别码
35 | */
36 | public CreateNewsReplyEvent(@Nullable String uuid) {
37 | super(uuid);
38 | }
39 |
40 | /**
41 | * @param uuid 唯一识别码
42 | * @param code 网络返回码
43 | * @param newReply 实体数据
44 | */
45 | public CreateNewsReplyEvent(@Nullable String uuid, @NonNull Integer code, @Nullable NewReply newReply) {
46 | super(uuid, code, newReply);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/news/event/DeleteNewsReplyEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 00:08:34
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.news.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.bean.State;
29 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
30 |
31 | public class DeleteNewsReplyEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public DeleteNewsReplyEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param state 实体数据
43 | */
44 | public DeleteNewsReplyEvent(@Nullable String uuid, @NonNull Integer code, @Nullable State state) {
45 | super(uuid, code, state);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/news/event/GetNewsListEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 23:55:00
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.news.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.news.bean.New;
30 |
31 | import java.util.List;
32 |
33 | public class GetNewsListEvent extends BaseEvent> {
34 | /**
35 | * @param uuid 唯一识别码
36 | */
37 | public GetNewsListEvent(@Nullable String uuid) {
38 | super(uuid);
39 | }
40 |
41 | /**
42 | * @param uuid 唯一识别码
43 | * @param code 网络返回码
44 | * @param news 实体数据
45 | */
46 | public GetNewsListEvent(@Nullable String uuid, @NonNull Integer code, @Nullable List news) {
47 | super(uuid, code, news);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/news/event/GetNewsNodesListEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 00:09:01
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.news.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.bean.Node;
29 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
30 |
31 | import java.util.List;
32 |
33 | public class GetNewsNodesListEvent extends BaseEvent> {
34 | /**
35 | * @param uuid 唯一识别码
36 | */
37 | public GetNewsNodesListEvent(@Nullable String uuid) {
38 | super(uuid);
39 | }
40 |
41 | /**
42 | * @param uuid 唯一识别码
43 | * @param code 网络返回码
44 | * @param nodes 实体数据
45 | */
46 | public GetNewsNodesListEvent(@Nullable String uuid, @NonNull Integer code, @Nullable List nodes) {
47 | super(uuid, code, nodes);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/news/event/GetNewsRepliesListEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 00:05:11
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.news.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.news.bean.NewReply;
30 |
31 | import java.util.List;
32 |
33 | public class GetNewsRepliesListEvent extends BaseEvent> {
34 | /**
35 | * @param uuid 唯一识别码
36 | */
37 | public GetNewsRepliesListEvent(@Nullable String uuid) {
38 | super(uuid);
39 | }
40 |
41 | /**
42 | * @param uuid 唯一识别码
43 | * @param code 网络返回码
44 | * @param newReplies 实体数据
45 | */
46 | public GetNewsRepliesListEvent(@Nullable String uuid, @NonNull Integer code, @Nullable List newReplies) {
47 | super(uuid, code, newReplies);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/news/event/GetNewsReplyEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 00:07:20
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.news.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.news.bean.NewReply;
30 |
31 | public class GetNewsReplyEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public GetNewsReplyEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param newReply 实体数据
43 | */
44 | public GetNewsReplyEvent(@Nullable String uuid, @NonNull Integer code, @Nullable NewReply newReply) {
45 | super(uuid, code, newReply);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/news/event/UpdateNewsReplyEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 00:07:55
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.news.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.news.bean.NewReply;
30 |
31 | public class UpdateNewsReplyEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public UpdateNewsReplyEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param newReply 实体数据
43 | */
44 | public UpdateNewsReplyEvent(@Nullable String uuid, @NonNull Integer code, @Nullable NewReply newReply) {
45 | super(uuid, code, newReply);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/notifications/api/NotificationsAPI.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.notifications.api;
24 |
25 | import android.support.annotation.NonNull;
26 |
27 | import com.gcssloop.diycode_sdk.api.notifications.event.*;
28 |
29 | public interface NotificationsAPI {
30 |
31 | /**
32 | * 获取通知列表
33 | *
34 | * @param offset 偏移数值,默认值 0
35 | * @param limit 数量极限,默认值 20,值范围 1..150
36 | * @see GetNotificationsListEvent
37 | */
38 | String getNotificationsList(@NonNull Integer offset, @NonNull Integer limit);
39 |
40 | /**
41 | * 获得未读通知的数量
42 | *
43 | * @see GetNotificationUnReadCountEvent
44 | */
45 | String getNotificationUnReadCount();
46 |
47 | /**
48 | * 将某些通知标记为已读
49 | *
50 | * @param ids id集合
51 | * @see MarkNotificationAsReadEvent
52 | */
53 | String markNotificationAsRead(int[] ids);
54 |
55 | /**
56 | * 删除用户的某条通知
57 | *
58 | * @param id id
59 | * @see DeleteNotificationEvent
60 | */
61 | String deleteNotionfition(@NonNull Integer id);
62 |
63 | /**
64 | * 删除当前用户的所有通知
65 | *
66 | * @see DeleteAllNotificationEvent
67 | */
68 | String deleteAllNotification();
69 | }
70 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/notifications/api/NotificationsService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.notifications.api;
24 |
25 | import com.gcssloop.diycode_sdk.api.base.bean.State;
26 | import com.gcssloop.diycode_sdk.api.notifications.bean.Count;
27 | import com.gcssloop.diycode_sdk.api.notifications.bean.Notification;
28 |
29 | import java.util.List;
30 |
31 | import retrofit2.Call;
32 | import retrofit2.http.DELETE;
33 | import retrofit2.http.Field;
34 | import retrofit2.http.FormUrlEncoded;
35 | import retrofit2.http.GET;
36 | import retrofit2.http.POST;
37 | import retrofit2.http.Path;
38 | import retrofit2.http.Query;
39 |
40 | interface NotificationsService {
41 |
42 | /**
43 | * 获取通知列表
44 | *
45 | * @param offset 偏移数值,默认值 0
46 | * @param limit 数量极限,默认值 20,值范围 1..150
47 | * @return 通知列表
48 | */
49 | @GET("notifications.json")
50 | Call> getNotificationsList(@Query("offset") Integer offset,
51 | @Query("limit") Integer limit);
52 |
53 | /**
54 | * 获得未读通知数量
55 | *
56 | * @return 未读通知数量
57 | */
58 | @GET("notifications/unread_count.json")
59 | Call getNotificationUnReadCount();
60 |
61 | /**
62 | * 将当前用户的一些通知设成已读状态
63 | *
64 | * @param ids id 集合
65 | * @return 状态
66 | */
67 | @Deprecated
68 | @POST("notifications/read.json")
69 | @FormUrlEncoded
70 | Call markNotificationAsRead(@Field("ids") int[] ids);
71 |
72 |
73 | /**
74 | * 删除当前用户的某个通知
75 | *
76 | * @param id 通知 id
77 | * @return 状态
78 | */
79 | @DELETE("notifications/{id}.json")
80 | Call deleteNotification(@Path("id") int id);
81 |
82 | /**
83 | * 删除当前用户的所有通知
84 | *
85 | * @return 状态
86 | */
87 | @DELETE("notifications/all.json")
88 | Call deleteAllNotification();
89 | }
90 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/notifications/bean/Count.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.notifications.bean;
24 |
25 | import java.io.Serializable;
26 |
27 | public class Count implements Serializable {
28 |
29 | private int count; // 数值
30 |
31 | public int getCount() {
32 | return count;
33 | }
34 |
35 | public void setCount(int count) {
36 | this.count = count;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/notifications/bean/Node.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-27 03:03:43
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.notifications.bean;
24 |
25 | public class Node {
26 | private int id;
27 |
28 | private String name;
29 |
30 | private int topics_count;
31 |
32 | private String summary;
33 |
34 | private int section_id;
35 |
36 | private int sort;
37 |
38 | private String section_name;
39 |
40 | private String updated_at;
41 |
42 | public void setId(int id) {
43 | this.id = id;
44 | }
45 |
46 | public int getId() {
47 | return this.id;
48 | }
49 |
50 | public void setName(String name) {
51 | this.name = name;
52 | }
53 |
54 | public String getName() {
55 | return this.name;
56 | }
57 |
58 | public void setTopics_count(int topics_count) {
59 | this.topics_count = topics_count;
60 | }
61 |
62 | public int getTopics_count() {
63 | return this.topics_count;
64 | }
65 |
66 | public void setSummary(String summary) {
67 | this.summary = summary;
68 | }
69 |
70 | public String getSummary() {
71 | return this.summary;
72 | }
73 |
74 | public void setSection_id(int section_id) {
75 | this.section_id = section_id;
76 | }
77 |
78 | public int getSection_id() {
79 | return this.section_id;
80 | }
81 |
82 | public void setSort(int sort) {
83 | this.sort = sort;
84 | }
85 |
86 | public int getSort() {
87 | return this.sort;
88 | }
89 |
90 | public void setSection_name(String section_name) {
91 | this.section_name = section_name;
92 | }
93 |
94 | public String getSection_name() {
95 | return this.section_name;
96 | }
97 |
98 | public void setUpdated_at(String updated_at) {
99 | this.updated_at = updated_at;
100 | }
101 |
102 | public String getUpdated_at() {
103 | return this.updated_at;
104 | }
105 |
106 | }
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/notifications/bean/Notification.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.notifications.bean;
24 |
25 | import com.gcssloop.diycode_sdk.api.topic.bean.Topic;
26 | import com.gcssloop.diycode_sdk.api.user.bean.User;
27 |
28 | import java.io.Serializable;
29 |
30 | public class Notification implements Serializable {
31 | private int id; // notification id
32 | private String type; // 类型
33 | private Boolean read; // 是否已读
34 | private User actor; // 相关人员
35 | private String mention_type; // 提及类型
36 | private Reply mention; // 提及详情
37 | private Topic topic; // topic
38 | private Reply reply; // 回复
39 | private Node node; // 节点变更
40 | private String created_at; // 创建时间
41 | private String updated_at; // 更新时间
42 |
43 | public void setId(int id) {
44 | this.id = id;
45 | }
46 |
47 | public int getId() {
48 | return this.id;
49 | }
50 |
51 | public void setType(String type) {
52 | this.type = type;
53 | }
54 |
55 | public String getType() {
56 | return this.type;
57 | }
58 |
59 | public void setRead(Boolean read) {
60 | this.read = read;
61 | }
62 |
63 | public Boolean getRead() {
64 | return this.read;
65 | }
66 |
67 | public void setActor(User actor) {
68 | this.actor = actor;
69 | }
70 |
71 | public User getActor() {
72 | return this.actor;
73 | }
74 |
75 | public void setMention_type(String mention_type) {
76 | this.mention_type = mention_type;
77 | }
78 |
79 | public String getMention_type() {
80 | return this.mention_type;
81 | }
82 |
83 | public void setMention(Reply mention) {
84 | this.mention = mention;
85 | }
86 |
87 | public Reply getMention() {
88 | return this.mention;
89 | }
90 |
91 | public void setTopic(Topic topic) {
92 | this.topic = topic;
93 | }
94 |
95 | public Topic getTopic() {
96 | return this.topic;
97 | }
98 |
99 | public void setReply(Reply reply) {
100 | this.reply = reply;
101 | }
102 |
103 | public Reply getReply() {
104 | return this.reply;
105 | }
106 |
107 | public void setNode(Node node) {
108 | this.node = node;
109 | }
110 |
111 | public Node getNode() {
112 | return this.node;
113 | }
114 |
115 | public void setCreated_at(String created_at) {
116 | this.created_at = created_at;
117 | }
118 |
119 | public String getCreated_at() {
120 | return this.created_at;
121 | }
122 |
123 | public void setUpdated_at(String updated_at) {
124 | this.updated_at = updated_at;
125 | }
126 |
127 | public String getUpdated_at() {
128 | return this.updated_at;
129 | }
130 |
131 | }
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/notifications/bean/Reply.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.notifications.bean;
24 |
25 | import com.gcssloop.diycode_sdk.api.base.bean.Abilities;
26 | import com.gcssloop.diycode_sdk.api.user.bean.User;
27 |
28 | import java.io.Serializable;
29 |
30 | public class Reply implements Serializable {
31 | private int id;
32 | private String body_html;
33 | private String created_at;
34 | private String updated_at;
35 | private boolean deleted;
36 | private int topic_id;
37 | private User user;
38 | private int likes_count;
39 | private Abilities abilities;
40 | private String body;
41 | private String topic_title;
42 |
43 | public void setId(int id) {
44 | this.id = id;
45 | }
46 |
47 | public int getId() {
48 | return this.id;
49 | }
50 |
51 | public void setBody_html(String body_html) {
52 | this.body_html = body_html;
53 | }
54 |
55 | public String getBody_html() {
56 | return this.body_html;
57 | }
58 |
59 | public void setCreated_at(String created_at) {
60 | this.created_at = created_at;
61 | }
62 |
63 | public String getCreated_at() {
64 | return this.created_at;
65 | }
66 |
67 | public void setUpdated_at(String updated_at) {
68 | this.updated_at = updated_at;
69 | }
70 |
71 | public String getUpdated_at() {
72 | return this.updated_at;
73 | }
74 |
75 | public void setDeleted(boolean deleted) {
76 | this.deleted = deleted;
77 | }
78 |
79 | public boolean getDeleted() {
80 | return this.deleted;
81 | }
82 |
83 | public void setTopic_id(int topic_id) {
84 | this.topic_id = topic_id;
85 | }
86 |
87 | public int getTopic_id() {
88 | return this.topic_id;
89 | }
90 |
91 | public void setUser(User user) {
92 | this.user = user;
93 | }
94 |
95 | public User getUser() {
96 | return this.user;
97 | }
98 |
99 | public void setLikes_count(int likes_count) {
100 | this.likes_count = likes_count;
101 | }
102 |
103 | public int getLikes_count() {
104 | return this.likes_count;
105 | }
106 |
107 | public void setAbilities(Abilities abilities) {
108 | this.abilities = abilities;
109 | }
110 |
111 | public Abilities getAbilities() {
112 | return this.abilities;
113 | }
114 |
115 | public void setBody(String body) {
116 | this.body = body;
117 | }
118 |
119 | public String getBody() {
120 | return this.body;
121 | }
122 |
123 | public void setTopic_title(String topic_title) {
124 | this.topic_title = topic_title;
125 | }
126 |
127 | public String getTopic_title() {
128 | return this.topic_title;
129 | }
130 |
131 | }
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/notifications/event/DeleteAllNotificationEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 02:35:26
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.notifications.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.bean.State;
29 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
30 |
31 | public class DeleteAllNotificationEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public DeleteAllNotificationEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param state 实体数据
43 | */
44 | public DeleteAllNotificationEvent(@Nullable String uuid, @NonNull Integer code, @Nullable State state) {
45 | super(uuid, code, state);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/notifications/event/DeleteNotificationEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 02:34:49
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.notifications.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.bean.State;
29 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
30 |
31 | public class DeleteNotificationEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public DeleteNotificationEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param state 实体数据
43 | */
44 | public DeleteNotificationEvent(@Nullable String uuid, @NonNull Integer code, @Nullable State state) {
45 | super(uuid, code, state);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/notifications/event/GetNotificationUnReadCountEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 02:32:06
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.notifications.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.notifications.bean.Count;
30 |
31 | public class GetNotificationUnReadCountEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public GetNotificationUnReadCountEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param count 实体数据
43 | */
44 | public GetNotificationUnReadCountEvent(@Nullable String uuid, @NonNull Integer code, @Nullable Count count) {
45 | super(uuid, code, count);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/notifications/event/GetNotificationsListEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 02:30:16
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.notifications.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.notifications.bean.Notification;
30 |
31 | import java.util.List;
32 |
33 | public class GetNotificationsListEvent extends BaseEvent> {
34 |
35 | /**
36 | * @param uuid 唯一识别码
37 | */
38 | public GetNotificationsListEvent(@Nullable String uuid) {
39 | super(uuid);
40 | }
41 |
42 | /**
43 | * @param uuid 唯一识别码
44 | * @param code 网络返回码
45 | * @param notifications 实体数据
46 | */
47 | public GetNotificationsListEvent(@Nullable String uuid, @NonNull Integer code, @Nullable List notifications) {
48 | super(uuid, code, notifications);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/notifications/event/MarkNotificationAsReadEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 02:33:31
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.notifications.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.bean.State;
29 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
30 |
31 | public class MarkNotificationAsReadEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public MarkNotificationAsReadEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param state 实体数据
43 | */
44 | public MarkNotificationAsReadEvent(@Nullable String uuid, @NonNull Integer code, @Nullable State state) {
45 | super(uuid, code, state);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/photo/api/PhotoAPI.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.photo.api;
24 |
25 | import android.support.annotation.NonNull;
26 |
27 | import com.gcssloop.diycode_sdk.api.photo.event.UploadPhotoEvent;
28 |
29 | import java.io.File;
30 |
31 | public interface PhotoAPI {
32 |
33 | //--- photo ------------------------------------------------------------------------------------
34 |
35 | /**
36 | * 上传图片,请使用 Multipart 的方式提交图片文件
37 | *
38 | * @param img_file 图片文件
39 | * @see UploadPhotoEvent
40 | */
41 | String uploadPhoto(@NonNull File img_file);
42 | }
43 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/photo/api/PhotoImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 02:21:32
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.photo.api;
24 |
25 | import android.content.Context;
26 | import android.support.annotation.NonNull;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.callback.BaseCallback;
29 | import com.gcssloop.diycode_sdk.api.base.impl.BaseImpl;
30 | import com.gcssloop.diycode_sdk.api.photo.event.UploadPhotoEvent;
31 | import com.gcssloop.diycode_sdk.utils.UUIDGenerator;
32 |
33 | import java.io.File;
34 |
35 | public class PhotoImpl extends BaseImpl implements PhotoAPI {
36 | public PhotoImpl(@NonNull Context context) {
37 | super(context);
38 | }
39 |
40 | /**
41 | * 上传图片,请使用 Multipart 的方式提交图片文件
42 | *
43 | * @param img_file 图片文件
44 | * @see UploadPhotoEvent
45 | */
46 | @Override
47 | public String uploadPhoto(@NonNull File img_file) {
48 | String uuid = UUIDGenerator.getUUID();
49 | mService.uploadPhoto(img_file).enqueue(new BaseCallback<>(new UploadPhotoEvent(uuid)));
50 | return uuid;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/photo/api/PhotoService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.photo.api;
24 |
25 | import com.gcssloop.diycode_sdk.api.photo.bean.Photo;
26 |
27 | import java.io.File;
28 |
29 | import retrofit2.Call;
30 | import retrofit2.http.Field;
31 | import retrofit2.http.POST;
32 |
33 | interface PhotoService {
34 |
35 | /**
36 | * 上传图片,请使用 Multipart 的方式提交图片文件
37 | *
38 | * @param img_file 图片文件
39 | * @return 图片地址
40 | */
41 | @POST("photos.json")
42 | Call uploadPhoto(@Field("file") File img_file);
43 | }
44 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/photo/bean/Photo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 02:18:04
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.photo.bean;
24 |
25 | public class Photo {
26 | /**
27 | * image_url : https://diycode.b0.upaiyun.com/photo/2017/980ab912bb99173feb0966e23e88515c.jpeg
28 | */
29 |
30 | private String image_url;
31 |
32 | public String getImage_url() {
33 | return image_url;
34 | }
35 |
36 | public void setImage_url(String image_url) {
37 | this.image_url = image_url;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/photo/event/UploadPhotoEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 02:20:40
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.photo.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.photo.bean.Photo;
30 |
31 | public class UploadPhotoEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public UploadPhotoEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param photo 实体数据
43 | */
44 | public UploadPhotoEvent(@Nullable String uuid, @NonNull Integer code, @Nullable Photo photo) {
45 | super(uuid, code, photo);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/project/api/ProjectAPI.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 02:08:53
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.project.api;
24 |
25 | import retrofit2.http.FormUrlEncoded;
26 |
27 | public interface ProjectAPI {
28 |
29 | //--- project ---------------------------------------------------------------------------------
30 |
31 | /**
32 | * 获取 project 列表
33 | *
34 | * @param node_id 如果你需要只看某个节点的,请传此参数, 如果不传 则返回全部
35 | * @param offset 偏移数值,默认值 0
36 | * @param limit 数量极限,默认值 20,值范围 1..150
37 | * @see
38 | */
39 | String getProjectsList(Integer node_id, Integer offset, Integer limit);
40 |
41 | //--- project reply ----------------------------------------------------------------------------
42 |
43 | /**
44 | * 获取 project 回复列表
45 | *
46 | * @param id project 的 id
47 | * @param offset 偏移数值 默认 0
48 | * @param limit 数量极限,默认值 20,值范围 1...150
49 | * @see
50 | */
51 | String getProjectRepliesList(int id, Integer offset, Integer limit);
52 |
53 | /**
54 | * 创建 project 回帖(回复,评论)
55 | *
56 | * @param id 话题列表
57 | * @param body 回帖内容, Markdown 格式
58 | * @return
59 | */
60 | @FormUrlEncoded
61 | String createProjectReply(int id, String body);
62 |
63 | /**
64 | * 获取回帖的详细内容(一般用于编辑回帖的时候)
65 | *
66 | * @param id id
67 | * @see
68 | */
69 | String getProjectReply(int id);
70 |
71 |
72 | /**
73 | * 更新回帖
74 | *
75 | * @param id id
76 | * @param body 回帖详情
77 | * @see
78 | */
79 | @FormUrlEncoded
80 | String updateProjectReply(int id, String body);
81 |
82 | /**
83 | * 删除回帖
84 | *
85 | * @param id id
86 | * @see
87 | */
88 | @FormUrlEncoded
89 | String deleteProjectReply(int id);
90 | }
91 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/project/api/ProjectService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.project.api;
24 |
25 | import com.gcssloop.diycode_sdk.api.base.bean.State;
26 | import com.gcssloop.diycode_sdk.api.project.bean.Project;
27 | import com.gcssloop.diycode_sdk.api.project.bean.ProjectReply;
28 |
29 | import java.util.List;
30 |
31 | import retrofit2.Call;
32 | import retrofit2.http.DELETE;
33 | import retrofit2.http.Field;
34 | import retrofit2.http.FormUrlEncoded;
35 | import retrofit2.http.GET;
36 | import retrofit2.http.POST;
37 | import retrofit2.http.Path;
38 | import retrofit2.http.Query;
39 |
40 | interface ProjectService {
41 |
42 | //--- project ---------------------------------------------------------------------------------
43 |
44 | /**
45 | * 获取 project 列表
46 | *
47 | * @param node_id 如果你需要只看某个节点的,请传此参数, 如果不传 则返回全部
48 | * @param offset 偏移数值,默认值 0
49 | * @param limit 数量极限,默认值 20,值范围 1..150
50 | * @return project 列表
51 | */
52 | @GET("projects.json")
53 | Call> getProjectsList(@Query("node_id") Integer node_id,
54 | @Query("offset") Integer offset, @Query("limit") Integer limit);
55 |
56 | //--- project reply ----------------------------------------------------------------------------
57 |
58 | /**
59 | * 获取 project 回复列表
60 | *
61 | * @param id project 的 id
62 | * @param offset 偏移数值 默认 0
63 | * @param limit 数量极限,默认值 20,值范围 1...150
64 | * @return 回复列表
65 | */
66 | @GET("projects/{id}/replies.json")
67 | Call> getProjectRepliesList(@Path("id") int id, @Query("offset") Integer offset,
68 | @Query("limit") Integer limit);
69 |
70 | /**
71 | * 创建 project 回帖(回复,评论)
72 | *
73 | * @param id 话题列表
74 | * @param body 回帖内容, Markdown 格式
75 | * @return
76 | */
77 | @POST("projects/{id}/replies.json")
78 | @FormUrlEncoded
79 | Call createProjectReply(@Path("id") int id, @Field("body") String body);
80 |
81 | /**
82 | * 获取回帖的详细内容(一般用于编辑回帖的时候)
83 | *
84 | * @param id id
85 | * @return 回帖内容
86 | */
87 | @GET("project_replies/{id}.json")
88 | Call getProjectReply(@Path("id") int id);
89 |
90 |
91 | /**
92 | * 更新回帖
93 | *
94 | * @param id id
95 | * @param body 回帖详情
96 | * @return 回帖内容
97 | */
98 | @POST("project_replies/{id}.json")
99 | @FormUrlEncoded
100 | Call updateProjectReply(@Path("id") int id, @Field("body") String body);
101 |
102 | /**
103 | * 删除回帖
104 | *
105 | * @param id id
106 | * @return 状态
107 | */
108 | @DELETE("project_replies/{id}.json")
109 | Call deleteProjectReply(@Path("id") int id);
110 | }
111 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/project/bean/ProjectReply.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.project.bean;
24 |
25 | import com.gcssloop.diycode_sdk.api.base.bean.Abilities;
26 | import com.gcssloop.diycode_sdk.api.user.bean.User;
27 |
28 | import java.io.Serializable;
29 |
30 | public class ProjectReply implements Serializable {
31 |
32 | private int id; // 回复 的 id
33 | private String body_html; // 回复内容详情(HTML)
34 | private String created_at; // 创建时间
35 | private String updated_at; // 更新时间
36 | private boolean deleted; // 是否已经删除
37 | private int project_id; // project 的 id
38 | private User user; // 创建该回复的用户信息
39 | private int likes_count; // 喜欢的人数
40 | private Abilities abilities; // 当前用户所拥有的权限
41 |
42 |
43 | public int getId() {
44 | return id;
45 | }
46 |
47 | public void setId(int id) {
48 | this.id = id;
49 | }
50 |
51 | public String getBody_html() {
52 | return body_html;
53 | }
54 |
55 | public void setBody_html(String body_html) {
56 | this.body_html = body_html;
57 | }
58 |
59 | public String getCreated_at() {
60 | return created_at;
61 | }
62 |
63 | public void setCreated_at(String created_at) {
64 | this.created_at = created_at;
65 | }
66 |
67 | public String getUpdated_at() {
68 | return updated_at;
69 | }
70 |
71 | public void setUpdated_at(String updated_at) {
72 | this.updated_at = updated_at;
73 | }
74 |
75 | public boolean isDeleted() {
76 | return deleted;
77 | }
78 |
79 | public void setDeleted(boolean deleted) {
80 | this.deleted = deleted;
81 | }
82 |
83 | public int getProject_id() {
84 | return project_id;
85 | }
86 |
87 | public void setProject_id(int project_id) {
88 | this.project_id = project_id;
89 | }
90 |
91 | public User getUser() {
92 | return user;
93 | }
94 |
95 | public void setUser(User user) {
96 | this.user = user;
97 | }
98 |
99 | public int getLikes_count() {
100 | return likes_count;
101 | }
102 |
103 | public void setLikes_count(int likes_count) {
104 | this.likes_count = likes_count;
105 | }
106 |
107 | public Abilities getAbilities() {
108 | return abilities;
109 | }
110 |
111 | public void setAbilities(Abilities abilities) {
112 | this.abilities = abilities;
113 | }
114 |
115 | }
116 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/project/event/CreateProjectReplyEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 02:53:54
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.project.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.project.bean.ProjectReply;
30 |
31 | public class CreateProjectReplyEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public CreateProjectReplyEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param projectReply 实体数据
43 | */
44 | public CreateProjectReplyEvent(@Nullable String uuid, @NonNull Integer code, @Nullable ProjectReply projectReply) {
45 | super(uuid, code, projectReply);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/project/event/DeleteProjectReplyEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 02:57:09
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.project.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.bean.State;
29 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
30 |
31 | public class DeleteProjectReplyEvent extends BaseEvent {
32 |
33 | /**
34 | * @param uuid 唯一识别码
35 | */
36 | public DeleteProjectReplyEvent(@Nullable String uuid) {
37 | super(uuid);
38 | }
39 |
40 | /**
41 | * @param uuid 唯一识别码
42 | * @param code 网络返回码
43 | * @param state 实体数据
44 | */
45 | public DeleteProjectReplyEvent(@Nullable String uuid, @NonNull Integer code, @Nullable State state) {
46 | super(uuid, code, state);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/project/event/GetProjectRepliesListEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 02:52:15
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.project.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.project.bean.ProjectReply;
30 |
31 | import java.util.List;
32 |
33 | public class GetProjectRepliesListEvent extends BaseEvent> {
34 | /**
35 | * @param uuid 唯一识别码
36 | */
37 | public GetProjectRepliesListEvent(@Nullable String uuid) {
38 | super(uuid);
39 | }
40 |
41 | /**
42 | * @param uuid 唯一识别码
43 | * @param code 网络返回码
44 | * @param projectReplies 实体数据
45 | */
46 | public GetProjectRepliesListEvent(@Nullable String uuid, @NonNull Integer code, @Nullable List projectReplies) {
47 | super(uuid, code, projectReplies);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/project/event/GetProjectReplyEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 02:55:37
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.project.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.project.bean.ProjectReply;
30 |
31 | public class GetProjectReplyEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public GetProjectReplyEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param projectReply 实体数据
43 | */
44 | public GetProjectReplyEvent(@Nullable String uuid, @NonNull Integer code, @Nullable ProjectReply projectReply) {
45 | super(uuid, code, projectReply);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/project/event/GetProjectsListEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 02:50:52
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.project.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.project.bean.Project;
30 |
31 | import java.util.List;
32 |
33 | public class GetProjectsListEvent extends BaseEvent> {
34 | /**
35 | * @param uuid 唯一识别码
36 | */
37 | public GetProjectsListEvent(@Nullable String uuid) {
38 | super(uuid);
39 | }
40 |
41 | /**
42 | * @param uuid 唯一识别码
43 | * @param code 网络返回码
44 | * @param projects 实体数据
45 | */
46 | public GetProjectsListEvent(@Nullable String uuid, @NonNull Integer code, @Nullable List projects) {
47 | super(uuid, code, projects);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/project/event/UpdateProjectReplyEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 02:56:50
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.project.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.project.bean.ProjectReply;
30 |
31 | public class UpdateProjectReplyEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public UpdateProjectReplyEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param projectReply 实体数据
43 | */
44 | public UpdateProjectReplyEvent(@Nullable String uuid, @NonNull Integer code, @Nullable ProjectReply projectReply) {
45 | super(uuid, code, projectReply);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/sites/api/SitesAPI.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.sites.api;
24 |
25 | import com.gcssloop.diycode_sdk.api.sites.event.GetSitesEvent;
26 |
27 | public interface SitesAPI {
28 |
29 | /**
30 | * 获取 酷站 列表
31 | * @see GetSitesEvent
32 | */
33 | String getSites();
34 | }
35 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/sites/api/SitesImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 00:34:31
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.sites.api;
24 |
25 | import android.content.Context;
26 | import android.support.annotation.NonNull;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.callback.BaseCallback;
29 | import com.gcssloop.diycode_sdk.api.base.impl.BaseImpl;
30 | import com.gcssloop.diycode_sdk.api.sites.event.GetSitesEvent;
31 | import com.gcssloop.diycode_sdk.utils.UUIDGenerator;
32 |
33 | public class SitesImpl extends BaseImpl implements SitesAPI {
34 | public SitesImpl(@NonNull Context context) {
35 | super(context);
36 | }
37 |
38 | /**
39 | * 获取 酷站 列表
40 | *
41 | * @see GetSitesEvent
42 | */
43 | @Override
44 | public String getSites() {
45 | String uuid = UUIDGenerator.getUUID();
46 | mService.getSites().enqueue(new BaseCallback<>(new GetSitesEvent(uuid)));
47 | return uuid;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/sites/api/SitesService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.sites.api;
24 |
25 | import com.gcssloop.diycode_sdk.api.sites.bean.Sites;
26 |
27 | import java.util.List;
28 |
29 | import retrofit2.Call;
30 | import retrofit2.http.GET;
31 |
32 | interface SitesService {
33 |
34 | /**
35 | * 获取 酷站 列表
36 | * @return 列表
37 | */
38 | @GET("sites.json")
39 | Call> getSites();
40 | }
41 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/sites/event/GetSitesEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 00:35:08
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.sites.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.sites.bean.Sites;
30 |
31 | import java.util.List;
32 |
33 | public class GetSitesEvent extends BaseEvent> {
34 | /**
35 | * @param uuid 唯一识别码
36 | */
37 | public GetSitesEvent(@Nullable String uuid) {
38 | super(uuid);
39 | }
40 |
41 | /**
42 | * @param uuid 唯一识别码
43 | * @param code 网络返回码
44 | * @param sites 实体数据
45 | */
46 | public GetSitesEvent(@Nullable String uuid, @NonNull Integer code, @Nullable List sites) {
47 | super(uuid, code, sites);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/test/Event/HelloEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.test.Event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.test.bean.Hello;
30 |
31 | public class HelloEvent extends BaseEvent {
32 |
33 | /**
34 | * @param uuid 唯一识别码
35 | */
36 | public HelloEvent(@Nullable String uuid) {
37 | super(uuid);
38 | }
39 |
40 | /**
41 | * @param uuid 唯一识别码
42 | * @param code 网络返回码
43 | * @param hello 实体数据
44 | */
45 | public HelloEvent(@Nullable String uuid, @NonNull Integer code, @Nullable Hello hello) {
46 | super(uuid, code, hello);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/test/api/TestAPI.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.test.api;
24 |
25 | import android.support.annotation.Nullable;
26 |
27 | import com.gcssloop.diycode_sdk.api.test.Event.HelloEvent;
28 |
29 | public interface TestAPI {
30 |
31 | //--- 测试接口 --------------------------------------------------------------------------------
32 |
33 | /**
34 | * 简单的 API 测试接口,需要登录验证,便于快速测试 OAuth 以及其他 API 的基本格式是否正确。
35 | * 使用 HelloEvent 接收结果。
36 | *
37 | * @param limit 数量极限,值范围[0..100]
38 | * @see HelloEvent
39 | */
40 | String hello(@Nullable Integer limit);
41 | }
42 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/test/api/TestImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.test.api;
24 |
25 | import android.content.Context;
26 | import android.support.annotation.NonNull;
27 | import android.support.annotation.Nullable;
28 |
29 | import com.gcssloop.diycode_sdk.api.base.callback.BaseCallback;
30 | import com.gcssloop.diycode_sdk.api.base.impl.BaseImpl;
31 | import com.gcssloop.diycode_sdk.api.test.Event.HelloEvent;
32 | import com.gcssloop.diycode_sdk.utils.UUIDGenerator;
33 |
34 | public class TestImpl extends BaseImpl implements TestAPI {
35 | public TestImpl(@NonNull Context context) {
36 | super(context);
37 | }
38 |
39 | /**
40 | * 简单的 API 测试接口,需要登录验证,便于快速测试 OAuth 以及其他 API 的基本格式是否正确。
41 | * 使用 HelloEvent 接收结果。
42 | *
43 | * @param limit 数量极限,值范围[0..100]
44 | * @see HelloEvent
45 | */
46 | @Override
47 | public String hello(@Nullable Integer limit) {
48 | final String uuid = UUIDGenerator.getUUID();
49 | mService.hello(limit).enqueue(new BaseCallback<>(new HelloEvent(uuid)));
50 | return uuid;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/test/api/TestService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.test.api;
24 |
25 | import com.gcssloop.diycode_sdk.api.test.bean.Hello;
26 |
27 | import retrofit2.Call;
28 | import retrofit2.http.GET;
29 | import retrofit2.http.Query;
30 |
31 | interface TestService {
32 |
33 | //--- 测试接口 -------------------------------------------------------------------------------
34 |
35 | /**
36 | * 测试 token 是否正常
37 | *
38 | * @param limit 极限值
39 | * @return Hello 实体类
40 | */
41 | @GET("hello.json")
42 | Call hello(@Query("limit") Integer limit);
43 | }
44 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/test/bean/Hello.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.test.bean;
24 |
25 | import java.io.Serializable;
26 |
27 | /**
28 | * 测试(测试 token 是否管用)
29 | */
30 | public class Hello implements Serializable {
31 |
32 | private int id; // 当前用户唯一 id
33 | private String login; // 当前用户登录用户名
34 | private String name; // 当前用户昵称
35 | private String avatar_url; // 当前用户的头像链接
36 |
37 | public void setId(int id) {
38 | this.id = id;
39 | }
40 |
41 | public int getId() {
42 | return this.id;
43 | }
44 |
45 | public void setLogin(String login) {
46 | this.login = login;
47 | }
48 |
49 | public String getLogin() {
50 | return this.login;
51 | }
52 |
53 | public void setName(String name) {
54 | this.name = name;
55 | }
56 |
57 | public String getName() {
58 | return this.name;
59 | }
60 |
61 | public void setAvatar_url(String avatar_url) {
62 | this.avatar_url = avatar_url;
63 | }
64 |
65 | public String getAvatar_url() {
66 | return this.avatar_url;
67 | }
68 |
69 | @Override
70 | public String toString() {
71 | return "Hello{" +
72 | "id=" + id +
73 | ", login='" + login + '\'' +
74 | ", name='" + name + '\'' +
75 | ", avatar_url='" + avatar_url + '\'' +
76 | '}';
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/topic/bean/Node.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-27 03:03:43
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.topic.bean;
24 |
25 | public class Node {
26 | private int id;
27 |
28 | private String name;
29 |
30 | private int topics_count;
31 |
32 | private String summary;
33 |
34 | private int section_id;
35 |
36 | private int sort;
37 |
38 | private String section_name;
39 |
40 | private String updated_at;
41 |
42 | public void setId(int id) {
43 | this.id = id;
44 | }
45 |
46 | public int getId() {
47 | return this.id;
48 | }
49 |
50 | public void setName(String name) {
51 | this.name = name;
52 | }
53 |
54 | public String getName() {
55 | return this.name;
56 | }
57 |
58 | public void setTopics_count(int topics_count) {
59 | this.topics_count = topics_count;
60 | }
61 |
62 | public int getTopics_count() {
63 | return this.topics_count;
64 | }
65 |
66 | public void setSummary(String summary) {
67 | this.summary = summary;
68 | }
69 |
70 | public String getSummary() {
71 | return this.summary;
72 | }
73 |
74 | public void setSection_id(int section_id) {
75 | this.section_id = section_id;
76 | }
77 |
78 | public int getSection_id() {
79 | return this.section_id;
80 | }
81 |
82 | public void setSort(int sort) {
83 | this.sort = sort;
84 | }
85 |
86 | public int getSort() {
87 | return this.sort;
88 | }
89 |
90 | public void setSection_name(String section_name) {
91 | this.section_name = section_name;
92 | }
93 |
94 | public String getSection_name() {
95 | return this.section_name;
96 | }
97 |
98 | public void setUpdated_at(String updated_at) {
99 | this.updated_at = updated_at;
100 | }
101 |
102 | public String getUpdated_at() {
103 | return this.updated_at;
104 | }
105 |
106 | }
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/topic/bean/TopicReply.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.topic.bean;
24 |
25 | import com.gcssloop.diycode_sdk.api.base.bean.Abilities;
26 | import com.gcssloop.diycode_sdk.api.user.bean.User;
27 |
28 | import java.io.Serializable;
29 |
30 | public class TopicReply implements Serializable {
31 | /**
32 | * id : 2839
33 | * body_html : 期待 GcsSloop版的 diycode 客户端
34 | * created_at : 2017-02-13T10:07:24.362+08:00
35 | * updated_at : 2017-02-13T10:07:24.362+08:00
36 | * deleted : false
37 | * topic_id : 604
38 | * user : {"id":1,"login":"jixiaohua","name":"寂小桦","avatar_url":"https://diycode.b0.upaiyun.com/user/large_avatar/2.jpg"}
39 | * likes_count : 0
40 | * abilities : {"update":false,"destroy":false}
41 | */
42 |
43 | private int id; // 回复 的 id
44 | private String body_html; // 回复内容详情(HTML)
45 | private String created_at; // 创建时间
46 | private String updated_at; // 更新时间
47 | private boolean deleted; // 是否已经删除
48 | private int topic_id; // topic 的 id
49 | private User user; // 创建该回复的用户信息
50 | private int likes_count; // 喜欢的人数
51 | private Abilities abilities; // 当前用户所拥有的权限
52 |
53 | public int getId() {
54 | return id;
55 | }
56 |
57 | public void setId(int id) {
58 | this.id = id;
59 | }
60 |
61 | public String getBody_html() {
62 | return body_html;
63 | }
64 |
65 | public void setBody_html(String body_html) {
66 | this.body_html = body_html;
67 | }
68 |
69 | public String getCreated_at() {
70 | return created_at;
71 | }
72 |
73 | public void setCreated_at(String created_at) {
74 | this.created_at = created_at;
75 | }
76 |
77 | public String getUpdated_at() {
78 | return updated_at;
79 | }
80 |
81 | public void setUpdated_at(String updated_at) {
82 | this.updated_at = updated_at;
83 | }
84 |
85 | public boolean isDeleted() {
86 | return deleted;
87 | }
88 |
89 | public void setDeleted(boolean deleted) {
90 | this.deleted = deleted;
91 | }
92 |
93 | public int getTopic_id() {
94 | return topic_id;
95 | }
96 |
97 | public void setTopic_id(int topic_id) {
98 | this.topic_id = topic_id;
99 | }
100 |
101 | public User getUser() {
102 | return user;
103 | }
104 |
105 | public void setUser(User user) {
106 | this.user = user;
107 | }
108 |
109 | public int getLikes_count() {
110 | return likes_count;
111 | }
112 |
113 | public void setLikes_count(int likes_count) {
114 | this.likes_count = likes_count;
115 | }
116 |
117 | public Abilities getAbilities() {
118 | return abilities;
119 | }
120 |
121 | public void setAbilities(Abilities abilities) {
122 | this.abilities = abilities;
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/topic/event/BanTopicEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.topic.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.bean.State;
29 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
30 |
31 | public class BanTopicEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public BanTopicEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param state 实体数据
43 | */
44 | public BanTopicEvent(@Nullable String uuid, @NonNull Integer code, @Nullable State state) {
45 | super(uuid, code, state);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/topic/event/CollectionTopicEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.topic.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.bean.State;
29 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
30 |
31 | public class CollectionTopicEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public CollectionTopicEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param state 实体数据
43 | */
44 | public CollectionTopicEvent(@Nullable String uuid, @NonNull Integer code, @Nullable State state) {
45 | super(uuid, code, state);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/topic/event/CreateTopicEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.topic.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.topic.bean.TopicContent;
30 |
31 | public class CreateTopicEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public CreateTopicEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param topicContent 实体数据
43 | */
44 | public CreateTopicEvent(@Nullable String uuid, @NonNull Integer code, @Nullable TopicContent topicContent) {
45 | super(uuid, code, topicContent);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/topic/event/CreateTopicReplyEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.topic.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.topic.bean.TopicReply;
30 |
31 | public class CreateTopicReplyEvent extends BaseEvent {
32 |
33 | /**
34 | * @param uuid 唯一识别码
35 | */
36 | public CreateTopicReplyEvent(@Nullable String uuid) {
37 | super(uuid);
38 | }
39 |
40 | /**
41 | * @param uuid 唯一识别码
42 | * @param code 网络返回码
43 | * @param topicReply 实体数据
44 | */
45 | public CreateTopicReplyEvent(@Nullable String uuid, @NonNull Integer code, @Nullable TopicReply topicReply) {
46 | super(uuid, code, topicReply);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/topic/event/DeleteTopicEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.topic.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.bean.State;
29 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
30 |
31 |
32 | public class DeleteTopicEvent extends BaseEvent {
33 | /**
34 | * @param uuid 唯一识别码
35 | */
36 | public DeleteTopicEvent(@Nullable String uuid) {
37 | super(uuid);
38 | }
39 |
40 | /**
41 | * @param uuid 唯一识别码
42 | * @param code 网络返回码
43 | * @param state 实体数据
44 | */
45 | public DeleteTopicEvent(@Nullable String uuid, @NonNull Integer code, @Nullable State state) {
46 | super(uuid, code, state);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/topic/event/DeleteTopicReplyEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.topic.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.bean.State;
29 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
30 |
31 | public class DeleteTopicReplyEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public DeleteTopicReplyEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param state 实体数据
43 | */
44 | public DeleteTopicReplyEvent(@Nullable String uuid, @NonNull Integer code, @Nullable State state) {
45 | super(uuid, code, state);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/topic/event/GetTopicEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.topic.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.topic.bean.TopicContent;
30 |
31 | public class GetTopicEvent extends BaseEvent {
32 |
33 | /**
34 | * @param uuid 唯一识别码
35 | */
36 | public GetTopicEvent(@Nullable String uuid) {
37 | super(uuid);
38 | }
39 |
40 | /**
41 | * @param uuid 唯一识别码
42 | * @param code 网络返回码
43 | * @param topicContent 实体数据
44 | */
45 | public GetTopicEvent(@Nullable String uuid, @NonNull Integer code, @Nullable TopicContent topicContent) {
46 | super(uuid, code, topicContent);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/topic/event/GetTopicNodeListEvent.java:
--------------------------------------------------------------------------------
1 | package com.gcssloop.diycode_sdk.api.topic.event;
2 |
3 | import android.support.annotation.NonNull;
4 | import android.support.annotation.Nullable;
5 |
6 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
7 | import com.gcssloop.diycode_sdk.api.topic.bean.Node;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * Created by Zack on 2017/7/12.
13 | */
14 |
15 | public class GetTopicNodeListEvent extends BaseEvent> {
16 |
17 | public GetTopicNodeListEvent(@Nullable String uuid) {
18 | super(uuid);
19 | }
20 |
21 | public GetTopicNodeListEvent(@Nullable String uuid, @NonNull Integer code, @Nullable List nodes) {
22 | super(uuid, code, nodes);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/topic/event/GetTopicRepliesListEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.topic.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.topic.bean.TopicReply;
30 |
31 | import java.util.List;
32 |
33 | public class GetTopicRepliesListEvent extends BaseEvent> {
34 | /**
35 | * @param uuid 唯一识别码
36 | */
37 | public GetTopicRepliesListEvent(@Nullable String uuid) {
38 | super(uuid);
39 | }
40 |
41 | /**
42 | * @param uuid 唯一识别码
43 | * @param code 网络返回码
44 | * @param topicReplies 实体数据
45 | */
46 | public GetTopicRepliesListEvent(@Nullable String uuid, @NonNull Integer code, @Nullable List topicReplies) {
47 | super(uuid, code, topicReplies);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/topic/event/GetTopicReplyEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.topic.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.topic.bean.TopicReply;
30 |
31 | public class GetTopicReplyEvent extends BaseEvent {
32 |
33 | /**
34 | * @param uuid 唯一识别码
35 | */
36 | public GetTopicReplyEvent(@Nullable String uuid) {
37 | super(uuid);
38 | }
39 |
40 | /**
41 | * @param uuid 唯一识别码
42 | * @param code 网络返回码
43 | * @param topicReply 实体数据
44 | */
45 | public GetTopicReplyEvent(@Nullable String uuid, @NonNull Integer code, @Nullable TopicReply topicReply) {
46 | super(uuid, code, topicReply);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/topic/event/GetTopicsListEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.topic.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.topic.bean.Topic;
30 |
31 | import java.util.List;
32 |
33 | public class GetTopicsListEvent extends BaseEvent> {
34 |
35 | /**
36 | * @param uuid 唯一识别码
37 | */
38 | public GetTopicsListEvent(@Nullable String uuid) {
39 | super(uuid);
40 | }
41 |
42 | /**
43 | * @param uuid 唯一识别码
44 | * @param code 网络返回码
45 | * @param topics 实体数据
46 | */
47 | public GetTopicsListEvent(@Nullable String uuid, @NonNull Integer code, @Nullable List topics) {
48 | super(uuid, code, topics);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/topic/event/UnCollectionTopicEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.topic.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.bean.State;
29 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
30 |
31 | public class UnCollectionTopicEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public UnCollectionTopicEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param state 实体数据
43 | */
44 | public UnCollectionTopicEvent(@Nullable String uuid, @NonNull Integer code, @Nullable State state) {
45 | super(uuid, code, state);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/topic/event/UnWatchTopicEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.topic.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.bean.State;
29 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
30 |
31 | public class UnWatchTopicEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public UnWatchTopicEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param state 实体数据
43 | */
44 | public UnWatchTopicEvent(@Nullable String uuid, @NonNull Integer code, @Nullable State state) {
45 | super(uuid, code, state);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/topic/event/UpdateTopicEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.topic.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.topic.bean.TopicContent;
30 |
31 | public class UpdateTopicEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public UpdateTopicEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param topicContent 实体数据
43 | */
44 | public UpdateTopicEvent(@Nullable String uuid, @NonNull Integer code, @Nullable TopicContent topicContent) {
45 | super(uuid, code, topicContent);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/topic/event/UpdateTopicReplyEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.topic.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.topic.bean.TopicReply;
30 |
31 | public class UpdateTopicReplyEvent extends BaseEvent {
32 |
33 | /**
34 | * @param uuid 唯一识别码
35 | */
36 | public UpdateTopicReplyEvent(@Nullable String uuid) {
37 | super(uuid);
38 | }
39 |
40 | /**
41 | * @param uuid 唯一识别码
42 | * @param code 网络返回码
43 | * @param topicReply 实体数据
44 | */
45 | public UpdateTopicReplyEvent(@Nullable String uuid, @NonNull Integer code, @Nullable TopicReply topicReply) {
46 | super(uuid, code, topicReply);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/topic/event/WatchTopicEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.topic.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.bean.State;
29 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
30 |
31 | public class WatchTopicEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public WatchTopicEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param state 实体数据
43 | */
44 | public WatchTopicEvent(@Nullable String uuid, @NonNull Integer code, @Nullable State state) {
45 | super(uuid, code, state);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/user/bean/User.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.user.bean;
24 |
25 | import java.io.Serializable;
26 |
27 | /**
28 | * 用户信息
29 | */
30 | public class User implements Serializable{
31 | private int id; // 唯一 id
32 | private String login; // 登录用户名
33 | private String name; // 昵称
34 | private String avatar_url; // 头像链接
35 |
36 | public void setId(int id) {
37 | this.id = id;
38 | }
39 |
40 | public int getId() {
41 | return this.id;
42 | }
43 |
44 | public void setLogin(String login) {
45 | this.login = login;
46 | }
47 |
48 | public String getLogin() {
49 | return this.login;
50 | }
51 |
52 | public void setName(String name) {
53 | this.name = name;
54 | }
55 |
56 | public String getName() {
57 | return this.name;
58 | }
59 |
60 | public void setAvatar_url(String avatar_url) {
61 | this.avatar_url = avatar_url;
62 | }
63 |
64 | public String getAvatar_url() {
65 | return this.avatar_url;
66 | }
67 |
68 | }
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/user/event/BlockUserEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 00:47:02
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.user.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.bean.State;
29 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
30 |
31 | public class BlockUserEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public BlockUserEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param state 实体数据
43 | */
44 | public BlockUserEvent(@Nullable String uuid, @NonNull Integer code, @Nullable State state) {
45 | super(uuid, code, state);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/user/event/FollowUserEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 00:50:03
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.user.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.bean.State;
29 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
30 |
31 | public class FollowUserEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public FollowUserEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param state 实体数据
43 | */
44 | public FollowUserEvent(@Nullable String uuid, @NonNull Integer code, @Nullable State state) {
45 | super(uuid, code, state);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/user/event/GetMeEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.user.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.user.bean.UserDetail;
30 |
31 | public class GetMeEvent extends BaseEvent {
32 | public GetMeEvent(@Nullable String uuid) {
33 | super(uuid);
34 | }
35 |
36 | public GetMeEvent(@Nullable String uuid, @NonNull Integer code, @Nullable UserDetail userDetail) {
37 | super(uuid, code, userDetail);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/user/event/GetUserBlockedListEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 00:48:02
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.user.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.user.bean.User;
30 |
31 | import java.util.List;
32 |
33 | public class GetUserBlockedListEvent extends BaseEvent> {
34 | /**
35 | * @param uuid 唯一识别码
36 | */
37 | public GetUserBlockedListEvent(@Nullable String uuid) {
38 | super(uuid);
39 | }
40 |
41 | /**
42 | * @param uuid 唯一识别码
43 | * @param code 网络返回码
44 | * @param users 实体数据
45 | */
46 | public GetUserBlockedListEvent(@Nullable String uuid, @NonNull Integer code, @Nullable List users) {
47 | super(uuid, code, users);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/user/event/GetUserCollectionTopicListEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 00:52:08
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.user.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.topic.bean.Topic;
30 |
31 | import java.util.List;
32 |
33 | public class GetUserCollectionTopicListEvent extends BaseEvent> {
34 | public GetUserCollectionTopicListEvent(@Nullable String uuid) {
35 | super(uuid);
36 | }
37 |
38 | public GetUserCollectionTopicListEvent(@Nullable String uuid, @NonNull Integer code, @Nullable List topics) {
39 | super(uuid, code, topics);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/user/event/GetUserCreateTopicListEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.user.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.topic.bean.Topic;
30 |
31 | import java.util.List;
32 |
33 | public class GetUserCreateTopicListEvent extends BaseEvent> {
34 | public GetUserCreateTopicListEvent(@Nullable String uuid) {
35 | super(uuid);
36 | }
37 |
38 | public GetUserCreateTopicListEvent(@Nullable String uuid, @NonNull Integer code, @Nullable List topics) {
39 | super(uuid, code, topics);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/user/event/GetUserEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.user.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.user.bean.UserDetail;
30 |
31 | public class GetUserEvent extends BaseEvent {
32 | public GetUserEvent(@Nullable String uuid) {
33 | super(uuid);
34 | }
35 |
36 | public GetUserEvent(@Nullable String uuid, @NonNull Integer code, @Nullable UserDetail userDetail) {
37 | super(uuid, code, userDetail);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/user/event/GetUserFollowerListEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 00:50:59
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.user.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.user.bean.User;
30 |
31 | import java.util.List;
32 |
33 | public class GetUserFollowerListEvent extends BaseEvent> {
34 | /**
35 | * @param uuid 唯一识别码
36 | */
37 | public GetUserFollowerListEvent(@Nullable String uuid) {
38 | super(uuid);
39 | }
40 |
41 | /**
42 | * @param uuid 唯一识别码
43 | * @param code 网络返回码
44 | * @param users 实体数据
45 | */
46 | public GetUserFollowerListEvent(@Nullable String uuid, @NonNull Integer code, @Nullable List users) {
47 | super(uuid, code, users);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/user/event/GetUserFollowingListEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 00:51:10
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.user.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.user.bean.User;
30 |
31 | import java.util.List;
32 |
33 | public class GetUserFollowingListEvent extends BaseEvent> {
34 | /**
35 | * @param uuid 唯一识别码
36 | */
37 | public GetUserFollowingListEvent(@Nullable String uuid) {
38 | super(uuid);
39 | }
40 |
41 | /**
42 | * @param uuid 唯一识别码
43 | * @param code 网络返回码
44 | * @param users 实体数据
45 | */
46 | public GetUserFollowingListEvent(@Nullable String uuid, @NonNull Integer code, @Nullable List users) {
47 | super(uuid, code, users);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/user/event/GetUserReplyTopicListEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 00:52:35
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.user.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.notifications.bean.Reply;
30 |
31 | import java.util.List;
32 |
33 | public class GetUserReplyTopicListEvent extends BaseEvent> {
34 | public GetUserReplyTopicListEvent(@Nullable String uuid) {
35 | super(uuid);
36 | }
37 |
38 | public GetUserReplyTopicListEvent(@Nullable String uuid, @NonNull Integer code, @Nullable List topics) {
39 | super(uuid, code, topics);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/user/event/GetUsersListEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 00:44:32
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.user.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
29 | import com.gcssloop.diycode_sdk.api.user.bean.User;
30 |
31 | import java.util.List;
32 |
33 | public class GetUsersListEvent extends BaseEvent> {
34 | /**
35 | * @param uuid 唯一识别码
36 | */
37 | public GetUsersListEvent(@Nullable String uuid) {
38 | super(uuid);
39 | }
40 |
41 | /**
42 | * @param uuid 唯一识别码
43 | * @param code 网络返回码
44 | * @param users 实体数据
45 | */
46 | public GetUsersListEvent(@Nullable String uuid, @NonNull Integer code, @Nullable List users) {
47 | super(uuid, code, users);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/user/event/UnBlockUserEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 00:47:26
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.user.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.bean.State;
29 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
30 |
31 | public class UnBlockUserEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public UnBlockUserEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param state 实体数据
43 | */
44 | public UnBlockUserEvent(@Nullable String uuid, @NonNull Integer code, @Nullable State state) {
45 | super(uuid, code, state);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/api/user/event/UnFollowUserEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-09 00:50:26
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.api.user.event;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.support.annotation.Nullable;
27 |
28 | import com.gcssloop.diycode_sdk.api.base.bean.State;
29 | import com.gcssloop.diycode_sdk.api.base.event.BaseEvent;
30 |
31 | public class UnFollowUserEvent extends BaseEvent {
32 | /**
33 | * @param uuid 唯一识别码
34 | */
35 | public UnFollowUserEvent(@Nullable String uuid) {
36 | super(uuid);
37 | }
38 |
39 | /**
40 | * @param uuid 唯一识别码
41 | * @param code 网络返回码
42 | * @param state 实体数据
43 | */
44 | public UnFollowUserEvent(@Nullable String uuid, @NonNull Integer code, @Nullable State state) {
45 | super(uuid, code, state);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/log/Config.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-10 00:33:05
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.log;
24 |
25 | import android.support.annotation.NonNull;
26 |
27 | public class Config {
28 |
29 | public static final int LEVEL_NONE = 0;
30 | public static final int LEVEL_FULL = 1;
31 |
32 | public static final int LEVEL_VERBOSE = 2;
33 | public static final int LEVEL_DEBUG = 3;
34 | public static final int LEVEL_INFO = 4;
35 | public static final int LEVEL_WARN = 5;
36 | public static final int LEVEL_ERROR = 6;
37 | public static final int LEVEL_ASSERT = 7;
38 |
39 | private String tag;
40 | private int level;
41 |
42 | public Config(String tag) {
43 | this.tag = tag;
44 | level = LEVEL_FULL;
45 | }
46 |
47 | public Config setLevel(@NonNull int level){
48 | this.level = level;
49 | return this;
50 | }
51 |
52 | public int getLevel() {
53 | return level;
54 | }
55 |
56 | public String getTag() {
57 | return tag;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/log/Logger.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-10 00:33:05
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.log;
24 |
25 | import android.support.annotation.NonNull;
26 | import android.util.Log;
27 |
28 | public class Logger {
29 |
30 | private static String DEFAULT_TAG = "GCS-LOG";
31 |
32 | private static Config mConfig;
33 |
34 | private Logger() {
35 |
36 | }
37 |
38 | public static Config init() {
39 | mConfig = new Config(DEFAULT_TAG);
40 | return mConfig;
41 | }
42 |
43 | public static Config init(@NonNull String tag) {
44 | mConfig = new Config(tag);
45 | return mConfig;
46 | }
47 |
48 | public static void v(String message) {
49 | log(Config.LEVEL_VERBOSE, mConfig.getTag(), message);
50 | }
51 |
52 | public static void d(String message) {
53 | log(Config.LEVEL_DEBUG, mConfig.getTag(), message);
54 | }
55 |
56 | public static void i(String message) {
57 | log(Config.LEVEL_INFO, mConfig.getTag(), message);
58 | }
59 |
60 | public static void w(String message) {
61 | log(Config.LEVEL_WARN, mConfig.getTag(), message);
62 | }
63 |
64 | public static void e(String message) {
65 | log(Config.LEVEL_ERROR, mConfig.getTag(), message);
66 | }
67 |
68 | public static void v(String tag, String message) {
69 | log(Config.LEVEL_VERBOSE, tag, message);
70 | }
71 |
72 | public static void d(String tag, String message) {
73 | log(Config.LEVEL_DEBUG, tag, message);
74 | }
75 |
76 | public static void i(String tag, String message) {
77 | log(Config.LEVEL_INFO, tag, message);
78 | }
79 |
80 | public static void w(String tag, String message) {
81 | log(Config.LEVEL_WARN, tag, message);
82 | }
83 |
84 | public static void e(String tag, String message) {
85 | log(Config.LEVEL_ERROR, tag, message);
86 | }
87 |
88 | private static void log(int level, String tag, String message) {
89 | if (mConfig.getLevel() == Config.LEVEL_NONE) {
90 | return;
91 | }
92 |
93 | if (level < mConfig.getLevel()) {
94 | return;
95 | }
96 |
97 | switch (level) {
98 | case Config.LEVEL_VERBOSE:
99 | Log.v(tag, message);
100 | break;
101 | case Config.LEVEL_DEBUG:
102 | Log.d(tag, message);
103 | break;
104 | case Config.LEVEL_INFO:
105 | Log.i(tag, message);
106 | break;
107 | case Config.LEVEL_WARN:
108 | Log.w(tag, message);
109 | break;
110 | case Config.LEVEL_ERROR:
111 | Log.e(tag, message);
112 | break;
113 | }
114 |
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/utils/CacheUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.utils;
24 |
25 | import android.content.Context;
26 | import android.support.annotation.NonNull;
27 |
28 | import com.gcssloop.diycode_sdk.api.login.bean.Token;
29 |
30 | /**
31 | * 缓存工具类,用于缓存各类数据
32 | */
33 | public class CacheUtil {
34 |
35 | ACache cache;
36 |
37 | public CacheUtil(Context context) {
38 | cache = ACache.get(context);
39 | }
40 |
41 | //--- token ------------------------------------------------------------------------------------
42 |
43 | public void saveToken(@NonNull Token token){
44 | cache.put("token", token);
45 | }
46 |
47 | public Token getToken(){
48 | return (Token) cache.getAsObject("token");
49 | }
50 |
51 | public void clearToken(){
52 | cache.remove("token");
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/utils/Constant.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.utils;
24 |
25 | public class Constant {
26 | // 网络相关
27 | public static final String BASE_URL = "https://diycode.cc/api/v3/";
28 | public static final String OAUTH_URL = "https://www.diycode.cc/oauth/token";
29 | }
30 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/utils/DebugUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.utils;
24 |
25 | import android.content.Context;
26 | import android.content.pm.ApplicationInfo;
27 | import android.content.pm.PackageInfo;
28 |
29 | public class DebugUtil {
30 |
31 | /**
32 | * 判断当前应用是否是debug状态
33 | */
34 |
35 | public static boolean isInDebug(Context context) {
36 | try {
37 | ApplicationInfo info = context.getApplicationInfo();
38 | return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
39 |
40 | } catch (Exception e) {
41 | return false;
42 | }
43 | }
44 |
45 | /**
46 | * 检测其他应用是否处于debug模式。
47 | */
48 | public static boolean isApkDebugable(Context context, String packageName) {
49 | try {
50 | PackageInfo pkginfo = context.getPackageManager().getPackageInfo(
51 | packageName, 1);
52 | if (pkginfo != null) {
53 | ApplicationInfo info = pkginfo.applicationInfo;
54 | return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
55 | }
56 |
57 | } catch (Exception e) {
58 |
59 | }
60 | return false;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/sdk/src/main/java/com/gcssloop/diycode_sdk/utils/UUIDGenerator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 GcsSloop
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Last modified 2017-03-08 01:01:18
17 | *
18 | * GitHub: https://github.com/GcsSloop
19 | * Website: http://www.gcssloop.com
20 | * Weibo: http://weibo.com/GcsSloop
21 | */
22 |
23 | package com.gcssloop.diycode_sdk.utils;
24 |
25 | import java.util.UUID;
26 |
27 | /**
28 | * UUID 生成器
29 | */
30 | public class UUIDGenerator {
31 | private UUIDGenerator() {
32 | }
33 |
34 | public static String getUUID() {
35 | return UUID.randomUUID().toString();
36 | }
37 |
38 | //获得指定数量的UUID
39 | public static String[] getUUID(int number) {
40 | if (number < 1) {
41 | return null;
42 | }
43 | String[] ss = new String[number];
44 | for (int i = 0; i < number; i++) {
45 | ss[i] = getUUID();
46 | }
47 | return ss;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/sdk/src/main/res/drawable-hdpi/leak_canary_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GcsSloop/diycode-sdk/c57e998a4d45f06dad7eb06cd2bded4c7a1b1947/sdk/src/main/res/drawable-hdpi/leak_canary_icon.png
--------------------------------------------------------------------------------
/sdk/src/main/res/drawable-ldpi/leak_canary_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GcsSloop/diycode-sdk/c57e998a4d45f06dad7eb06cd2bded4c7a1b1947/sdk/src/main/res/drawable-ldpi/leak_canary_icon.png
--------------------------------------------------------------------------------
/sdk/src/main/res/drawable-mdpi/leak_canary_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GcsSloop/diycode-sdk/c57e998a4d45f06dad7eb06cd2bded4c7a1b1947/sdk/src/main/res/drawable-mdpi/leak_canary_icon.png
--------------------------------------------------------------------------------
/sdk/src/main/res/drawable-xhdpi/leak_canary_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GcsSloop/diycode-sdk/c57e998a4d45f06dad7eb06cd2bded4c7a1b1947/sdk/src/main/res/drawable-xhdpi/leak_canary_icon.png
--------------------------------------------------------------------------------
/sdk/src/main/res/drawable-xxhdpi/leak_canary_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GcsSloop/diycode-sdk/c57e998a4d45f06dad7eb06cd2bded4c7a1b1947/sdk/src/main/res/drawable-xxhdpi/leak_canary_icon.png
--------------------------------------------------------------------------------
/sdk/src/main/res/drawable-xxxhdpi/leak_canary_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GcsSloop/diycode-sdk/c57e998a4d45f06dad7eb06cd2bded4c7a1b1947/sdk/src/main/res/drawable-xxxhdpi/leak_canary_icon.png
--------------------------------------------------------------------------------
/sdk/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
22 |
23 |
24 | diycode-sdk
25 | DiycodeLeaks
26 |
27 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':sdk'
2 |
--------------------------------------------------------------------------------