Skip to content

Commit 66912b4

Browse files
committed
Merge branch 'release/0.14'
2 parents a41c585 + 330aa3c commit 66912b4

File tree

73 files changed

+1405
-675
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1405
-675
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
### General options ###
33
javaVersion=1.8
44
gradleVersion=3.2.1
5-
pluginVersion=0.13
5+
pluginVersion=0.14
66
# if set the 'idePath' then the version ignoring
77
# if 'sandboxDir' not set then use default sandbox directory (build/${product}-sandbox)
88
# if 'ideVersion' not set then use LATEST-EAP-SNAPSHOT

stepik-java-api/src/main/java/org/stepik/api/Utils.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import java.util.ArrayList;
1818
import java.util.Arrays;
1919
import java.util.List;
20+
import java.util.Objects;
2021
import java.util.Optional;
2122
import java.util.function.Function;
2223
import java.util.stream.Collectors;
@@ -33,6 +34,7 @@ public class Utils {
3334
public static String mapToGetString(@NotNull String name, @NotNull String[] values) {
3435
String encodedName = encode(name);
3536
return Arrays.stream(values)
37+
.filter(Objects::nonNull)
3638
.map(value -> encodedName + "=" + encode(value))
3739
.collect(Collectors.joining("&"));
3840
}

stepik-java-api/src/main/java/org/stepik/api/actions/StepikRecommendationReactionsAction.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import org.jetbrains.annotations.NotNull;
44
import org.stepik.api.client.StepikApiClient;
5+
import org.stepik.api.queries.recommendations.StepikReactionsPostQuery;
56

67
/**
78
* @author meanmail
@@ -10,4 +11,10 @@ public class StepikRecommendationReactionsAction extends StepikAbstractAction {
1011
public StepikRecommendationReactionsAction(@NotNull StepikApiClient stepikApiClient) {
1112
super(stepikApiClient);
1213
}
14+
15+
@NotNull
16+
public StepikReactionsPostQuery post() {
17+
return new StepikReactionsPostQuery(this);
18+
}
19+
1320
}

stepik-java-api/src/main/java/org/stepik/api/actions/StepikRecommendationsAction.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import org.jetbrains.annotations.NotNull;
44
import org.stepik.api.client.StepikApiClient;
5+
import org.stepik.api.queries.recommendations.StepikRecommendationsGetQuery;
56

67
/**
78
* @author meanmail
@@ -10,4 +11,9 @@ public class StepikRecommendationsAction extends StepikAbstractAction {
1011
public StepikRecommendationsAction(@NotNull StepikApiClient stepikApiClient) {
1112
super(stepikApiClient);
1213
}
14+
15+
@NotNull
16+
public StepikRecommendationsGetQuery get() {
17+
return new StepikRecommendationsGetQuery(this);
18+
}
1319
}

stepik-java-api/src/main/java/org/stepik/api/objects/courses/Course.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,8 +721,11 @@ public void setCreateDate(@Nullable String createDate) {
721721
this.createDate = createDate;
722722
}
723723

724-
@Nullable
724+
@NotNull
725725
public String getUpdateDate() {
726+
if (updateDate == null) {
727+
updateDate = "";
728+
}
726729
return updateDate;
727730
}
728731

stepik-java-api/src/main/java/org/stepik/api/objects/lessons/CompoundUnitLesson.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,9 @@ public int getPosition() {
8585
public String getProgress() {
8686
return getLesson().getProgress();
8787
}
88+
89+
@NotNull
90+
public String getUpdateDate() {
91+
return lesson.getUpdateDate();
92+
}
8893
}

stepik-java-api/src/main/java/org/stepik/api/objects/lessons/Lesson.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,11 @@ public void setCreateDate(@Nullable String createDate) {
385385
this.createDate = createDate;
386386
}
387387

388-
@Nullable
388+
@NotNull
389389
public String getUpdateDate() {
390+
if (updateDate == null) {
391+
updateDate = "";
392+
}
390393
return updateDate;
391394
}
392395

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package org.stepik.api.objects.recommendations;
2+
3+
import org.jetbrains.annotations.NotNull;
4+
import org.jetbrains.annotations.Nullable;
5+
6+
/**
7+
* @author meanmail
8+
*/
9+
public class Reaction {
10+
private int reaction;
11+
private long lesson;
12+
private long user;
13+
private String time;
14+
15+
public int getReaction() {
16+
return reaction;
17+
}
18+
19+
public void setReaction(int reaction) {
20+
this.reaction = reaction;
21+
}
22+
23+
public long getLesson() {
24+
return lesson;
25+
}
26+
27+
public void setLesson(long lesson) {
28+
this.lesson = lesson;
29+
}
30+
31+
public long getUser() {
32+
return user;
33+
}
34+
35+
public void setUser(long user) {
36+
this.user = user;
37+
}
38+
39+
@NotNull
40+
public String getTime() {
41+
if (time == null) {
42+
time = "";
43+
}
44+
return time;
45+
}
46+
47+
public void setTime(@Nullable String time) {
48+
this.time = time;
49+
}
50+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package org.stepik.api.objects.recommendations;
2+
3+
/**
4+
* @author meanmail
5+
*/
6+
public class ReactionPost {
7+
private int reaction;
8+
private String lesson;
9+
private String user;
10+
11+
public int getReaction() {
12+
return reaction;
13+
}
14+
15+
public void setReaction(int reaction) {
16+
this.reaction = reaction;
17+
}
18+
19+
public long getLesson() {
20+
if (lesson == null) {
21+
lesson = "0";
22+
}
23+
try {
24+
return Long.valueOf(lesson);
25+
} catch (NumberFormatException e) {
26+
return 0;
27+
}
28+
}
29+
30+
public void setLesson(long lesson) {
31+
this.lesson = String.valueOf(lesson);
32+
}
33+
34+
public long getUser() {
35+
if (user == null) {
36+
user = "0";
37+
}
38+
try {
39+
return Long.valueOf(user);
40+
} catch (NumberFormatException e) {
41+
return 0;
42+
}
43+
}
44+
45+
public void setUser(long user) {
46+
this.user = String.valueOf(user);
47+
}
48+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package org.stepik.api.objects.recommendations;
2+
3+
/**
4+
* @author meanmail
5+
*/
6+
public enum ReactionValues {
7+
TOO_EASY(-1), TOO_HARD(0), INTERESTING(1), SOLVED(2);
8+
9+
private final int value;
10+
11+
ReactionValues(int value) {
12+
this.value = value;
13+
}
14+
15+
public int getValue() {
16+
return value;
17+
}
18+
}

0 commit comments

Comments
 (0)