-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Get Recent Messages and Lock Section
- Loading branch information
1 parent
02b650e
commit 2e2b689
Showing
10 changed files
with
235 additions
and
67 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package kenichia.quipapi; | ||
|
||
import java.util.stream.Stream; | ||
|
||
import com.google.gson.JsonObject; | ||
|
||
public class QuipDiff extends QuipJsonObject { | ||
|
||
// ============================================ | ||
// Enum | ||
// ============================================ | ||
|
||
public enum DiffClass { | ||
TRACK_CHANGES("track_changes"), | ||
DELETE_ONLY("delete_only"), | ||
INSERT_ONLY("insert_only"), | ||
INSERT_COMPLETELY("insert_completely"); | ||
|
||
private final String _value; | ||
|
||
private DiffClass(String value) { | ||
_value = value; | ||
} | ||
|
||
private static DiffClass find(String value) { | ||
return Stream.of(values()).filter(e -> e._value.equals(value)).findFirst().orElse(null); | ||
} | ||
} | ||
|
||
// ============================================ | ||
// Constructor | ||
// ============================================ | ||
|
||
protected QuipDiff(JsonObject json) { | ||
super(json); | ||
} | ||
|
||
// ============================================ | ||
// Properties | ||
// ============================================ | ||
|
||
public String getRtml() { | ||
return _getString("rtml"); | ||
} | ||
|
||
public String getList() { | ||
return _getString("list"); | ||
} | ||
|
||
public DiffClass getDiffClass() { | ||
return DiffClass.find(_getString("diff_class")); | ||
} | ||
|
||
public String getSectionId() { | ||
return _getString("section_id"); | ||
} | ||
|
||
public String getStyle() { | ||
return _getString("style"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package kenichia.quipapi; | ||
|
||
import java.util.stream.StreamSupport; | ||
|
||
import com.google.gson.JsonArray; | ||
import com.google.gson.JsonObject; | ||
|
||
public class QuipDiffGroup extends QuipJsonObject { | ||
|
||
// ============================================ | ||
// Constructor | ||
// ============================================ | ||
|
||
protected QuipDiffGroup(JsonObject json) { | ||
super(json); | ||
} | ||
|
||
// ============================================ | ||
// Properties | ||
// ============================================ | ||
|
||
public QuipDiff[] getDiffs() { | ||
JsonArray arr = _getJsonArray("diffs"); | ||
if (arr == null) | ||
return null; | ||
QuipDiff[] diffs = StreamSupport.stream(arr.spliterator(), false) | ||
.map(obj -> new QuipDiff(obj.getAsJsonObject())) | ||
.toArray(QuipDiff[]::new); | ||
return diffs; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.