> 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/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/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/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/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 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/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/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/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/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/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/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/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/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/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/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/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 |
--------------------------------------------------------------------------------