Files
plexjava/src/main/java/dev/plexapi/sdk/models/operations/GetLibraryDetailsRequest.java
2024-09-08 02:40:34 +00:00

200 lines
6.5 KiB
Java

/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
package dev.plexapi.sdk.models.operations;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.core.type.TypeReference;
import dev.plexapi.sdk.utils.LazySingletonValue;
import dev.plexapi.sdk.utils.SpeakeasyMetadata;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.util.Objects;
import java.util.Optional;
public class GetLibraryDetailsRequest {
/**
* The unique key of the Plex library.
* Note: This is unique in the context of the Plex server.
*
*/
@SpeakeasyMetadata("pathParam:style=simple,explode=false,name=sectionKey")
private int sectionKey;
/**
* Whether or not to include details for a section (types, filters, and sorts).
* Only exists for backwards compatibility, media providers other than the server libraries have it on always.
*
*/
@SpeakeasyMetadata("queryParam:style=form,explode=true,name=includeDetails")
private Optional<? extends IncludeDetails> includeDetails;
@JsonCreator
public GetLibraryDetailsRequest(
int sectionKey,
Optional<? extends IncludeDetails> includeDetails) {
Utils.checkNotNull(sectionKey, "sectionKey");
Utils.checkNotNull(includeDetails, "includeDetails");
this.sectionKey = sectionKey;
this.includeDetails = includeDetails;
}
public GetLibraryDetailsRequest(
int sectionKey) {
this(sectionKey, Optional.empty());
}
/**
* The unique key of the Plex library.
* Note: This is unique in the context of the Plex server.
*
*/
@JsonIgnore
public int sectionKey() {
return sectionKey;
}
/**
* Whether or not to include details for a section (types, filters, and sorts).
* Only exists for backwards compatibility, media providers other than the server libraries have it on always.
*
*/
@SuppressWarnings("unchecked")
@JsonIgnore
public Optional<IncludeDetails> includeDetails() {
return (Optional<IncludeDetails>) includeDetails;
}
public final static Builder builder() {
return new Builder();
}
/**
* The unique key of the Plex library.
* Note: This is unique in the context of the Plex server.
*
*/
public GetLibraryDetailsRequest withSectionKey(int sectionKey) {
Utils.checkNotNull(sectionKey, "sectionKey");
this.sectionKey = sectionKey;
return this;
}
/**
* Whether or not to include details for a section (types, filters, and sorts).
* Only exists for backwards compatibility, media providers other than the server libraries have it on always.
*
*/
public GetLibraryDetailsRequest withIncludeDetails(IncludeDetails includeDetails) {
Utils.checkNotNull(includeDetails, "includeDetails");
this.includeDetails = Optional.ofNullable(includeDetails);
return this;
}
/**
* Whether or not to include details for a section (types, filters, and sorts).
* Only exists for backwards compatibility, media providers other than the server libraries have it on always.
*
*/
public GetLibraryDetailsRequest withIncludeDetails(Optional<? extends IncludeDetails> includeDetails) {
Utils.checkNotNull(includeDetails, "includeDetails");
this.includeDetails = includeDetails;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
GetLibraryDetailsRequest other = (GetLibraryDetailsRequest) o;
return
Objects.deepEquals(this.sectionKey, other.sectionKey) &&
Objects.deepEquals(this.includeDetails, other.includeDetails);
}
@Override
public int hashCode() {
return Objects.hash(
sectionKey,
includeDetails);
}
@Override
public String toString() {
return Utils.toString(GetLibraryDetailsRequest.class,
"sectionKey", sectionKey,
"includeDetails", includeDetails);
}
public final static class Builder {
private Integer sectionKey;
private Optional<? extends IncludeDetails> includeDetails;
private Builder() {
// force use of static builder() method
}
/**
* The unique key of the Plex library.
* Note: This is unique in the context of the Plex server.
*
*/
public Builder sectionKey(int sectionKey) {
Utils.checkNotNull(sectionKey, "sectionKey");
this.sectionKey = sectionKey;
return this;
}
/**
* Whether or not to include details for a section (types, filters, and sorts).
* Only exists for backwards compatibility, media providers other than the server libraries have it on always.
*
*/
public Builder includeDetails(IncludeDetails includeDetails) {
Utils.checkNotNull(includeDetails, "includeDetails");
this.includeDetails = Optional.ofNullable(includeDetails);
return this;
}
/**
* Whether or not to include details for a section (types, filters, and sorts).
* Only exists for backwards compatibility, media providers other than the server libraries have it on always.
*
*/
public Builder includeDetails(Optional<? extends IncludeDetails> includeDetails) {
Utils.checkNotNull(includeDetails, "includeDetails");
this.includeDetails = includeDetails;
return this;
}
public GetLibraryDetailsRequest build() {
if (includeDetails == null) {
includeDetails = _SINGLETON_VALUE_IncludeDetails.value();
} return new GetLibraryDetailsRequest(
sectionKey,
includeDetails);
}
private static final LazySingletonValue<Optional<? extends IncludeDetails>> _SINGLETON_VALUE_IncludeDetails =
new LazySingletonValue<>(
"includeDetails",
"0",
new TypeReference<Optional<? extends IncludeDetails>>() {});
}
}