Skip to content
This repository was archived by the owner on Feb 14, 2025. It is now read-only.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# 1.0.2
* Throw ``APIException`` instead ``ClassCastException`` when error is encountered #12
* Add all available fields to model returned by ``/user/list``
* Updated dependencies

# 1.0.1
* Updated OpenApi generator
* Throw ``APIException`` instead ``ClassCastException`` when error is encountered #12
* Updated dependencies

# 1.0.0

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ This client [is generated](./sched-java-client/pom.xml) from an [``openapi.yml``
> * Dates are not formatted according to [``RFC 3339``](https://datatracker.ietf.org/doc/html/rfc3339)
> * Sometimes unix timestamps are used instead of dates
> * Arrays are not handled as arrays and instead comma separated lists are used
> * Some fields are not returned when using the 'Read-Only API Key' e.g. the ``id`` of users
> * Incorrect [HTTP Request methods](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods) are used. E.g. ``GET`` for ``/api/session/del`` (should be ``DELETE``)
> * Some endpoints don't return JSON by default
>
Expand Down
9 changes: 8 additions & 1 deletion openapi/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ paths:
schema:
type: string
maxLength: 512
description: 'Comma separated list of fields. Default: "username", "name", "phone", "email", "joined", "lastactive", "avatar", "company", "position", "location". Available fields: "id", "username", "name", "phone", "email", "url", "about", "role", "joined", "lastactive", "avatar", "company", "position", "location";'
description: 'Comma separated list of fields. Default: username, name, phone, email, joined, lastactive, avatar, company, position, location. Available fields: id, username, name, phone, email, url, about, role, joined, lastactive, avatar, company, position, location'
responses:
'200':
description: Returned if the request was processed - no matter if it was successful or not; text-Responses usually indicate an error
Expand Down Expand Up @@ -634,6 +634,8 @@ components:
type: object
readOnly: true
properties:
id:
type: string
username:
type: string
name:
Expand All @@ -642,6 +644,11 @@ components:
type: string
email:
type: string
about:
type: string
role:
type: string
description: 'Comma separated list of roles'
joined:
type: string
# format: date-time - NOT VALID RFC 3339 DATE!
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.xdev-software</groupId>
<artifactId>sched-java-client-root</artifactId>
<version>1.0.1</version>
<version>1.0.2-SNAPSHOT</version>
<packaging>pom</packaging>

<organization>
Expand Down
4 changes: 2 additions & 2 deletions sched-java-client-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.xdev-software</groupId>
<artifactId>sched-java-client-demo</artifactId>
<version>1.0.1</version>
<version>1.0.2-SNAPSHOT</version>
<packaging>jar</packaging>

<inceptionYear>2022</inceptionYear>
Expand All @@ -25,7 +25,7 @@

<mainClass>software.xdev.Application</mainClass>

<log4j2-version>2.20.0</log4j2-version>
<log4j2-version>2.21.0</log4j2-version>
</properties>

<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions sched-java-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.xdev-software</groupId>
<artifactId>sched-java-client</artifactId>
<version>1.0.1</version>
<version>1.0.2-SNAPSHOT</version>
<packaging>jar</packaging>

<name>sched-java-client</name>
Expand Down Expand Up @@ -94,7 +94,7 @@
<dependency>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-bom</artifactId>
<version>2.15.2</version>
<version>2.15.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public UserAdded addUser(String username, String email, String password, String
*
*
* @param format (optional, default to json)
* @param fields Comma separated list of fields. Default: \&quot;username\&quot;, \&quot;name\&quot;, \&quot;phone\&quot;, \&quot;email\&quot;, \&quot;joined\&quot;, \&quot;lastactive\&quot;, \&quot;avatar\&quot;, \&quot;company\&quot;, \&quot;position\&quot;, \&quot;location\&quot;. Available fields: \&quot;id\&quot;, \&quot;username\&quot;, \&quot;name\&quot;, \&quot;phone\&quot;, \&quot;email\&quot;, \&quot;url\&quot;, \&quot;about\&quot;, \&quot;role\&quot;, \&quot;joined\&quot;, \&quot;lastactive\&quot;, \&quot;avatar\&quot;, \&quot;company\&quot;, \&quot;position\&quot;, \&quot;location\&quot;; (optional)
* @param fields Comma separated list of fields. Default: username, name, phone, email, joined, lastactive, avatar, company, position, location. Available fields: id, username, name, phone, email, url, about, role, joined, lastactive, avatar, company, position, location (optional)
* @return List&lt;User&gt;
* @throws ApiException if fails to make API call
*/
Expand All @@ -188,7 +188,7 @@ public List<User> listUsers(String format, String fields) throws ApiException {
*
*
* @param format (optional, default to json)
* @param fields Comma separated list of fields. Default: \&quot;username\&quot;, \&quot;name\&quot;, \&quot;phone\&quot;, \&quot;email\&quot;, \&quot;joined\&quot;, \&quot;lastactive\&quot;, \&quot;avatar\&quot;, \&quot;company\&quot;, \&quot;position\&quot;, \&quot;location\&quot;. Available fields: \&quot;id\&quot;, \&quot;username\&quot;, \&quot;name\&quot;, \&quot;phone\&quot;, \&quot;email\&quot;, \&quot;url\&quot;, \&quot;about\&quot;, \&quot;role\&quot;, \&quot;joined\&quot;, \&quot;lastactive\&quot;, \&quot;avatar\&quot;, \&quot;company\&quot;, \&quot;position\&quot;, \&quot;location\&quot;; (optional)
* @param fields Comma separated list of fields. Default: username, name, phone, email, joined, lastactive, avatar, company, position, location. Available fields: id, username, name, phone, email, url, about, role, joined, lastactive, avatar, company, position, location (optional)
* @param additionalHeaders additionalHeaders for this call
* @return List&lt;User&gt;
* @throws ApiException if fails to make API call
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@
* User
*/
@JsonPropertyOrder({
User.JSON_PROPERTY_ID,
User.JSON_PROPERTY_USERNAME,
User.JSON_PROPERTY_NAME,
User.JSON_PROPERTY_PHONE,
User.JSON_PROPERTY_EMAIL,
User.JSON_PROPERTY_ABOUT,
User.JSON_PROPERTY_ROLE,
User.JSON_PROPERTY_JOINED,
User.JSON_PROPERTY_LASTACTIVE,
User.JSON_PROPERTY_AVATAR,
Expand All @@ -44,6 +47,9 @@
})
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class User {
public static final String JSON_PROPERTY_ID = "id";
private String id;

public static final String JSON_PROPERTY_USERNAME = "username";
private String username;

Expand All @@ -56,6 +62,12 @@ public class User {
public static final String JSON_PROPERTY_EMAIL = "email";
private String email;

public static final String JSON_PROPERTY_ABOUT = "about";
private String about;

public static final String JSON_PROPERTY_ROLE = "role";
private String role;

public static final String JSON_PROPERTY_JOINED = "joined";
private String joined;

Expand All @@ -77,6 +89,32 @@ public class User {
public User() {
}

public User id(String id) {

this.id = id;
return this;
}

/**
* Get id
* @return id
**/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public String getId() {
return id;
}


@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setId(String id) {
this.id = id;
}


public User username(String username) {

this.username = username;
Expand Down Expand Up @@ -181,6 +219,58 @@ public void setEmail(String email) {
}


public User about(String about) {

this.about = about;
return this;
}

/**
* Get about
* @return about
**/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ABOUT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public String getAbout() {
return about;
}


@JsonProperty(JSON_PROPERTY_ABOUT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setAbout(String about) {
this.about = about;
}


public User role(String role) {

this.role = role;
return this;
}

/**
* Comma separated list of roles
* @return role
**/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ROLE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public String getRole() {
return role;
}


@JsonProperty(JSON_PROPERTY_ROLE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setRole(String role) {
this.role = role;
}


public User joined(String joined) {

this.joined = joined;
Expand Down Expand Up @@ -345,10 +435,13 @@ public boolean equals(Object o) {
return false;
}
User user = (User) o;
return Objects.equals(this.username, user.username) &&
return Objects.equals(this.id, user.id) &&
Objects.equals(this.username, user.username) &&
Objects.equals(this.name, user.name) &&
Objects.equals(this.phone, user.phone) &&
Objects.equals(this.email, user.email) &&
Objects.equals(this.about, user.about) &&
Objects.equals(this.role, user.role) &&
Objects.equals(this.joined, user.joined) &&
Objects.equals(this.lastactive, user.lastactive) &&
Objects.equals(this.avatar, user.avatar) &&
Expand All @@ -359,17 +452,20 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return Objects.hash(username, name, phone, email, joined, lastactive, avatar, company, position, location);
return Objects.hash(id, username, name, phone, email, about, role, joined, lastactive, avatar, company, position, location);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class User {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" username: ").append(toIndentedString(username)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" phone: ").append(toIndentedString(phone)).append("\n");
sb.append(" email: ").append(toIndentedString(email)).append("\n");
sb.append(" about: ").append(toIndentedString(about)).append("\n");
sb.append(" role: ").append(toIndentedString(role)).append("\n");
sb.append(" joined: ").append(toIndentedString(joined)).append("\n");
sb.append(" lastactive: ").append(toIndentedString(lastactive)).append("\n");
sb.append(" avatar: ").append(toIndentedString(avatar)).append("\n");
Expand Down Expand Up @@ -423,6 +519,16 @@ public String toUrlQueryString(String prefix) {

StringJoiner joiner = new StringJoiner("&");

// add `id` to the URL query string
if (getId() != null) {
try {
joiner.add(String.format("%sid%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getId()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
}
}

// add `username` to the URL query string
if (getUsername() != null) {
try {
Expand Down Expand Up @@ -463,6 +569,26 @@ public String toUrlQueryString(String prefix) {
}
}

// add `about` to the URL query string
if (getAbout() != null) {
try {
joiner.add(String.format("%sabout%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getAbout()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
}
}

// add `role` to the URL query string
if (getRole() != null) {
try {
joiner.add(String.format("%srole%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getRole()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
}
}

// add `joined` to the URL query string
if (getJoined() != null) {
try {
Expand Down