From b046fd554c4a26f729a9240c15afe8f4dbf99deb Mon Sep 17 00:00:00 2001 From: Ben McLean Date: Fri, 7 Jun 2024 21:34:23 +1000 Subject: [PATCH] Fix remaining incompatibilities --- src/main/java/cl/emilym/jlemmy/LemmyApi.java | 30 +++++++++++++++++++ type-generator/main.py | 1 - .../src/generator/retrofit_generator.py | 1 - type-generator/src/visitor/http_visitor.py | 3 +- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/main/java/cl/emilym/jlemmy/LemmyApi.java b/src/main/java/cl/emilym/jlemmy/LemmyApi.java index 4ad9670..c402a24 100644 --- a/src/main/java/cl/emilym/jlemmy/LemmyApi.java +++ b/src/main/java/cl/emilym/jlemmy/LemmyApi.java @@ -7,9 +7,15 @@ import java.util.List; public interface LemmyApi { + @GET("/site") + Call getSite(); + @POST("/site") Call createSite(CreateSite request); + @PUT("/site") + Call editSite(EditSite request); + @POST("/user/leave_admin") Call leaveAdmin(); @@ -40,6 +46,9 @@ public interface LemmyApi { @GET("/modlog") Call getModlog(GetModlog request); + @GET("/search") + Call search(Search request); + @GET("/resolve_object") Call resolveObject(ResolveObject request); @@ -82,6 +91,12 @@ public interface LemmyApi { @POST("/post") Call createPost(CreatePost request); + @GET("/post") + Call getPost(GetPost request); + + @PUT("/post") + Call editPost(EditPost request); + @POST("/post/delete") Call deletePost(DeletePost request); @@ -181,6 +196,15 @@ public interface LemmyApi { @POST("/private_message/mark_as_read") Call markPrivateMessageAsRead(MarkPrivateMessageAsRead request); + @POST("/private_message/report") + Call createPrivateMessageReport(CreatePrivateMessageReport request); + + @PUT("/private_message/report/resolve") + Call resolvePrivateMessageReport(ResolvePrivateMessageReport request); + + @GET("/private_message/report/list") + Call listPrivateMessageReports(ListPrivateMessageReports request); + @POST("/user/register") Call register(Register request); @@ -247,6 +271,12 @@ public interface LemmyApi { @GET("/admin/registration_application/count") Call getUnreadRegistrationApplicationCount(); + @GET("/admin/registration_application/list") + Call listRegistrationApplications(ListRegistrationApplications request); + + @PUT("/admin/registration_application/approve") + Call approveRegistrationApplication(ApproveRegistrationApplication request); + @POST("/admin/purge/person") Call purgePerson(PurgePerson request); diff --git a/type-generator/main.py b/type-generator/main.py index 1d690e1..9a414ca 100644 --- a/type-generator/main.py +++ b/type-generator/main.py @@ -27,7 +27,6 @@ def generate_types(): def parse_model(model_contents: str) -> Optional[Tuple[str, str]]: tree = parser.parse(bytes(model_contents, "utf-8")) - print(tree.root_node.sexp()) if "export type" in model_contents: visitor = EnumVisitor(tree) result = visitor.build() diff --git a/type-generator/src/generator/retrofit_generator.py b/type-generator/src/generator/retrofit_generator.py index fb70f85..92a828f 100644 --- a/type-generator/src/generator/retrofit_generator.py +++ b/type-generator/src/generator/retrofit_generator.py @@ -1,5 +1,4 @@ import textwrap -from datetime import datetime, timezone from typing import List from ..models import Property, ApiMethod, HttpMethod diff --git a/type-generator/src/visitor/http_visitor.py b/type-generator/src/visitor/http_visitor.py index e4d1811..6b953ba 100644 --- a/type-generator/src/visitor/http_visitor.py +++ b/type-generator/src/visitor/http_visitor.py @@ -56,7 +56,6 @@ def visit_method_definition(self, node: Node): name = node.child_by_field_name("name").text.decode(self._encoding) if name in [ "constructor", - "getSite", "#buildFullUrl", "#wrapper", "#fetchFunction", @@ -79,7 +78,7 @@ def visit_type_arguments(self, node: Node): self._current_output = normalize_type(node.children[3].text.decode(self._encoding)) def visit_arguments(self, node: Node): - if node.child_count != 8: + if self._current_name is None: return ts_http_method = node.children[1].text.decode(self._encoding)