/* * 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.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import dev.plexapi.sdk.utils.LazySingletonValue; import dev.plexapi.sdk.utils.Utils; import java.lang.Boolean; import java.lang.Integer; import java.lang.Long; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; import java.util.List; import java.util.Objects; import java.util.Optional; public class Part { @JsonProperty("id") private int id; @JsonProperty("key") private String key; @JsonInclude(Include.NON_ABSENT) @JsonProperty("duration") private Optional duration; @JsonProperty("file") private String file; @JsonProperty("size") private long size; /** * The container format of the media file. * */ @JsonProperty("container") private String container; @JsonInclude(Include.NON_ABSENT) @JsonProperty("audioProfile") private Optional audioProfile; @JsonInclude(Include.NON_ABSENT) @JsonProperty("has64bitOffsets") private Optional has64bitOffsets; @JsonInclude(Include.NON_ABSENT) @JsonProperty("optimizedForStreaming") private Optional optimizedForStreaming; @JsonInclude(Include.NON_ABSENT) @JsonProperty("videoProfile") private Optional videoProfile; @JsonInclude(Include.NON_ABSENT) @JsonProperty("indexes") private Optional indexes; @JsonInclude(Include.NON_ABSENT) @JsonProperty("hasThumbnail") private Optional hasThumbnail; @JsonInclude(Include.NON_ABSENT) @JsonProperty("Stream") private Optional> stream; @JsonCreator public Part( @JsonProperty("id") int id, @JsonProperty("key") String key, @JsonProperty("duration") Optional duration, @JsonProperty("file") String file, @JsonProperty("size") long size, @JsonProperty("container") String container, @JsonProperty("audioProfile") Optional audioProfile, @JsonProperty("has64bitOffsets") Optional has64bitOffsets, @JsonProperty("optimizedForStreaming") Optional optimizedForStreaming, @JsonProperty("videoProfile") Optional videoProfile, @JsonProperty("indexes") Optional indexes, @JsonProperty("hasThumbnail") Optional hasThumbnail, @JsonProperty("Stream") Optional> stream) { Utils.checkNotNull(id, "id"); Utils.checkNotNull(key, "key"); Utils.checkNotNull(duration, "duration"); Utils.checkNotNull(file, "file"); Utils.checkNotNull(size, "size"); Utils.checkNotNull(container, "container"); Utils.checkNotNull(audioProfile, "audioProfile"); Utils.checkNotNull(has64bitOffsets, "has64bitOffsets"); Utils.checkNotNull(optimizedForStreaming, "optimizedForStreaming"); Utils.checkNotNull(videoProfile, "videoProfile"); Utils.checkNotNull(indexes, "indexes"); Utils.checkNotNull(hasThumbnail, "hasThumbnail"); Utils.checkNotNull(stream, "stream"); this.id = id; this.key = key; this.duration = duration; this.file = file; this.size = size; this.container = container; this.audioProfile = audioProfile; this.has64bitOffsets = has64bitOffsets; this.optimizedForStreaming = optimizedForStreaming; this.videoProfile = videoProfile; this.indexes = indexes; this.hasThumbnail = hasThumbnail; this.stream = stream; } public Part( int id, String key, String file, long size, String container) { this(id, key, Optional.empty(), file, size, container, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); } @JsonIgnore public int id() { return id; } @JsonIgnore public String key() { return key; } @JsonIgnore public Optional duration() { return duration; } @JsonIgnore public String file() { return file; } @JsonIgnore public long size() { return size; } /** * The container format of the media file. * */ @JsonIgnore public String container() { return container; } @JsonIgnore public Optional audioProfile() { return audioProfile; } @JsonIgnore public Optional has64bitOffsets() { return has64bitOffsets; } @JsonIgnore public Optional optimizedForStreaming() { return optimizedForStreaming; } @JsonIgnore public Optional videoProfile() { return videoProfile; } @JsonIgnore public Optional indexes() { return indexes; } @SuppressWarnings("unchecked") @JsonIgnore public Optional hasThumbnail() { return (Optional) hasThumbnail; } @SuppressWarnings("unchecked") @JsonIgnore public Optional> stream() { return (Optional>) stream; } public final static Builder builder() { return new Builder(); } public Part withId(int id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } public Part withKey(String key) { Utils.checkNotNull(key, "key"); this.key = key; return this; } public Part withDuration(int duration) { Utils.checkNotNull(duration, "duration"); this.duration = Optional.ofNullable(duration); return this; } public Part withDuration(Optional duration) { Utils.checkNotNull(duration, "duration"); this.duration = duration; return this; } public Part withFile(String file) { Utils.checkNotNull(file, "file"); this.file = file; return this; } public Part withSize(long size) { Utils.checkNotNull(size, "size"); this.size = size; return this; } /** * The container format of the media file. * */ public Part withContainer(String container) { Utils.checkNotNull(container, "container"); this.container = container; return this; } public Part withAudioProfile(String audioProfile) { Utils.checkNotNull(audioProfile, "audioProfile"); this.audioProfile = Optional.ofNullable(audioProfile); return this; } public Part withAudioProfile(Optional audioProfile) { Utils.checkNotNull(audioProfile, "audioProfile"); this.audioProfile = audioProfile; return this; } public Part withHas64bitOffsets(boolean has64bitOffsets) { Utils.checkNotNull(has64bitOffsets, "has64bitOffsets"); this.has64bitOffsets = Optional.ofNullable(has64bitOffsets); return this; } public Part withHas64bitOffsets(Optional has64bitOffsets) { Utils.checkNotNull(has64bitOffsets, "has64bitOffsets"); this.has64bitOffsets = has64bitOffsets; return this; } public Part withOptimizedForStreaming(boolean optimizedForStreaming) { Utils.checkNotNull(optimizedForStreaming, "optimizedForStreaming"); this.optimizedForStreaming = Optional.ofNullable(optimizedForStreaming); return this; } public Part withOptimizedForStreaming(Optional optimizedForStreaming) { Utils.checkNotNull(optimizedForStreaming, "optimizedForStreaming"); this.optimizedForStreaming = optimizedForStreaming; return this; } public Part withVideoProfile(String videoProfile) { Utils.checkNotNull(videoProfile, "videoProfile"); this.videoProfile = Optional.ofNullable(videoProfile); return this; } public Part withVideoProfile(Optional videoProfile) { Utils.checkNotNull(videoProfile, "videoProfile"); this.videoProfile = videoProfile; return this; } public Part withIndexes(String indexes) { Utils.checkNotNull(indexes, "indexes"); this.indexes = Optional.ofNullable(indexes); return this; } public Part withIndexes(Optional indexes) { Utils.checkNotNull(indexes, "indexes"); this.indexes = indexes; return this; } public Part withHasThumbnail(HasThumbnail hasThumbnail) { Utils.checkNotNull(hasThumbnail, "hasThumbnail"); this.hasThumbnail = Optional.ofNullable(hasThumbnail); return this; } public Part withHasThumbnail(Optional hasThumbnail) { Utils.checkNotNull(hasThumbnail, "hasThumbnail"); this.hasThumbnail = hasThumbnail; return this; } public Part withStream(List stream) { Utils.checkNotNull(stream, "stream"); this.stream = Optional.ofNullable(stream); return this; } public Part withStream(Optional> stream) { Utils.checkNotNull(stream, "stream"); this.stream = stream; return this; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Part other = (Part) o; return Objects.deepEquals(this.id, other.id) && Objects.deepEquals(this.key, other.key) && Objects.deepEquals(this.duration, other.duration) && Objects.deepEquals(this.file, other.file) && Objects.deepEquals(this.size, other.size) && Objects.deepEquals(this.container, other.container) && Objects.deepEquals(this.audioProfile, other.audioProfile) && Objects.deepEquals(this.has64bitOffsets, other.has64bitOffsets) && Objects.deepEquals(this.optimizedForStreaming, other.optimizedForStreaming) && Objects.deepEquals(this.videoProfile, other.videoProfile) && Objects.deepEquals(this.indexes, other.indexes) && Objects.deepEquals(this.hasThumbnail, other.hasThumbnail) && Objects.deepEquals(this.stream, other.stream); } @Override public int hashCode() { return Objects.hash( id, key, duration, file, size, container, audioProfile, has64bitOffsets, optimizedForStreaming, videoProfile, indexes, hasThumbnail, stream); } @Override public String toString() { return Utils.toString(Part.class, "id", id, "key", key, "duration", duration, "file", file, "size", size, "container", container, "audioProfile", audioProfile, "has64bitOffsets", has64bitOffsets, "optimizedForStreaming", optimizedForStreaming, "videoProfile", videoProfile, "indexes", indexes, "hasThumbnail", hasThumbnail, "stream", stream); } public final static class Builder { private Integer id; private String key; private Optional duration = Optional.empty(); private String file; private Long size; private String container; private Optional audioProfile = Optional.empty(); private Optional has64bitOffsets = Optional.empty(); private Optional optimizedForStreaming = Optional.empty(); private Optional videoProfile = Optional.empty(); private Optional indexes = Optional.empty(); private Optional hasThumbnail; private Optional> stream = Optional.empty(); private Builder() { // force use of static builder() method } public Builder id(int id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } public Builder key(String key) { Utils.checkNotNull(key, "key"); this.key = key; return this; } public Builder duration(int duration) { Utils.checkNotNull(duration, "duration"); this.duration = Optional.ofNullable(duration); return this; } public Builder duration(Optional duration) { Utils.checkNotNull(duration, "duration"); this.duration = duration; return this; } public Builder file(String file) { Utils.checkNotNull(file, "file"); this.file = file; return this; } public Builder size(long size) { Utils.checkNotNull(size, "size"); this.size = size; return this; } /** * The container format of the media file. * */ public Builder container(String container) { Utils.checkNotNull(container, "container"); this.container = container; return this; } public Builder audioProfile(String audioProfile) { Utils.checkNotNull(audioProfile, "audioProfile"); this.audioProfile = Optional.ofNullable(audioProfile); return this; } public Builder audioProfile(Optional audioProfile) { Utils.checkNotNull(audioProfile, "audioProfile"); this.audioProfile = audioProfile; return this; } public Builder has64bitOffsets(boolean has64bitOffsets) { Utils.checkNotNull(has64bitOffsets, "has64bitOffsets"); this.has64bitOffsets = Optional.ofNullable(has64bitOffsets); return this; } public Builder has64bitOffsets(Optional has64bitOffsets) { Utils.checkNotNull(has64bitOffsets, "has64bitOffsets"); this.has64bitOffsets = has64bitOffsets; return this; } public Builder optimizedForStreaming(boolean optimizedForStreaming) { Utils.checkNotNull(optimizedForStreaming, "optimizedForStreaming"); this.optimizedForStreaming = Optional.ofNullable(optimizedForStreaming); return this; } public Builder optimizedForStreaming(Optional optimizedForStreaming) { Utils.checkNotNull(optimizedForStreaming, "optimizedForStreaming"); this.optimizedForStreaming = optimizedForStreaming; return this; } public Builder videoProfile(String videoProfile) { Utils.checkNotNull(videoProfile, "videoProfile"); this.videoProfile = Optional.ofNullable(videoProfile); return this; } public Builder videoProfile(Optional videoProfile) { Utils.checkNotNull(videoProfile, "videoProfile"); this.videoProfile = videoProfile; return this; } public Builder indexes(String indexes) { Utils.checkNotNull(indexes, "indexes"); this.indexes = Optional.ofNullable(indexes); return this; } public Builder indexes(Optional indexes) { Utils.checkNotNull(indexes, "indexes"); this.indexes = indexes; return this; } public Builder hasThumbnail(HasThumbnail hasThumbnail) { Utils.checkNotNull(hasThumbnail, "hasThumbnail"); this.hasThumbnail = Optional.ofNullable(hasThumbnail); return this; } public Builder hasThumbnail(Optional hasThumbnail) { Utils.checkNotNull(hasThumbnail, "hasThumbnail"); this.hasThumbnail = hasThumbnail; return this; } public Builder stream(List stream) { Utils.checkNotNull(stream, "stream"); this.stream = Optional.ofNullable(stream); return this; } public Builder stream(Optional> stream) { Utils.checkNotNull(stream, "stream"); this.stream = stream; return this; } public Part build() { if (hasThumbnail == null) { hasThumbnail = _SINGLETON_VALUE_HasThumbnail.value(); } return new Part( id, key, duration, file, size, container, audioProfile, has64bitOffsets, optimizedForStreaming, videoProfile, indexes, hasThumbnail, stream); } private static final LazySingletonValue> _SINGLETON_VALUE_HasThumbnail = new LazySingletonValue<>( "hasThumbnail", "\"0\"", new TypeReference>() {}); } }