commit 289ab08272ad2497e4c6661d05ab7f3d7164eaf0 Author: cobi Date: Wed Mar 19 02:04:18 2025 -0400 Initial commit. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f83e8cf --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.idea +target +*.iml diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..fa27fe5 --- /dev/null +++ b/pom.xml @@ -0,0 +1,74 @@ + + + 4.0.0 + + name.amethyst + amethyst-wiki-bot + 0.0.1-SNAPSHOT + jar + + Amethyst Wiki Bot + https://amethyst.name + + + + central + Maven Central + https://repo1.maven.org/maven2/ + + + + + + javax.validation + validation-api + 2.0.1.Final + + + com.fasterxml.jackson.core + jackson-annotations + 2.18.0 + + + org.apache.httpcomponents.client5 + httpclient5 + 5.4.2 + + + ch.qos.logback + logback-classic + 1.5.11 + + + org.glassfish.jersey.core + jersey-client + 4.0.0-M1 + + + org.glassfish.jersey.media + jersey-media-json-jackson + 4.0.0-M1 + + + org.testng + testng + 7.10.2 + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 4.0.0-beta-1 + + 21 + 21 + + + + + \ No newline at end of file diff --git a/src/main/java/name/amethyst/wikibot/restapi/MediaWikiRestApi.java b/src/main/java/name/amethyst/wikibot/restapi/MediaWikiRestApi.java new file mode 100644 index 0000000..8c92f02 --- /dev/null +++ b/src/main/java/name/amethyst/wikibot/restapi/MediaWikiRestApi.java @@ -0,0 +1,5 @@ +package name.amethyst.wikibot.restapi; + +public class MediaWikiRestApi { + +} diff --git a/src/main/java/name/amethyst/wikibot/restapi/dto/ContentModel.java b/src/main/java/name/amethyst/wikibot/restapi/dto/ContentModel.java new file mode 100644 index 0000000..1dd0598 --- /dev/null +++ b/src/main/java/name/amethyst/wikibot/restapi/dto/ContentModel.java @@ -0,0 +1,66 @@ +package name.amethyst.wikibot.restapi.dto; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import jakarta.ws.rs.core.MediaType; + +import java.util.EnumSet; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +public enum ContentModel { + CSS("css", new MediaType("text", "css")), + JAVASCRIPT("javascript", new MediaType("text", "javascript")), + JSON("json", MediaType.APPLICATION_JSON_TYPE), + TEXT("text", MediaType.TEXT_PLAIN_TYPE), + WIKITEXT("wikitext", new MediaType("text", "x-wiki")), + CAMPAIGN("Campaign", MediaType.APPLICATION_JSON_TYPE), + ENTITY_SCHEMA("EntitySchema", MediaType.APPLICATION_JSON_TYPE), + FLOW_BOARD("flow-board", MediaType.APPLICATION_JSON_TYPE), + GEO_JSON("GeoJson", MediaType.APPLICATION_JSON_TYPE), + JSON_BOOK("JsonBook", MediaType.APPLICATION_JSON_TYPE), + JSON_CONFIG("JsonConfig", new MediaType("application", "json+pretty")), + JSON_SCHEMA("JsonSchema", MediaType.APPLICATION_JSON_TYPE), + MASS_MESSAGE_LIST_CONTENT("MassMessageListContent", MediaType.WILDCARD_TYPE), + WIKIBASE_MEDIAINFO("wikibase-mediainfo", MediaType.APPLICATION_JSON_TYPE), + PROOFREAD_INDEX("proofread-index", new MediaType("text", "x-wiki")), + PROOFREAD_PAGE("proofread-page", new MediaType("text", "x-wiki")), + SANITIZED_CSS("sanitized-css", new MediaType("text", "css")), + SCRIBUNTU("Scribuntu", MediaType.TEXT_PLAIN_TYPE), + SECURE_POLL("SecurePoll", MediaType.APPLICATION_JSON_TYPE), + SEMANTIC_MEDIA_WIKI("smw/schema", MediaType.APPLICATION_JSON_TYPE), + SYNTAX_HIGHLIGHT("syntaxhighlight", MediaType.WILDCARD_TYPE), + TEI("tei", new MediaType("application", "tei+xml")), + WIKIBASE_ITEM("wikibase-item", MediaType.APPLICATION_JSON_TYPE), + WIKIBASE_LEXEME("wikibase-lexeme", MediaType.APPLICATION_JSON_TYPE), + WIKIBASE_PROPERTY("wikibase-property", MediaType.APPLICATION_JSON_TYPE), + ; + + private static final Map BY_STRING_VALUE = EnumSet + .allOf(ContentModel.class) + .stream() + .collect(Collectors.toMap(ContentModel::toString, Function.identity())); + + @JsonCreator + public static ContentModel fromString(final String value) { + return BY_STRING_VALUE.get(value); + } + + private final String stringValue; + private final MediaType mediaType; + + ContentModel(final String stringValue, final MediaType mediaType) { + this.stringValue = stringValue; + this.mediaType = mediaType; + } + + @JsonValue + public String getStringValue() { + return stringValue; + } + + public MediaType getMediaType() { + return mediaType; + } +} diff --git a/src/main/java/name/amethyst/wikibot/restapi/dto/CreatePageRequest.java b/src/main/java/name/amethyst/wikibot/restapi/dto/CreatePageRequest.java new file mode 100644 index 0000000..f51f6d0 --- /dev/null +++ b/src/main/java/name/amethyst/wikibot/restapi/dto/CreatePageRequest.java @@ -0,0 +1,63 @@ +package name.amethyst.wikibot.restapi.dto; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Optional; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class CreatePageRequest { + @JsonProperty + private String source; + @JsonProperty + private String title; + @JsonProperty + private String comment; + @JsonProperty("content_model") + private Optional contentModel; + @JsonProperty + private Optional token; + + public CreatePageRequest() { + } + + public String getSource() { + return source; + } + + public void setSource(final String source) { + this.source = source; + } + + public String getTitle() { + return title; + } + + public void setTitle(final String title) { + this.title = title; + } + + public String getComment() { + return comment; + } + + public void setComment(final String comment) { + this.comment = comment; + } + + public Optional getContentModel() { + return contentModel; + } + + public void setContentModel(final Optional contentModel) { + this.contentModel = contentModel; + } + + public Optional getToken() { + return token; + } + + public void setToken(final Optional token) { + this.token = token; + } +} diff --git a/src/main/java/name/amethyst/wikibot/restapi/dto/File.java b/src/main/java/name/amethyst/wikibot/restapi/dto/File.java new file mode 100644 index 0000000..2514262 --- /dev/null +++ b/src/main/java/name/amethyst/wikibot/restapi/dto/File.java @@ -0,0 +1,17 @@ +package name.amethyst.wikibot.restapi.dto; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.net.URI; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class File { + @JsonProperty + private String title; + @JsonProperty("file_description_url") + private URI fileDescriptionUrl; + private FileRevisionRef latest; + private FileThumbnail preferred; + private FileThumbnail original; +} diff --git a/src/main/java/name/amethyst/wikibot/restapi/dto/FileMediaType.java b/src/main/java/name/amethyst/wikibot/restapi/dto/FileMediaType.java new file mode 100644 index 0000000..05b4b21 --- /dev/null +++ b/src/main/java/name/amethyst/wikibot/restapi/dto/FileMediaType.java @@ -0,0 +1,38 @@ +package name.amethyst.wikibot.restapi.dto; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +import java.util.EnumSet; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +public enum FileMediaType { + BITMAP, DRAWING, AUDIO, VIDEO, MULTIMEDIA, UNKNOWN, OFFICE, TEXT, EXECUTABLE, ARCHIVE, THREE_D("3D"); + + private static final Map BY_STRING_VALUE = EnumSet + .allOf(FileMediaType.class) + .stream() + .collect(Collectors.toMap(FileMediaType::toString, Function.identity())); + + @JsonCreator + public static FileMediaType fromString(final String value) { + return BY_STRING_VALUE.get(value); + } + + private final String stringValue; + + FileMediaType() { + this.stringValue = name(); + } + + FileMediaType(final String stringValue) { + this.stringValue = stringValue; + } + + @JsonValue + public String getStringValue() { + return stringValue; + } +} diff --git a/src/main/java/name/amethyst/wikibot/restapi/dto/FileRevisionRef.java b/src/main/java/name/amethyst/wikibot/restapi/dto/FileRevisionRef.java new file mode 100644 index 0000000..bb54574 --- /dev/null +++ b/src/main/java/name/amethyst/wikibot/restapi/dto/FileRevisionRef.java @@ -0,0 +1,45 @@ +package name.amethyst.wikibot.restapi.dto; + +import com.fasterxml.jackson.annotation.JsonGetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; + +import java.time.Instant; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class FileRevisionRef { + @JsonProperty + private Instant timestamp; + @JsonProperty + private UserRef user; + + public FileRevisionRef() { + } + + public Instant getTimestamp() { + return timestamp; + } + + public void setTimestamp(final Instant timestamp) { + this.timestamp = timestamp; + } + + @JsonGetter("timestamp") + public String getTimestampJson() { + return timestamp.toString(); + } + + @JsonSetter("timestamp") + public void setTimestampJson(final String stringValue) { + this.timestamp = Instant.parse(stringValue); + } + + public UserRef getUser() { + return user; + } + + public void setUser(final UserRef user) { + this.user = user; + } +} diff --git a/src/main/java/name/amethyst/wikibot/restapi/dto/FileThumbnail.java b/src/main/java/name/amethyst/wikibot/restapi/dto/FileThumbnail.java new file mode 100644 index 0000000..dc005e6 --- /dev/null +++ b/src/main/java/name/amethyst/wikibot/restapi/dto/FileThumbnail.java @@ -0,0 +1,74 @@ +package name.amethyst.wikibot.restapi.dto; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.net.URI; +import java.util.Optional; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class FileThumbnail { + @JsonProperty("mediatype") + private FileMediaType mediaType; + @JsonProperty + private Optional size; + @JsonProperty + private Optional width; + @JsonProperty + private Optional height; + @JsonProperty + private Optional duration; + @JsonProperty + private URI url; + + public FileThumbnail() { + } + + public FileMediaType getMediaType() { + return mediaType; + } + + public void setMediaType(final FileMediaType mediaType) { + this.mediaType = mediaType; + } + + public Optional getSize() { + return size; + } + + public void setSize(final Optional size) { + this.size = size; + } + + public Optional getWidth() { + return width; + } + + public void setWidth(final Optional width) { + this.width = width; + } + + public Optional getHeight() { + return height; + } + + public void setHeight(final Optional height) { + this.height = height; + } + + public Optional getDuration() { + return duration; + } + + public void setDuration(final Optional duration) { + this.duration = duration; + } + + public URI getUrl() { + return url; + } + + public void setUrl(final URI url) { + this.url = url; + } +} diff --git a/src/main/java/name/amethyst/wikibot/restapi/dto/GetFile.java b/src/main/java/name/amethyst/wikibot/restapi/dto/GetFile.java new file mode 100644 index 0000000..905eb18 --- /dev/null +++ b/src/main/java/name/amethyst/wikibot/restapi/dto/GetFile.java @@ -0,0 +1,21 @@ +package name.amethyst.wikibot.restapi.dto; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class GetFile extends File { + @JsonProperty + private FileThumbnail thumbnail; + + public GetFile() { + } + + public FileThumbnail getThumbnail() { + return thumbnail; + } + + public void setThumbnail(final FileThumbnail thumbnail) { + this.thumbnail = thumbnail; + } +} diff --git a/src/main/java/name/amethyst/wikibot/restapi/dto/GetPage.java b/src/main/java/name/amethyst/wikibot/restapi/dto/GetPage.java new file mode 100644 index 0000000..bd39bd5 --- /dev/null +++ b/src/main/java/name/amethyst/wikibot/restapi/dto/GetPage.java @@ -0,0 +1,23 @@ +package name.amethyst.wikibot.restapi.dto; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.net.URL; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class GetPage extends Page { + @JsonProperty("html_url") + private URL htmlUrl; + + public GetPage() { + } + + public URL getHtmlUrl() { + return htmlUrl; + } + + public void setHtmlUrl(final URL htmlUrl) { + this.htmlUrl = htmlUrl; + } +} diff --git a/src/main/java/name/amethyst/wikibot/restapi/dto/GetPageOffline.java b/src/main/java/name/amethyst/wikibot/restapi/dto/GetPageOffline.java new file mode 100644 index 0000000..49a2f55 --- /dev/null +++ b/src/main/java/name/amethyst/wikibot/restapi/dto/GetPageOffline.java @@ -0,0 +1,21 @@ +package name.amethyst.wikibot.restapi.dto; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class GetPageOffline extends Page { + @JsonProperty + private String html; + + public GetPageOffline() { + } + + public String getHtml() { + return html; + } + + public void setHtml(final String html) { + this.html = html; + } +} diff --git a/src/main/java/name/amethyst/wikibot/restapi/dto/License.java b/src/main/java/name/amethyst/wikibot/restapi/dto/License.java new file mode 100644 index 0000000..3386690 --- /dev/null +++ b/src/main/java/name/amethyst/wikibot/restapi/dto/License.java @@ -0,0 +1,33 @@ +package name.amethyst.wikibot.restapi.dto; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.net.URI; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class License { + @JsonProperty + private URI url; + @JsonProperty + private String title; + + public License() { + } + + public URI getUrl() { + return url; + } + + public void setUrl(final URI url) { + this.url = url; + } + + public String getTitle() { + return title; + } + + public void setTitle(final String title) { + this.title = title; + } +} diff --git a/src/main/java/name/amethyst/wikibot/restapi/dto/Page.java b/src/main/java/name/amethyst/wikibot/restapi/dto/Page.java new file mode 100644 index 0000000..5b4cddb --- /dev/null +++ b/src/main/java/name/amethyst/wikibot/restapi/dto/Page.java @@ -0,0 +1,71 @@ +package name.amethyst.wikibot.restapi.dto; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class Page { + @JsonProperty + private long id; + @JsonProperty + private String key; + @JsonProperty + private String title; + @JsonProperty + private RevisionRef latest; + @JsonProperty + private ContentModel contentModel; + @JsonProperty + private License license; + + public Page() { + } + + public long getId() { + return id; + } + + public void setId(final long id) { + this.id = id; + } + + public String getKey() { + return key; + } + + public void setKey(final String key) { + this.key = key; + } + + public String getTitle() { + return title; + } + + public void setTitle(final String title) { + this.title = title; + } + + public RevisionRef getLatest() { + return latest; + } + + public void setLatest(final RevisionRef latest) { + this.latest = latest; + } + + public ContentModel getContentModel() { + return contentModel; + } + + public void setContentModel(final ContentModel contentModel) { + this.contentModel = contentModel; + } + + public License getLicense() { + return license; + } + + public void setLicense(final License license) { + this.license = license; + } +} diff --git a/src/main/java/name/amethyst/wikibot/restapi/dto/PageLanguage.java b/src/main/java/name/amethyst/wikibot/restapi/dto/PageLanguage.java new file mode 100644 index 0000000..e87ba89 --- /dev/null +++ b/src/main/java/name/amethyst/wikibot/restapi/dto/PageLanguage.java @@ -0,0 +1,51 @@ +package name.amethyst.wikibot.restapi.dto; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class PageLanguage { + @JsonProperty + private String code; + @JsonProperty + private String name; + @JsonProperty + private String key; + @JsonProperty + private String title; + + public PageLanguage() { + } + + public String getCode() { + return code; + } + + public void setCode(final String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + public String getKey() { + return key; + } + + public void setKey(final String key) { + this.key = key; + } + + public String getTitle() { + return title; + } + + public void setTitle(final String title) { + this.title = title; + } +} diff --git a/src/main/java/name/amethyst/wikibot/restapi/dto/PageWithSource.java b/src/main/java/name/amethyst/wikibot/restapi/dto/PageWithSource.java new file mode 100644 index 0000000..816088c --- /dev/null +++ b/src/main/java/name/amethyst/wikibot/restapi/dto/PageWithSource.java @@ -0,0 +1,21 @@ +package name.amethyst.wikibot.restapi.dto; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class PageWithSource extends Page { + @JsonProperty + private String source; + + public PageWithSource() { + } + + public String getSource() { + return source; + } + + public void setSource(final String source) { + this.source = source; + } +} diff --git a/src/main/java/name/amethyst/wikibot/restapi/dto/RevisionRef.java b/src/main/java/name/amethyst/wikibot/restapi/dto/RevisionRef.java new file mode 100644 index 0000000..830f001 --- /dev/null +++ b/src/main/java/name/amethyst/wikibot/restapi/dto/RevisionRef.java @@ -0,0 +1,45 @@ +package name.amethyst.wikibot.restapi.dto; + +import com.fasterxml.jackson.annotation.JsonGetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; + +import java.time.Instant; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class RevisionRef { + @JsonProperty + private long id; + @JsonProperty + private Instant timestamp; + + public RevisionRef() { + } + + public long getId() { + return id; + } + + public void setId(final long id) { + this.id = id; + } + + public Instant getTimestamp() { + return timestamp; + } + + public void setTimestamp(final Instant timestamp) { + this.timestamp = timestamp; + } + + @JsonGetter("timestamp") + public String getTimestampJson() { + return timestamp.toString(); + } + + @JsonSetter("timestamp") + public void setTimestampJson(final String stringValue) { + this.timestamp = Instant.parse(stringValue); + } +} diff --git a/src/main/java/name/amethyst/wikibot/restapi/dto/SearchResponse.java b/src/main/java/name/amethyst/wikibot/restapi/dto/SearchResponse.java new file mode 100644 index 0000000..39ffb29 --- /dev/null +++ b/src/main/java/name/amethyst/wikibot/restapi/dto/SearchResponse.java @@ -0,0 +1,23 @@ +package name.amethyst.wikibot.restapi.dto; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class SearchResponse { + @JsonProperty + private List pages; + + public SearchResponse() { + } + + public List getPages() { + return pages; + } + + public void setPages(final List pages) { + this.pages = pages; + } +} diff --git a/src/main/java/name/amethyst/wikibot/restapi/dto/SearchResult.java b/src/main/java/name/amethyst/wikibot/restapi/dto/SearchResult.java new file mode 100644 index 0000000..757ce02 --- /dev/null +++ b/src/main/java/name/amethyst/wikibot/restapi/dto/SearchResult.java @@ -0,0 +1,83 @@ +package name.amethyst.wikibot.restapi.dto; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Optional; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class SearchResult { + @JsonProperty + private long id; + @JsonProperty + private String key; + @JsonProperty + private String title; + @JsonProperty + private String excerpt; + @JsonProperty("matched_title") + private Optional matchedTitle; + @JsonProperty + private String description; + @JsonProperty + private Optional thumbnail; + + public SearchResult() { + } + + public long getId() { + return id; + } + + public void setId(final long id) { + this.id = id; + } + + public String getKey() { + return key; + } + + public void setKey(final String key) { + this.key = key; + } + + public String getTitle() { + return title; + } + + public void setTitle(final String title) { + this.title = title; + } + + public String getExcerpt() { + return excerpt; + } + + public void setExcerpt(final String excerpt) { + this.excerpt = excerpt; + } + + public Optional getMatchedTitle() { + return matchedTitle; + } + + public void setMatchedTitle(final Optional matchedTitle) { + this.matchedTitle = matchedTitle; + } + + public String getDescription() { + return description; + } + + public void setDescription(final String description) { + this.description = description; + } + + public Optional getThumbnail() { + return thumbnail; + } + + public void setThumbnail(final Optional thumbnail) { + this.thumbnail = thumbnail; + } +} diff --git a/src/main/java/name/amethyst/wikibot/restapi/dto/SearchThumbnail.java b/src/main/java/name/amethyst/wikibot/restapi/dto/SearchThumbnail.java new file mode 100644 index 0000000..8c5193d --- /dev/null +++ b/src/main/java/name/amethyst/wikibot/restapi/dto/SearchThumbnail.java @@ -0,0 +1,75 @@ +package name.amethyst.wikibot.restapi.dto; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.ws.rs.core.MediaType; + +import java.net.URI; +import java.util.Optional; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class SearchThumbnail { + @JsonProperty("mimetype") + private MediaType mimeType; + @JsonProperty + private Optional size; + @JsonProperty + private Optional width; + @JsonProperty + private Optional height; + @JsonProperty + private Optional duration; + @JsonProperty + private URI url; + + public SearchThumbnail() { + } + + public MediaType getMimeType() { + return mimeType; + } + + public void setMimeType(final MediaType mimeType) { + this.mimeType = mimeType; + } + + public Optional getSize() { + return size; + } + + public void setSize(final Optional size) { + this.size = size; + } + + public Optional getWidth() { + return width; + } + + public void setWidth(final Optional width) { + this.width = width; + } + + public Optional getHeight() { + return height; + } + + public void setHeight(final Optional height) { + this.height = height; + } + + public Optional getDuration() { + return duration; + } + + public void setDuration(final Optional duration) { + this.duration = duration; + } + + public URI getUrl() { + return url; + } + + public void setUrl(final URI url) { + this.url = url; + } +} diff --git a/src/main/java/name/amethyst/wikibot/restapi/dto/UpdatePageRequest.java b/src/main/java/name/amethyst/wikibot/restapi/dto/UpdatePageRequest.java new file mode 100644 index 0000000..85a0823 --- /dev/null +++ b/src/main/java/name/amethyst/wikibot/restapi/dto/UpdatePageRequest.java @@ -0,0 +1,63 @@ +package name.amethyst.wikibot.restapi.dto; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Optional; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class UpdatePageRequest { + @JsonProperty + private String source; + @JsonProperty + private String comment; + @JsonProperty + private Optional latest; + @JsonProperty("content_model") + private Optional contentModel; + @JsonProperty + private Optional token; + + public UpdatePageRequest() { + } + + public String getSource() { + return source; + } + + public void setSource(final String source) { + this.source = source; + } + + public String getComment() { + return comment; + } + + public void setComment(final String comment) { + this.comment = comment; + } + + public Optional getLatest() { + return latest; + } + + public void setLatest(final Optional latest) { + this.latest = latest; + } + + public Optional getContentModel() { + return contentModel; + } + + public void setContentModel(final Optional contentModel) { + this.contentModel = contentModel; + } + + public Optional getToken() { + return token; + } + + public void setToken(final Optional token) { + this.token = token; + } +} diff --git a/src/main/java/name/amethyst/wikibot/restapi/dto/UserRef.java b/src/main/java/name/amethyst/wikibot/restapi/dto/UserRef.java new file mode 100644 index 0000000..f65cfec --- /dev/null +++ b/src/main/java/name/amethyst/wikibot/restapi/dto/UserRef.java @@ -0,0 +1,31 @@ +package name.amethyst.wikibot.restapi.dto; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class UserRef { + @JsonProperty + private long id; + @JsonProperty + private String name; + + public UserRef() { + } + + public long getId() { + return id; + } + + public void setId(final long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } +}