/* * 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 dev.plexapi.sdk.utils.SpeakeasyMetadata; import dev.plexapi.sdk.utils.Utils; import java.lang.Long; import java.lang.Override; import java.lang.String; import java.util.Objects; import java.util.Optional; public class PostMediaPosterRequest { /** * the id of the library item to return the posters of. */ @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=ratingKey") private long ratingKey; /** * The URL of the image, if uploading a remote image */ @SpeakeasyMetadata("queryParam:style=form,explode=true,name=url") private Optional url; /** * The contents of the image, if uploading a local file */ @SpeakeasyMetadata("request:mediaType=image/*") private Optional requestBody; @JsonCreator public PostMediaPosterRequest( long ratingKey, Optional url, Optional requestBody) { Utils.checkNotNull(ratingKey, "ratingKey"); Utils.checkNotNull(url, "url"); Utils.checkNotNull(requestBody, "requestBody"); this.ratingKey = ratingKey; this.url = url; this.requestBody = requestBody; } public PostMediaPosterRequest( long ratingKey) { this(ratingKey, Optional.empty(), Optional.empty()); } /** * the id of the library item to return the posters of. */ @JsonIgnore public long ratingKey() { return ratingKey; } /** * The URL of the image, if uploading a remote image */ @JsonIgnore public Optional url() { return url; } /** * The contents of the image, if uploading a local file */ @JsonIgnore public Optional requestBody() { return requestBody; } public final static Builder builder() { return new Builder(); } /** * the id of the library item to return the posters of. */ public PostMediaPosterRequest withRatingKey(long ratingKey) { Utils.checkNotNull(ratingKey, "ratingKey"); this.ratingKey = ratingKey; return this; } /** * The URL of the image, if uploading a remote image */ public PostMediaPosterRequest withUrl(String url) { Utils.checkNotNull(url, "url"); this.url = Optional.ofNullable(url); return this; } /** * The URL of the image, if uploading a remote image */ public PostMediaPosterRequest withUrl(Optional url) { Utils.checkNotNull(url, "url"); this.url = url; return this; } /** * The contents of the image, if uploading a local file */ public PostMediaPosterRequest withRequestBody(byte[] requestBody) { Utils.checkNotNull(requestBody, "requestBody"); this.requestBody = Optional.ofNullable(requestBody); return this; } /** * The contents of the image, if uploading a local file */ public PostMediaPosterRequest withRequestBody(Optional requestBody) { Utils.checkNotNull(requestBody, "requestBody"); this.requestBody = requestBody; return this; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PostMediaPosterRequest other = (PostMediaPosterRequest) o; return Objects.deepEquals(this.ratingKey, other.ratingKey) && Objects.deepEquals(this.url, other.url) && Objects.deepEquals(this.requestBody, other.requestBody); } @Override public int hashCode() { return Objects.hash( ratingKey, url, requestBody); } @Override public String toString() { return Utils.toString(PostMediaPosterRequest.class, "ratingKey", ratingKey, "url", url, "requestBody", requestBody); } public final static class Builder { private Long ratingKey; private Optional url = Optional.empty(); private Optional requestBody = Optional.empty(); private Builder() { // force use of static builder() method } /** * the id of the library item to return the posters of. */ public Builder ratingKey(long ratingKey) { Utils.checkNotNull(ratingKey, "ratingKey"); this.ratingKey = ratingKey; return this; } /** * The URL of the image, if uploading a remote image */ public Builder url(String url) { Utils.checkNotNull(url, "url"); this.url = Optional.ofNullable(url); return this; } /** * The URL of the image, if uploading a remote image */ public Builder url(Optional url) { Utils.checkNotNull(url, "url"); this.url = url; return this; } /** * The contents of the image, if uploading a local file */ public Builder requestBody(byte[] requestBody) { Utils.checkNotNull(requestBody, "requestBody"); this.requestBody = Optional.ofNullable(requestBody); return this; } /** * The contents of the image, if uploading a local file */ public Builder requestBody(Optional requestBody) { Utils.checkNotNull(requestBody, "requestBody"); this.requestBody = requestBody; return this; } public PostMediaPosterRequest build() { return new PostMediaPosterRequest( ratingKey, url, requestBody); } } }