Skip to content

Commit 4151ccd

Browse files
committed
Merge branch 'release/0.15'
2 parents 66912b4 + dfc79f8 commit 4151ccd

File tree

120 files changed

+2487
-1015
lines changed

Some content is hidden

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

120 files changed

+2487
-1015
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.14
5+
pluginVersion=0.15
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public static List<String> getStringList(@NotNull JsonObject object, @NotNull St
6969
}
7070

7171
@Nullable
72-
private static <T> List<T> getList(
72+
public static <T> List<T> getList(
7373
@NotNull JsonObject object,
7474
@NotNull String fieldName,
7575
@NotNull Function<JsonElement, T> getter) {

stepik-java-api/src/main/java/org/stepik/api/actions/StepikInstructionsAction.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.instructions.StepikInstructionsGetQuery;
56

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

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

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

33
import org.jetbrains.annotations.NotNull;
44
import org.stepik.api.client.StepikApiClient;
5+
import org.stepik.api.objects.ObjectsContainer;
6+
import org.stepik.api.queries.reviews.StepikReviewSessionsPostQuery;
57

68
/**
79
* @author meanmail
@@ -10,4 +12,9 @@ public class StepikReviewSessionsAction extends StepikAbstractAction {
1012
public StepikReviewSessionsAction(@NotNull StepikApiClient stepikApiClient) {
1113
super(stepikApiClient);
1214
}
15+
16+
@NotNull
17+
public <R extends ObjectsContainer> StepikReviewSessionsPostQuery post() {
18+
return new StepikReviewSessionsPostQuery(this);
19+
}
1320
}

stepik-java-api/src/main/java/org/stepik/api/actions/StepikStepiksAction.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.objects.users.User;
56
import org.stepik.api.queries.stepiks.StepikStepiksGetQuery;
67

78
/**
@@ -16,4 +17,10 @@ public StepikStepiksAction(@NotNull StepikApiClient stepikApiClient) {
1617
public StepikStepiksGetQuery get() {
1718
return new StepikStepiksGetQuery(this);
1819
}
20+
21+
public User getCurrentUser() {
22+
return this.get()
23+
.id(1)
24+
.execute().getUser();
25+
}
1926
}

stepik-java-api/src/main/java/org/stepik/api/objects/ObjectsContainer.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,12 @@ public Meta getMeta() {
3232

3333
@NotNull
3434
public abstract Class<T> getItemClass();
35+
36+
public T get(int index) {
37+
return getItems().get(index);
38+
}
39+
40+
public T getFirst() {
41+
return getItems().get(0);
42+
}
3543
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
package org.stepik.api.objects.instructions;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import org.jetbrains.annotations.NotNull;
5+
import org.jetbrains.annotations.Nullable;
6+
import org.stepik.api.objects.AbstractObject;
7+
8+
import java.util.ArrayList;
9+
import java.util.List;
10+
11+
/**
12+
* @author meanmail
13+
*/
14+
public class Instruction extends AbstractObject {
15+
private long step;
16+
@SerializedName("min_reviews")
17+
private int minReviews;
18+
@SerializedName("strategy_type")
19+
private String strategyType;
20+
private List<Integer> rubrics;
21+
@SerializedName("is_frozen")
22+
private boolean isFrozen;
23+
private String text;
24+
25+
public long getStep() {
26+
return step;
27+
}
28+
29+
public void setStep(long step) {
30+
this.step = step;
31+
}
32+
33+
public int getMinReviews() {
34+
return minReviews;
35+
}
36+
37+
public void setMinReviews(int minReviews) {
38+
this.minReviews = minReviews;
39+
}
40+
41+
@NotNull
42+
public String getStrategyType() {
43+
if (strategyType == null) {
44+
strategyType = "";
45+
}
46+
return strategyType;
47+
}
48+
49+
public void setStrategyType(@Nullable String strategyType) {
50+
this.strategyType = strategyType;
51+
}
52+
53+
@NotNull
54+
public List<Integer> getRubrics() {
55+
if (rubrics == null) {
56+
rubrics = new ArrayList<>();
57+
}
58+
return rubrics;
59+
}
60+
61+
public void setRubrics(@Nullable List<Integer> rubrics) {
62+
this.rubrics = rubrics;
63+
}
64+
65+
public boolean isFrozen() {
66+
return isFrozen;
67+
}
68+
69+
public void setFrozen(boolean frozen) {
70+
this.isFrozen = frozen;
71+
}
72+
73+
@NotNull
74+
public String getText() {
75+
if (text == null) {
76+
text = "";
77+
}
78+
return text;
79+
}
80+
81+
public void setText(@Nullable String text) {
82+
this.text = text;
83+
}
84+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package org.stepik.api.objects.instructions;
2+
3+
import org.jetbrains.annotations.NotNull;
4+
import org.stepik.api.objects.ObjectsContainer;
5+
6+
import java.util.ArrayList;
7+
import java.util.List;
8+
9+
/**
10+
* @author meanmail
11+
*/
12+
public class Instructions extends ObjectsContainer<Instruction> {
13+
private List<Instruction> instructions;
14+
private List<Rubric> rubrics;
15+
16+
public List<Instruction> getInstructions() {
17+
if (instructions == null) {
18+
instructions = new ArrayList<>();
19+
}
20+
return instructions;
21+
}
22+
23+
public List<Rubric> getRubrics() {
24+
if (rubrics == null) {
25+
rubrics = new ArrayList<>();
26+
}
27+
return rubrics;
28+
}
29+
30+
@NotNull
31+
@Override
32+
public List<Instruction> getItems() {
33+
return getInstructions();
34+
}
35+
36+
@NotNull
37+
@Override
38+
public Class<Instruction> getItemClass() {
39+
return Instruction.class;
40+
}
41+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package org.stepik.api.objects.instructions;
2+
3+
import org.jetbrains.annotations.NotNull;
4+
import org.jetbrains.annotations.Nullable;
5+
import org.stepik.api.objects.AbstractObject;
6+
7+
/**
8+
* @author meanmail
9+
*/
10+
public class Rubric extends AbstractObject {
11+
private int instruction;
12+
private String text;
13+
private int cost;
14+
private int position;
15+
16+
public int getInstruction() {
17+
return instruction;
18+
}
19+
20+
public void setInstruction(int instruction) {
21+
this.instruction = instruction;
22+
}
23+
24+
@NotNull
25+
public String getText() {
26+
if (text == null) {
27+
text = "";
28+
}
29+
return text;
30+
}
31+
32+
public void setText(@Nullable String text) {
33+
this.text = text;
34+
}
35+
36+
public int getCost() {
37+
return cost;
38+
}
39+
40+
public void setCost(int cost) {
41+
this.cost = cost;
42+
}
43+
44+
public int getPosition() {
45+
return position;
46+
}
47+
48+
public void setPosition(int position) {
49+
this.position = position;
50+
}
51+
52+
}

stepik-java-api/src/main/java/org/stepik/api/objects/metrics/Metric.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212
public class Metric {
1313
private String name;
14-
private Integer timestamp;
14+
private Long timestamp;
1515
private Map<String, String> tags;
1616
private Map<String, Object> data;
1717

@@ -57,11 +57,11 @@ public void setName(@Nullable String name) {
5757
}
5858

5959
@Nullable
60-
public Integer getTimestamp() {
60+
public Long getTimestamp() {
6161
return timestamp;
6262
}
6363

64-
public void setTimestamp(@Nullable Integer timestamp) {
64+
public void setTimestamp(@Nullable Long timestamp) {
6565
this.timestamp = timestamp;
6666
}
6767
}

0 commit comments

Comments
 (0)