Returns an array containing the constants of this enum type, in
-the order they are declared.
-
-
Returns:
-
an array containing the constants of this enum type, in the order they are declared
-
-
-
-
-
-
valueOf
-
public staticLog.LogTypevalueOf(java.lang.String name)
-
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
Parameters:
-
name - the name of the enum constant to be returned.
-
Returns:
-
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
-
java.lang.NullPointerException - if the argument is null
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
-
-
-
Overview
-
The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.
-
-
-
Package
-
Each package has a page that contains a list of its classes and interfaces, with a summary for each. These pages may contain six categories:
-
-
Interfaces
-
Classes
-
Enums
-
Exceptions
-
Errors
-
Annotation Types
-
-
-
-
Class or Interface
-
Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
-
-
Class Inheritance Diagram
-
Direct Subclasses
-
All Known Subinterfaces
-
All Known Implementing Classes
-
Class or Interface Declaration
-
Class or Interface Description
-
-
-
-
Nested Class Summary
-
Field Summary
-
Property Summary
-
Constructor Summary
-
Method Summary
-
-
-
-
Field Details
-
Property Details
-
Constructor Details
-
Method Details
-
-
The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
-
-
-
Annotation Type
-
Each annotation type has its own separate page with the following sections:
-
-
Annotation Type Declaration
-
Annotation Type Description
-
Required Element Summary
-
Optional Element Summary
-
Element Details
-
-
-
-
Enum
-
Each enum has its own separate page with the following sections:
-
-
Enum Declaration
-
Enum Description
-
Enum Constant Summary
-
Enum Constant Details
-
-
-
-
Tree (Class Hierarchy)
-
There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. Classes are organized by inheritance structure starting with java.lang.Object. Interfaces do not inherit from java.lang.Object.
-
-
When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
-
When viewing a particular package, class or interface page, clicking on "Tree" displays the hierarchy for only that package.
-
-
-
-
Deprecated API
-
The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to shortcomings, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
-
-
-
Index
-
The Index contains an alphabetic index of all classes, interfaces, constructors, methods, and fields, as well as lists of all packages and all classes.
-
-
-
Serialized Form
-
Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to those who implement rather than use the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See Also" section of the class description.
You can search for definitions of modules, packages, types, fields, methods, system properties and other terms defined in the API, using some or all of the name, optionally using "camel-case" abbreviations. For example:
-
-
j.l.obj will match "java.lang.Object"
-
InpStr will match "java.io.InputStream"
-
HM.cK will match "java.util.HashMap.containsKey(Object)"
").text(i.label)).appendTo(e)},_move:function(t,e){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[t](e),void 0):(this.search(null,e),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(t,e),e.preventDefault())},_isContentEditable:function(t){if(!t.length)return!1;var e=t.prop("contentEditable");return"inherit"===e?this._isContentEditable(t.parent()):"true"===e}}),t.extend(t.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(e,i){var s=RegExp(t.ui.autocomplete.escapeRegex(i),"i");return t.grep(e,function(t){return s.test(t.label||t.value||t)})}}),t.widget("ui.autocomplete",t.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(t>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,this.liveRegion.children().hide(),t("
+ * You need to pass the user param if the token is for superuser
+ */
+ public XenAPI(final String url, final String token) {
+ this(url, token, -1);
+ }
+
+
+ /**
+ * Constructor for the XenAPI Builder
+ *
+ * @param url the url where XenForo is installed at
+ * @param token The token you have to access
+ * @param user_id The user of the generated token
+ *
+ * You need to pass the user param if the token is for superuser
+ */
+ public XenAPI(final String url, final String token, int user_id) {
+ this.url = url.contains("/api") ? url : url + "/api";
+ this.client = new XenForoClient(token, user_id);
+
+ this.enableDebug(false);
+
+ final Version version = new Version(2, 0, 0, "10-SNAPSHOT");
+ final UpdateChecker updateChecker = new UpdateChecker(version, true);
+ updateChecker.sendVersionUpdate();
+ updateChecker.scheduleCheckVersion();
+
+ Log.info("Started XenAPI client! Version: " + version, "XenforoClient");
+ }
/**
- * Gets the info about the current user (token user)
+ * Sets the library to debug mode to see all logs. By default, this is False
*
- * @return The user information
- * @see User
+ * @param debug true/false
*/
- Me me();
+ public void enableDebug(boolean debug) {
+ Log.setLogLevel(debug ? LogLevel.DEBUG : LogLevel.INFO);
+ }
+
+ /**
+ * Method to send the request to the XenForo API
+ *
+ * @param request The ApiRequest Class
+ * @param The ApiResponse Class from the ApiRequest
+ * @return If success, the ApiResponse Class, if error an #Errors class with the errors from XenForo
+ * @see Response
+ * @see Errors
+ */
+ public Response send(@NonNull final ApiRequest request) {
+ final String url = Utils.createUrl(this.url, request.getPath());
+
+ final List realParams = new ArrayList<>();
+ switch (request.getMethod()) {
+ case GET: {
+ request.params().forEach(p -> realParams.add(p.generate()));
+ return this.client.get(url, request.response(), request.query(), realParams);
+ }
+ case POST: {
+ request.body().forEach(p -> realParams.add(p.generate()));
- User findUserById();
+ if (request.containsFile()) {
+ final File file = (File) request.params().get(0).getValue();
+ return this.client.postFile(url, request.response(), request.query(), realParams, file);
+ }
- User findUserById(int id);
+ return this.client.post(url, request.response(), request.query(), realParams);
+ }
+/* case PUT:
+ return client.putForObject(url, request.getBody(), request.getResponseType(), request.getQueryParams());*/
+ case DELETE:
+ request.body().forEach(p -> realParams.add(p.generate()));
+ return this.client.delete(url, request.response(), request.query(), realParams);
+ default:
+ throw new IllegalArgumentException("Unsupported HTTP method: " + request.getMethod());
+ }
+ }
}
diff --git a/src/es/cadox8/xenapi/XenAPIBuilder.java b/src/es/cadox8/xenapi/XenAPIBuilder.java
deleted file mode 100644
index 0a81519..0000000
--- a/src/es/cadox8/xenapi/XenAPIBuilder.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2021.
- *
- * This file is part of XenAPI .
- *
- * XenAPI is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * XenAPI is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- *
- * If you have any question feel free to ask at or
- */
-
-package es.cadox8.xenapi;
-
-import es.cadox8.xenapi.api.Me;
-import es.cadox8.xenapi.api.User;
-import es.cadox8.xenapi.api.XenForoEntity;
-import es.cadox8.xenapi.net.XenForoClient;
-import es.cadox8.xenapi.net.XenForoUrl;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.List;
-import java.util.function.Supplier;
-import java.util.stream.Collectors;
-
-public class XenAPIBuilder implements XenAPI {
-
- private final XenForoClient httpClient;
- private final String url;
-
- /**
- * Constructor for the XenAPI Builder
- *
- * @param url the url where XenForo is installed at
- * @param token The token you have to access
- */
- public XenAPIBuilder(String url, String token) {
- this(url, token, "");
- }
-
- /**
- * Constructor for the XenAPI Builder
- *
- * @param url the url where XenForo is installed at
- * @param token The token you have to access
- * @param user The user of the generated token
- *
- * You need to pass the user param if the token is for superuser
- */
- public XenAPIBuilder(String url, String token, String user) {
- this.url = url + "/api";
- this.httpClient = new XenForoClient(token, user);
- }
-
- //
-
- @Override
- public Me me() {
- final Me me = get(XenForoUrl.createUrl(this.url, XenForoUrl.GET_ME), Me.class);
- me.setInternalXenAPI(this);
- return me;
- }
-
- @Override
- public User findUserById() {
- final User user = get(XenForoUrl.createUrl(this.url, XenForoUrl.GET_USERS), User.class);
- user.setInternalXenAPI(this);
- return user;
- }
-
- @Override
- public User findUserById(int id) {
- final User user = get(XenForoUrl.createUrl(this.url, XenForoUrl.GET_USERS_ID), User.class, String.valueOf(id));
- user.setInternalXenAPI(this);
- return user;
- }
-
- /* internal methods */
-
- private T postFileForObject(String url, File file, Class objectClass, String... params) {
- return httpClient.postFileForObject(url, file, objectClass, params);
- }
-
- private T post(String url, Object object, Class objectClass, String... params) {
- return httpClient.postForObject(url, object, objectClass, params);
- }
-
- private T get(String url, Class objectClass, String... params) {
- return httpClient.get(url, objectClass, params);
- }
-
- private T put(String url, Object object, Class objectClass, String... params) {
- return httpClient.putForObject(url, object, objectClass, params);
- }
-
- private T delete(String url, Class responseType, String... params) {
- return httpClient.delete(url, responseType, params);
- }
-
- private List asList(Supplier responseSupplier) {
- return Arrays.stream(responseSupplier.get()).peek(t -> t.setInternalXenAPI(this)).collect(Collectors.toList());
- }
-}
diff --git a/src/es/cadox8/xenapi/api/Me.java b/src/es/cadox8/xenapi/api/Me.java
deleted file mode 100644
index 170bfa1..0000000
--- a/src/es/cadox8/xenapi/api/Me.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2021-2021.
- *
- * This file is part of XenAPI .
- *
- * XenAPI is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * XenAPI is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- *
- * If you have any question feel free to ask at or
- */
-
-package es.cadox8.xenapi.api;
-
-import es.cadox8.xenapi.api.user.AvatarUrls;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.util.Date;
-import java.util.Map;
-
-@EqualsAndHashCode(callSuper = true)
-@Data
-public class Me extends User {
-
- public Me(String about, boolean activity_visible, int age, Object[] alert_optout, String allow_post_profile, String allow_receive_news_feed, String allow_send_personal_conversation, String allow_view_identities, String allow_view_profile, AvatarUrls[] avatar_urls, Object[] profile_banner_urls, boolean can_ban, boolean can_converse, boolean can_edit, boolean can_follow, boolean can_ignore, boolean can_post_profile, boolean can_view_profile, boolean can_view_profile_posts, boolean can_warn, boolean content_show_signature, String creation_watch_state, Map custom_fields, String custom_title, Date dob, String email, boolean email_on_conversation, String gravatar, boolean interaction_watch_state, boolean is_admin, boolean is_banned, boolean is_discouraged) {
- super(about, activity_visible, age, alert_optout, allow_post_profile, allow_receive_news_feed, allow_send_personal_conversation, allow_view_identities, allow_view_profile, avatar_urls, profile_banner_urls, can_ban, can_converse, can_edit, can_follow, can_ignore, can_post_profile, can_view_profile, can_view_profile_posts, can_warn, content_show_signature, creation_watch_state, custom_fields, custom_title, dob, email, email_on_conversation, gravatar, interaction_watch_state, is_admin, is_banned, is_discouraged);
- }
-}
diff --git a/src/es/cadox8/xenapi/api/User.java b/src/es/cadox8/xenapi/api/User.java
deleted file mode 100644
index 7219537..0000000
--- a/src/es/cadox8/xenapi/api/User.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2021.
- *
- * This file is part of XenAPI .
- *
- * XenAPI is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * XenAPI is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- *
- * If you have any question feel free to ask at or
- */
-
-package es.cadox8.xenapi.api;
-
-import es.cadox8.xenapi.api.user.AvatarUrls;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.util.Date;
-import java.util.Map;
-
-/**
- * User class
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@AllArgsConstructor
-public class User extends XenForoEntity {
-
- private String about;
- private boolean activity_visible;
- private int age;
- private Object[] alert_optout;
- private String allow_post_profile;
- private String allow_receive_news_feed;
- private String allow_send_personal_conversation;
- private String allow_view_identities;
- private String allow_view_profile;
-
- private AvatarUrls[] avatar_urls;
- private Object[] profile_banner_urls;
-
- private boolean can_ban;
- private boolean can_converse;
- private boolean can_edit;
- private boolean can_follow;
- private boolean can_ignore;
- private boolean can_post_profile;
- private boolean can_view_profile;
- private boolean can_view_profile_posts;
- private boolean can_warn;
- private boolean content_show_signature;
-
- private String creation_watch_state;
- private Map custom_fields;
- private String custom_title;
- private Date dob;
-
- private String email;
- private boolean email_on_conversation;
-
- private String gravatar;
-
- private boolean interaction_watch_state;
- private boolean is_admin;
- private boolean is_banned;
- private boolean is_discouraged;
-}
diff --git a/src/es/cadox8/xenapi/api/alerts/AlertResponse.java b/src/es/cadox8/xenapi/api/alerts/AlertResponse.java
new file mode 100644
index 0000000..3e6e4f1
--- /dev/null
+++ b/src/es/cadox8/xenapi/api/alerts/AlertResponse.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2025
+ *
+ * This file is part of XenAPI .
+ *
+ * XenAPI is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * XenAPI is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * If you have any question feel free to ask at or
+ */
+
+package es.cadox8.xenapi.api.alerts;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+import es.cadox8.xenapi.api.auth.UserResponse;
+import es.cadox8.xenapi.net.ApiResponse;
+import lombok.Data;
+
+@Data
+public class AlertResponse implements ApiResponse {
+
+ @Expose
+ @SerializedName("action")
+ private String action;
+ @Expose
+ @SerializedName("alert_id")
+ private int alertId;
+ @Expose
+ @SerializedName("alert_text")
+ private String alertText;
+ @Expose
+ @SerializedName("alert_url")
+ private String alertUrl;
+ @Expose
+ @SerializedName("alerted_user_id")
+ private int alertedUserId;
+ @Expose
+ @SerializedName("auto_read")
+ private boolean autoRead;
+ @Expose
+ @SerializedName("content_id")
+ private int contentId;
+ @Expose
+ @SerializedName("content_type")
+ private String contentType;
+ @Expose
+ @SerializedName("event_date")
+ private long eventDate;
+ @Expose
+ @SerializedName("read_date")
+ private long readDate;
+ @Expose
+ @SerializedName("User")
+ private UserResponse user;
+ @Expose
+ @SerializedName("user_id")
+ private int userId;
+ @Expose
+ @SerializedName("username")
+ private String username;
+ @Expose
+ @SerializedName("view_date")
+ private long viewDate;
+}
\ No newline at end of file
diff --git a/src/es/cadox8/xenapi/api/alerts/AllAlertResponse.java b/src/es/cadox8/xenapi/api/alerts/AllAlertResponse.java
new file mode 100644
index 0000000..b9475b7
--- /dev/null
+++ b/src/es/cadox8/xenapi/api/alerts/AllAlertResponse.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2025
+ *
+ * This file is part of XenAPI .
+ *
+ * XenAPI is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * XenAPI is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * If you have any question feel free to ask at or
+ */
+
+package es.cadox8.xenapi.api.alerts;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+import es.cadox8.xenapi.api.commons.Pagination;
+import es.cadox8.xenapi.net.ApiResponse;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class AllAlertResponse implements ApiResponse {
+ @SerializedName("alerts")
+ @Expose
+ private List alerts;
+
+ @SerializedName("pagination")
+ @Expose
+ private Pagination pagination;
+}
diff --git a/src/es/cadox8/xenapi/api/alerts/GetAlerts.java b/src/es/cadox8/xenapi/api/alerts/GetAlerts.java
new file mode 100644
index 0000000..433f2c9
--- /dev/null
+++ b/src/es/cadox8/xenapi/api/alerts/GetAlerts.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2025
+ *
+ * This file is part of XenAPI .
+ *
+ * XenAPI is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * XenAPI is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * If you have any question feel free to ask at or
+ */
+
+package es.cadox8.xenapi.api.alerts;
+
+import es.cadox8.xenapi.net.ApiRequest;
+import es.cadox8.xenapi.net.HttpMethod;
+import es.cadox8.xenapi.utils.XenforoPaths;
+import es.cadox8.xenapi.utils.XenNameValuePair;
+import lombok.Builder;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Builder
+public class GetAlerts implements ApiRequest {
+
+ /**
+ *
+ */
+ private final int page;
+ /**
+ * Unix timestamp of the oldest alert to include. Note that unread or unviewed alerts are always included.
+ */
+ private final int cutoff;
+ /**
+ * If true, gets only unviewed alerts. Unviewed alerts have not been seen (in the standard UI).
+ */
+ private final boolean unviewed;
+ /**
+ * If true, gets only unread alerts. Unread alerts may have been seen but the content they relate to has not been viewed.
+ */
+ private final boolean unread;
+
+ @Override
+ public XenforoPaths getPath() {
+ return XenforoPaths.ALERTS;
+ }
+
+ @Override
+ public HttpMethod getMethod() {
+ return HttpMethod.GET;
+ }
+
+ @Override
+ public Object query() {
+ return null;
+ }
+
+ @Override
+ public List params() {
+ final List params = new ArrayList<>();
+
+ if (this.cutoff > 0)
+ params.add(new XenNameValuePair("cutoff", this.cutoff));
+
+ if (this.page > 0)
+ params.add(new XenNameValuePair("page", this.page));
+
+ params.add(new XenNameValuePair("unviewed", this.unviewed));
+ params.add(new XenNameValuePair("unread", this.unread));
+ return params;
+ }
+
+ @Override
+ public List body() {
+ return new ArrayList<>();
+ }
+
+ @Override
+ public Class response() {
+ return AllAlertResponse.class;
+ }
+}
diff --git a/src/es/cadox8/xenapi/api/alerts/GetOneAlert.java b/src/es/cadox8/xenapi/api/alerts/GetOneAlert.java
new file mode 100644
index 0000000..4d778c7
--- /dev/null
+++ b/src/es/cadox8/xenapi/api/alerts/GetOneAlert.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2025
+ *
+ * This file is part of XenAPI .
+ *
+ * XenAPI is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * XenAPI is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * If you have any question feel free to ask at or
+ */
+
+package es.cadox8.xenapi.api.alerts;
+
+import es.cadox8.xenapi.net.ApiRequest;
+import es.cadox8.xenapi.net.HttpMethod;
+import es.cadox8.xenapi.utils.XenforoPaths;
+import es.cadox8.xenapi.utils.XenNameValuePair;
+import lombok.Builder;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Builder
+public class GetOneAlert implements ApiRequest {
+
+ private final int id;
+
+ @Override
+ public XenforoPaths getPath() {
+ return XenforoPaths.ALERT;
+ }
+
+ @Override
+ public HttpMethod getMethod() {
+ return HttpMethod.GET;
+ }
+
+ @Override
+ public Object query() {
+ return this.id;
+ }
+
+ @Override
+ public List params() {
+ return new ArrayList<>();
+ }
+
+ @Override
+ public List body() {
+ return new ArrayList<>();
+ }
+
+ @Override
+ public Class response() {
+ return OneAlertResponse.class;
+ }
+}
\ No newline at end of file
diff --git a/src/es/cadox8/xenapi/api/alerts/MarkAllAlerts.java b/src/es/cadox8/xenapi/api/alerts/MarkAllAlerts.java
new file mode 100644
index 0000000..4809339
--- /dev/null
+++ b/src/es/cadox8/xenapi/api/alerts/MarkAllAlerts.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2025
+ *
+ * This file is part of XenAPI .
+ *
+ * XenAPI is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * XenAPI is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * If you have any question feel free to ask at or
+ */
+
+package es.cadox8.xenapi.api.alerts;
+
+import es.cadox8.xenapi.api.commons.Success;
+import es.cadox8.xenapi.net.ApiRequest;
+import es.cadox8.xenapi.net.HttpMethod;
+import es.cadox8.xenapi.utils.XenforoPaths;
+import es.cadox8.xenapi.utils.XenNameValuePair;
+import lombok.Builder;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Builder
+public class MarkAllAlerts implements ApiRequest {
+
+ private final boolean read;
+ private final boolean viewed;
+
+ @Override
+ public XenforoPaths getPath() {
+ return XenforoPaths.ALERTS_MARK;
+ }
+
+ @Override
+ public HttpMethod getMethod() {
+ return HttpMethod.POST;
+ }
+
+ @Override
+ public Object query() {
+ return null;
+ }
+
+ @Override
+ public List params() {
+ return List.of();
+ }
+
+ @Override
+ public List body() {
+ final List params = new ArrayList<>();
+
+ if (this.read)
+ params.add(new XenNameValuePair("read", true));
+ if (this.viewed)
+ params.add(new XenNameValuePair("viewed", true));
+
+ return params;
+ }
+
+ @Override
+ public Class response() {
+ return Success.class;
+ }
+}
diff --git a/src/es/cadox8/xenapi/api/alerts/MarkOneAlert.java b/src/es/cadox8/xenapi/api/alerts/MarkOneAlert.java
new file mode 100644
index 0000000..a7601a6
--- /dev/null
+++ b/src/es/cadox8/xenapi/api/alerts/MarkOneAlert.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2025
+ *
+ * This file is part of XenAPI .
+ *
+ * XenAPI is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * XenAPI is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * If you have any question feel free to ask at or
+ */
+
+package es.cadox8.xenapi.api.alerts;
+
+import es.cadox8.xenapi.api.commons.Success;
+import es.cadox8.xenapi.net.ApiRequest;
+import es.cadox8.xenapi.net.HttpMethod;
+import es.cadox8.xenapi.utils.XenforoPaths;
+import es.cadox8.xenapi.utils.XenNameValuePair;
+import lombok.Builder;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Builder
+public class MarkOneAlert implements ApiRequest {
+
+ private final String id;
+
+ private final boolean read;
+ private final boolean unread;
+ private final boolean viewed;
+
+ @Override
+ public XenforoPaths getPath() {
+ return XenforoPaths.ALERT_MARK;
+ }
+
+ @Override
+ public HttpMethod getMethod() {
+ return HttpMethod.POST;
+ }
+
+ @Override
+ public Object query() {
+ return this.id;
+ }
+
+ @Override
+ public List params() {
+ return List.of();
+ }
+
+ @Override
+ public List body() {
+ final List params = new ArrayList<>();
+
+ if (this.read)
+ params.add(new XenNameValuePair("read", true));
+ if (this.unread)
+ params.add(new XenNameValuePair("unread", true));
+ if (this.viewed)
+ params.add(new XenNameValuePair("viewed", true));
+
+ return params;
+ }
+
+ @Override
+ public Class response() {
+ return Success.class;
+ }
+}
diff --git a/src/es/cadox8/xenapi/api/alerts/OneAlertResponse.java b/src/es/cadox8/xenapi/api/alerts/OneAlertResponse.java
new file mode 100644
index 0000000..18f76a3
--- /dev/null
+++ b/src/es/cadox8/xenapi/api/alerts/OneAlertResponse.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2025
+ *
+ * This file is part of XenAPI .
+ *
+ * XenAPI is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * XenAPI is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * If you have any question feel free to ask at or
+ */
+
+package es.cadox8.xenapi.api.alerts;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+import es.cadox8.xenapi.net.ApiResponse;
+import lombok.Data;
+
+@Data
+public class OneAlertResponse implements ApiResponse {
+ @SerializedName("alert")
+ @Expose
+ private AlertResponse alert;
+}
diff --git a/src/es/cadox8/xenapi/api/alerts/PostAlert.java b/src/es/cadox8/xenapi/api/alerts/PostAlert.java
new file mode 100644
index 0000000..22cc236
--- /dev/null
+++ b/src/es/cadox8/xenapi/api/alerts/PostAlert.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2025
+ *
+ * This file is part of XenAPI .
+ *
+ * XenAPI is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * XenAPI is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * If you have any question feel free to ask at or
+ */
+
+package es.cadox8.xenapi.api.alerts;
+
+import es.cadox8.xenapi.api.commons.Success;
+import es.cadox8.xenapi.exceptions.XenForoMissingArgsException;
+import es.cadox8.xenapi.net.ApiRequest;
+import es.cadox8.xenapi.net.HttpMethod;
+import es.cadox8.xenapi.utils.XenforoPaths;
+import es.cadox8.xenapi.utils.XenNameValuePair;
+import lombok.Builder;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Builder
+public class PostAlert implements ApiRequest {
+
+ /**
+ * Required. ID of the user to receive the alert
+ */
+ @Builder.Default private final int to_user_id = -1;
+ /**
+ * Required. Text of the alert. May use the placeholder "{link}" to have the link automatically inserted.
+ */
+ @Builder.Default private final String alert = "";
+ /**
+ * If provided, the user to send the alert from. Otherwise, uses the current API user. May be 0 for an anonymous alert.
+ */
+ private final int from_user_id;
+ private final String link_url;
+ private final String link_title;
+
+ @Override
+ public XenforoPaths getPath() {
+ return XenforoPaths.ALERTS;
+ }
+
+ @Override
+ public HttpMethod getMethod() {
+ return HttpMethod.POST;
+ }
+
+ @Override
+ public Object query() {
+ return null;
+ }
+
+ @Override
+ public List params() {
+ return List.of();
+ }
+
+ @Override
+ public List body() {
+ final List params = new ArrayList<>();
+
+ if (this.to_user_id == -1 || this.alert.isEmpty())
+ throw new XenForoMissingArgsException("to_user_id or alert!");
+
+ params.add(new XenNameValuePair("to_user_id", this.to_user_id));
+ params.add(new XenNameValuePair("alert", this.alert));
+ params.add(new XenNameValuePair("from_user_id", this.from_user_id));
+
+ if (this.link_url != null)
+ params.add(new XenNameValuePair("link_url", this.link_url));
+ if (this.link_title != null)
+ params.add(new XenNameValuePair("link_title", this.link_title));
+
+ return params;
+ }
+
+ @Override
+ public Class response() {
+ return Success.class;
+ }
+}
diff --git a/src/es/cadox8/xenapi/api/attachment/AllAttachmentResponse.java b/src/es/cadox8/xenapi/api/attachment/AllAttachmentResponse.java
new file mode 100644
index 0000000..06b673c
--- /dev/null
+++ b/src/es/cadox8/xenapi/api/attachment/AllAttachmentResponse.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2024-2025
+ *
+ * This file is part of XenAPI .
+ *
+ * XenAPI is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * XenAPI is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * If you have any question feel free to ask at or
+ */
+
+package es.cadox8.xenapi.api.attachment;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+import es.cadox8.xenapi.net.ApiResponse;
+import lombok.Getter;
+import lombok.ToString;
+
+import java.util.List;
+
+@Getter
+@ToString
+public class AllAttachmentResponse implements ApiResponse {
+
+ @Expose
+ @SerializedName("attachments")
+ private List attachments;
+}
diff --git a/src/es/cadox8/xenapi/api/attachment/AttachmentResponse.java b/src/es/cadox8/xenapi/api/attachment/AttachmentResponse.java
new file mode 100644
index 0000000..e8d024f
--- /dev/null
+++ b/src/es/cadox8/xenapi/api/attachment/AttachmentResponse.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2024-2025
+ *
+ * This file is part of XenAPI .
+ *
+ * XenAPI is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * XenAPI is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * If you have any question feel free to ask at or
+ */
+
+package es.cadox8.xenapi.api.attachment;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+import es.cadox8.xenapi.net.ApiResponse;
+import lombok.Getter;
+import lombok.ToString;
+
+@Getter
+@ToString
+public class AttachmentResponse implements ApiResponse {
+
+ @Expose
+ @SerializedName("filename")
+ private String filename;
+
+ @Expose
+ @SerializedName("file_size")
+ private int fileSize;
+
+ @Expose
+ @SerializedName("height")
+ private int height;
+
+ @Expose
+ @SerializedName("width")
+ private int width;
+
+ @Expose
+ @SerializedName("thumbnail_url")
+ private String thumbnailUrl;
+
+ @Expose
+ @SerializedName("direct_url")
+ private String directUrl;
+
+ @Expose
+ @SerializedName("is_video")
+ private boolean isVideo;
+
+ @Expose
+ @SerializedName("is_audio")
+ private boolean isAudio;
+
+ @Expose
+ @SerializedName("attachment_id")
+ private int attachmentId;
+
+ @Expose
+ @SerializedName("content_type")
+ private String contentType;
+
+ @Expose
+ @SerializedName("content_id")
+ private int contentId;
+
+ @Expose
+ @SerializedName("attach_date")
+ private int attachDate;
+
+ @Expose
+ @SerializedName("view_count")
+ private int viewCount;
+}
diff --git a/src/es/cadox8/xenapi/api/attachment/GetAttachments.java b/src/es/cadox8/xenapi/api/attachment/GetAttachments.java
new file mode 100644
index 0000000..67ccc3a
--- /dev/null
+++ b/src/es/cadox8/xenapi/api/attachment/GetAttachments.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2025
+ *
+ * This file is part of XenAPI .
+ *
+ * XenAPI is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * XenAPI is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * If you have any question feel free to ask at or
+ */
+
+package es.cadox8.xenapi.api.attachment;
+
+import es.cadox8.xenapi.net.ApiRequest;
+import es.cadox8.xenapi.net.HttpMethod;
+import es.cadox8.xenapi.utils.XenforoPaths;
+import es.cadox8.xenapi.utils.XenNameValuePair;
+import lombok.Builder;
+
+import java.util.List;
+
+@Builder
+public class GetAttachments implements ApiRequest {
+
+ private final String key;
+
+ @Override
+ public XenforoPaths getPath() {
+ return XenforoPaths.ATTACHMENTS;
+ }
+
+ @Override
+ public HttpMethod getMethod() {
+ return HttpMethod.GET;
+ }
+
+ @Override
+ public Object query() {
+ return null;
+ }
+
+ @Override
+ public List params() {
+ return List.of(new XenNameValuePair("key", this.key));
+ }
+
+ @Override
+ public List body() {
+ return List.of();
+ }
+
+ @Override
+ public Class response() {
+ return AllAttachmentResponse.class;
+ }
+}
diff --git a/src/es/cadox8/xenapi/api/attachment/NewKeyAttachment.java b/src/es/cadox8/xenapi/api/attachment/NewKeyAttachment.java
new file mode 100644
index 0000000..e9e15d1
--- /dev/null
+++ b/src/es/cadox8/xenapi/api/attachment/NewKeyAttachment.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025
+ *
+ * This file is part of XenAPI .
+ *
+ * XenAPI is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * XenAPI is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * If you have any question feel free to ask at or
+ */
+
+package es.cadox8.xenapi.api.attachment;
+
+public class NewKeyAttachment {
+}
diff --git a/src/es/cadox8/xenapi/api/attachment/OneAttachmentResponse.java b/src/es/cadox8/xenapi/api/attachment/OneAttachmentResponse.java
new file mode 100644
index 0000000..1bdac57
--- /dev/null
+++ b/src/es/cadox8/xenapi/api/attachment/OneAttachmentResponse.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2024-2025
+ *
+ * This file is part of XenAPI .
+ *
+ * XenAPI is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * XenAPI is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * If you have any question feel free to ask at or
+ */
+
+package es.cadox8.xenapi.api.attachment;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+import es.cadox8.xenapi.net.ApiResponse;
+import lombok.Getter;
+import lombok.ToString;
+
+@Getter
+@ToString
+public class OneAttachmentResponse implements ApiResponse {
+
+ @Expose
+ @SerializedName("attachment")
+ private AttachmentResponse attachment;
+}
diff --git a/src/es/cadox8/xenapi/api/attachment/UploadAttachment.java b/src/es/cadox8/xenapi/api/attachment/UploadAttachment.java
new file mode 100644
index 0000000..5751d9f
--- /dev/null
+++ b/src/es/cadox8/xenapi/api/attachment/UploadAttachment.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2025
+ *
+ * This file is part of XenAPI .
+ *
+ * XenAPI is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * XenAPI is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * If you have any question feel free to ask at or
+ */
+
+package es.cadox8.xenapi.api.attachment;
+
+import es.cadox8.xenapi.net.ApiRequest;
+import es.cadox8.xenapi.net.HttpMethod;
+import es.cadox8.xenapi.utils.XenforoPaths;
+import es.cadox8.xenapi.utils.XenNameValuePair;
+import lombok.Builder;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+@Builder
+public class UploadAttachment implements ApiRequest {
+
+ private final String key;
+ private final File attachment;
+
+ @Override
+ public XenforoPaths getPath() {
+ return XenforoPaths.ATTACHMENTS;
+ }
+
+ @Override
+ public HttpMethod getMethod() {
+ return HttpMethod.POST;
+ }
+
+ @Override
+ public Object query() {
+ return null;
+ }
+
+ @Override
+ public List params() {
+ return List.of();
+ }
+
+ @Override
+ public List body() {
+ final List body = new ArrayList<>();
+ body.add(new XenNameValuePair("key", this.key));
+ body.add(new XenNameValuePair("attachment", this.attachment));
+ return body;
+ }
+
+ @Override
+ public Class response() {
+ return OneAttachmentResponse.class;
+ }
+}
diff --git a/src/es/cadox8/xenapi/api/auth/AuthTokenResponse.java b/src/es/cadox8/xenapi/api/auth/AuthTokenResponse.java
new file mode 100644
index 0000000..8ef8765
--- /dev/null
+++ b/src/es/cadox8/xenapi/api/auth/AuthTokenResponse.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2025
+ *
+ * This file is part of XenAPI .
+ *
+ * XenAPI is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * XenAPI is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * If you have any question feel free to ask at or
+ */
+
+package es.cadox8.xenapi.api.auth;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+import es.cadox8.xenapi.net.ApiResponse;
+import lombok.Data;
+
+@Data
+public class AuthTokenResponse implements ApiResponse {
+
+ @Expose
+ @SerializedName("login_token")
+ private String loginToken;
+
+ @Expose
+ @SerializedName("login_url")
+ private String loginUrl;
+
+ @Expose
+ @SerializedName("expiry_date")
+ private Integer expiryDate;
+}
diff --git a/src/es/cadox8/xenapi/api/auth/PostAuth.java b/src/es/cadox8/xenapi/api/auth/PostAuth.java
new file mode 100644
index 0000000..acac898
--- /dev/null
+++ b/src/es/cadox8/xenapi/api/auth/PostAuth.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2024
+ *
+ * This file is part of XenAPI .
+ *
+ * XenAPI is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * XenAPI is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * If you have any question feel free to ask at or
+ */
+
+package es.cadox8.xenapi.api.auth;
+
+import es.cadox8.xenapi.net.ApiRequest;
+import es.cadox8.xenapi.net.HttpMethod;
+import es.cadox8.xenapi.utils.XenNameValuePair;
+import es.cadox8.xenapi.utils.XenforoPaths;
+import lombok.Builder;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Builder
+public class PostAuth implements ApiRequest {
+
+ private final String login;
+ private final String password;
+ private final String limit_ip;
+
+ @Override
+ public XenforoPaths getPath() {
+ return XenforoPaths.AUTH;
+ }
+
+ @Override
+ public HttpMethod getMethod() {
+ return HttpMethod.POST;
+ }
+
+ @Override
+ public Object query() {
+ return null;
+ }
+
+ @Override
+ public List params() {
+ return List.of();
+ }
+
+ @Override
+ public List body() {
+ final List body = new ArrayList<>();
+
+ body.add(new XenNameValuePair("login", this.login));
+ body.add(new XenNameValuePair("password", this.password));
+
+ if (this.limit_ip != null)
+ body.add(new XenNameValuePair("limit_ip", this.limit_ip));
+
+ return body;
+ }
+
+ @Override
+ public Class response() {
+ return UserResponse.class;
+ }
+}
diff --git a/src/es/cadox8/xenapi/api/auth/PostAuthSession.java b/src/es/cadox8/xenapi/api/auth/PostAuthSession.java
new file mode 100644
index 0000000..fad5bc3
--- /dev/null
+++ b/src/es/cadox8/xenapi/api/auth/PostAuthSession.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2025
+ *
+ * This file is part of XenAPI .
+ *
+ * XenAPI is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * XenAPI is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * If you have any question feel free to ask at or
+ */
+
+package es.cadox8.xenapi.api.auth;
+
+import es.cadox8.xenapi.exceptions.XenForoMissingArgsException;
+import es.cadox8.xenapi.net.ApiRequest;
+import es.cadox8.xenapi.net.HttpMethod;
+import es.cadox8.xenapi.utils.XenNameValuePair;
+import es.cadox8.xenapi.utils.XenforoPaths;
+import lombok.Builder;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Builder
+public class PostAuthSession implements ApiRequest {
+
+ private final String sessionId;
+ private final String rememberCookie;
+
+ @Override
+ public XenforoPaths getPath() {
+ return XenforoPaths.AUTH_SESSION;
+ }
+
+ @Override
+ public HttpMethod getMethod() {
+ return HttpMethod.POST;
+ }
+
+ @Override
+ public Object query() {
+ return null;
+ }
+
+ @Override
+ public List params() {
+ return List.of();
+ }
+
+ @Override
+ public List body() {
+ final List list = new ArrayList<>();
+
+ if (this.sessionId == null || this.sessionId.isEmpty())
+ throw new XenForoMissingArgsException("sessionId");
+
+ if (this.rememberCookie == null || this.rememberCookie.isEmpty())
+ throw new XenForoMissingArgsException("rememberCookie");
+
+ list.add(new XenNameValuePair("session_id", this.sessionId));
+ list.add(new XenNameValuePair("remember_cookie", this.rememberCookie));
+
+ return list;
+ }
+
+ @Override
+ public Class response() {
+ return UserResponse.class;
+ }
+}
diff --git a/src/es/cadox8/xenapi/api/auth/PostAuthToken.java b/src/es/cadox8/xenapi/api/auth/PostAuthToken.java
new file mode 100644
index 0000000..014cae4
--- /dev/null
+++ b/src/es/cadox8/xenapi/api/auth/PostAuthToken.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2025
+ *
+ * This file is part of XenAPI .
+ *
+ * XenAPI is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * XenAPI is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * If you have any question feel free to ask at or
+ */
+
+package es.cadox8.xenapi.api.auth;
+
+import es.cadox8.xenapi.exceptions.XenForoMissingArgsException;
+import es.cadox8.xenapi.net.ApiRequest;
+import es.cadox8.xenapi.net.HttpMethod;
+import es.cadox8.xenapi.utils.XenNameValuePair;
+import es.cadox8.xenapi.utils.XenforoPaths;
+import lombok.Builder;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Builder
+public class PostAuthToken implements ApiRequest {
+
+ private final Integer userId;
+ private final String limitIP;
+ private final String returnUrl;
+ private final Boolean force;
+ @Builder.Default private final Boolean remember = true;
+
+ @Override
+ public XenforoPaths getPath() {
+ return XenforoPaths.LOGIN_TOKEN;
+ }
+
+ @Override
+ public HttpMethod getMethod() {
+ return HttpMethod.POST;
+ }
+
+ @Override
+ public Object query() {
+ return null;
+ }
+
+ @Override
+ public List params() {
+ return List.of();
+ }
+
+ @Override
+ public List body() {
+ final List list = new ArrayList<>();
+
+ if (this.userId == null)
+ throw new XenForoMissingArgsException("userId");
+
+ if (this.limitIP != null && !this.limitIP.isEmpty())
+ list.add(new XenNameValuePair("limit_ip", this.limitIP));
+
+ if (this.returnUrl != null && !this.returnUrl.isEmpty())
+ list.add(new XenNameValuePair("return_url", this.returnUrl));
+
+ if (this.force != null)
+ list.add(new XenNameValuePair("force", this.force));
+
+ list.add(new XenNameValuePair("remember", this.remember));
+
+ return list;
+ }
+
+ @Override
+ public Class response() {
+ return AuthTokenResponse.class;
+ }
+}
diff --git a/src/es/cadox8/xenapi/api/auth/UserResponse.java b/src/es/cadox8/xenapi/api/auth/UserResponse.java
new file mode 100644
index 0000000..2f29b30
--- /dev/null
+++ b/src/es/cadox8/xenapi/api/auth/UserResponse.java
@@ -0,0 +1,306 @@
+/*
+ * Copyright (c) 2021-2025
+ *
+ * This file is part of XenAPI .
+ *
+ * XenAPI is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * XenAPI is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * If you have any question feel free to ask at or
+ */
+
+package es.cadox8.xenapi.api.auth;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+import es.cadox8.xenapi.api.commons.AvatarUrls;
+import es.cadox8.xenapi.api.commons.ProfileBannerUrls;
+import es.cadox8.xenapi.net.ApiResponse;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * User class
+ */
+@Data
+@AllArgsConstructor
+public class UserResponse implements ApiResponse {
+
+ @Expose
+ @SerializedName("success")
+ private boolean success;
+
+ @Expose
+ @SerializedName("user")
+ private UserData user;
+
+ @Data
+ @AllArgsConstructor
+ public static class UserData {
+
+ @Expose
+ @SerializedName("about")
+ private String about;
+
+ @Expose
+ @SerializedName("activity_visible")
+ private boolean activityVisible;
+
+ @Expose
+ @SerializedName("age")
+ private int age;
+
+ @Expose
+ @SerializedName("alert_optout")
+ private List