001package com.box.sdkgen.schemas.searchresultwithsharedlink; 002 003import com.box.sdkgen.internal.NullableFieldTracker; 004import com.box.sdkgen.internal.SerializableObject; 005import com.box.sdkgen.schemas.filefull.FileFull; 006import com.box.sdkgen.schemas.folderfull.FolderFull; 007import com.box.sdkgen.schemas.searchresultwithsharedlinkitem.SearchResultWithSharedLinkItem; 008import com.box.sdkgen.schemas.weblink.WebLink; 009import com.fasterxml.jackson.annotation.JsonFilter; 010import com.fasterxml.jackson.annotation.JsonProperty; 011import java.util.Objects; 012 013/** 014 * A single of files, folder or web link that matched the search query, including the additional 015 * information about the shared link through which the item has been shared with the user. 016 * 017 * <p>This response format is only returned when the `include_recent_shared_links` query parameter 018 * has been set to `true`. 019 */ 020@JsonFilter("nullablePropertyFilter") 021public class SearchResultWithSharedLink extends SerializableObject { 022 023 /** 024 * The optional shared link through which the user has access to this item. This value is only 025 * returned for items for which the user has recently accessed the file through a shared link. For 026 * all other items this value will return `null`. 027 */ 028 @JsonProperty("accessible_via_shared_link") 029 protected String accessibleViaSharedLink; 030 031 protected SearchResultWithSharedLinkItem item; 032 033 /** The result type. The value is always `search_result`. */ 034 protected String type; 035 036 public SearchResultWithSharedLink() { 037 super(); 038 } 039 040 protected SearchResultWithSharedLink(Builder builder) { 041 super(); 042 this.accessibleViaSharedLink = builder.accessibleViaSharedLink; 043 this.item = builder.item; 044 this.type = builder.type; 045 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 046 } 047 048 public String getAccessibleViaSharedLink() { 049 return accessibleViaSharedLink; 050 } 051 052 public SearchResultWithSharedLinkItem getItem() { 053 return item; 054 } 055 056 public String getType() { 057 return type; 058 } 059 060 @Override 061 public boolean equals(Object o) { 062 if (this == o) { 063 return true; 064 } 065 if (o == null || getClass() != o.getClass()) { 066 return false; 067 } 068 SearchResultWithSharedLink casted = (SearchResultWithSharedLink) o; 069 return Objects.equals(accessibleViaSharedLink, casted.accessibleViaSharedLink) 070 && Objects.equals(item, casted.item) 071 && Objects.equals(type, casted.type); 072 } 073 074 @Override 075 public int hashCode() { 076 return Objects.hash(accessibleViaSharedLink, item, type); 077 } 078 079 @Override 080 public String toString() { 081 return "SearchResultWithSharedLink{" 082 + "accessibleViaSharedLink='" 083 + accessibleViaSharedLink 084 + '\'' 085 + ", " 086 + "item='" 087 + item 088 + '\'' 089 + ", " 090 + "type='" 091 + type 092 + '\'' 093 + "}"; 094 } 095 096 public static class Builder extends NullableFieldTracker { 097 098 protected String accessibleViaSharedLink; 099 100 protected SearchResultWithSharedLinkItem item; 101 102 protected String type; 103 104 public Builder accessibleViaSharedLink(String accessibleViaSharedLink) { 105 this.accessibleViaSharedLink = accessibleViaSharedLink; 106 return this; 107 } 108 109 public Builder item(FileFull item) { 110 this.item = new SearchResultWithSharedLinkItem(item); 111 return this; 112 } 113 114 public Builder item(FolderFull item) { 115 this.item = new SearchResultWithSharedLinkItem(item); 116 return this; 117 } 118 119 public Builder item(WebLink item) { 120 this.item = new SearchResultWithSharedLinkItem(item); 121 return this; 122 } 123 124 public Builder item(SearchResultWithSharedLinkItem item) { 125 this.item = item; 126 return this; 127 } 128 129 public Builder type(String type) { 130 this.type = type; 131 return this; 132 } 133 134 public SearchResultWithSharedLink build() { 135 return new SearchResultWithSharedLink(this); 136 } 137 } 138}