
open_rtb.BidResponseAvro Maven / Gradle / Ivy
/**
* Autogenerated by Avro
*
* DO NOT EDIT DIRECTLY
*/
package open_rtb;
/** 4.3.1 Bid Response Object
The top-level bid response object is defined below. The “id” attribute is a reflection of the bid request ID for logging purposes. Similarly, “bidid” is an optional response tracking ID for bidders. If specified, it can be included in the subsequent win notice call if the bidder wins. At least one “seatbid” object is required, which contains a bid on at least one impression. Other attributes are optional since an exchange may establish default values.
No-Bids on all impressions should be indicated as a HTTP 204 response. For no-bids on specific impressions, the bidder should omit these from the bid response. */
@org.apache.avro.specific.AvroGenerated
final public class BidResponseAvro extends org.apache.avro.specific.SpecificRecordBase {
/** ID of the bid request. */
org.apache.avro.util.Utf8 id;
/** Array of seatbid objects. */
org.apache.avro.generic.GenericData.Array seatbid;
/** Bid response ID to assist tracking for bidders. This value is chosen by the bidder for cross-reference. */
org.apache.avro.util.Utf8 bidid;
/** Bid currency using ISO-4217 alphabetic codes; default is “USD”. */
org.apache.avro.util.Utf8 cur;
/** This is an optional feature, which allows a bidder to set data in the exchange’s cookie. The string may be in base85 cookie safe characters, and be in any format. This may be useful for storing user features. Note: Proper JSON encoding must be used to include “escaped” quotation marks. */
org.apache.avro.util.Utf8 customdata;
/** Reason for not bidding. See Table 6.19 No-Bid Reason Codes. */
int nbr;
private boolean _frozen = false;
/** Default constructor, does not initialize fields to their default values from the schema. Only use this if you know what you are doing. */
public BidResponseAvro() {}
public BidResponseAvro freeze() {
_frozen = true;
seatbid.forEach(e -> e.freeze());
return this;
}
@Override
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
// Used by DatumWriter. Applications should not call.
@Override
public java.lang.Object get(int field$) {
switch (field$) {
case 0: return id;
case 1: return seatbid;
case 2: return bidid;
case 3: return cur;
case 4: return customdata;
case 5: return nbr;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
/** Writes record to Avro Encoder. */
public void encode(org.apache.avro.io.Encoder _encoder) throws java.io.IOException {
_encoder.writeString(id);
_encoder.writeArrayStart(); _encoder.setItemCount(seatbid.size()); for (open_rtb.SeatBidAvro e : seatbid) { e.encode(_encoder); } _encoder.writeArrayEnd();
_encoder.writeString(bidid);
_encoder.writeString(cur);
_encoder.writeString(customdata);
_encoder.writeInt(nbr);
}
// Used by DatumReader. Applications should not call.
@Override
@SuppressWarnings(value="unchecked")
public void put(int field$, java.lang.Object value$) {
if (_frozen) {
throw new org.apache.avro.AvroRuntimeException("this Anoa SpecificRecord instance has already been frozen.");
}
switch (field$) {
case 0: id = (org.apache.avro.util.Utf8) value$; break;
case 1: seatbid = (org.apache.avro.generic.GenericData.Array) value$; break;
case 2: bidid = (org.apache.avro.util.Utf8) value$; break;
case 3: cur = (org.apache.avro.util.Utf8) value$; break;
case 4: customdata = (org.apache.avro.util.Utf8) value$; break;
case 5: nbr = (int) value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
/** Reads record from Avro Decoder. */
public BidResponseAvro decode(org.apache.avro.io.Decoder _decoder) throws java.io.IOException {
if (_frozen) {
throw new org.apache.avro.AvroRuntimeException("this Anoa SpecificRecord instance has already been frozen.");
}
id = _decoder.readString(id);
long _i1 = _decoder.readArrayStart(); seatbid = new org.apache.avro.generic.GenericData.Array((int) _i1, SCHEMA$.getFields().get(1).schema()); for(; _i1 != 0; _i1 = _decoder.arrayNext()) { for (long _j1= 0; _j1 < _i1; _j1++) { seatbid.add(new open_rtb.SeatBidAvro().decode(_decoder)); } }
bidid = _decoder.readString(bidid);
cur = _decoder.readString(cur);
customdata = _decoder.readString(customdata);
nbr = _decoder.readInt();
return freeze();
}
/**
* RecordBuilder for Avro instances.
*/
static public class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase implements org.apache.avro.data.RecordBuilder {
private org.apache.avro.util.Utf8 id;
private org.apache.avro.generic.GenericData.Array seatbid;
private org.apache.avro.util.Utf8 bidid;
private org.apache.avro.util.Utf8 cur;
private org.apache.avro.util.Utf8 customdata;
private int nbr;
public Builder() {
super(BidResponseAvro.SCHEMA$);
}
public Builder(BidResponseAvro.Builder other) {
super(other);
if (isValidValue(fields()[0], other.id)) {
this.id = data().deepCopy(fields()[0].schema(), other.id);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.seatbid)) {
this.seatbid = data().deepCopy(fields()[1].schema(), other.seatbid);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.bidid)) {
this.bidid = data().deepCopy(fields()[2].schema(), other.bidid);
fieldSetFlags()[2] = true;
}
if (isValidValue(fields()[3], other.cur)) {
this.cur = data().deepCopy(fields()[3].schema(), other.cur);
fieldSetFlags()[3] = true;
}
if (isValidValue(fields()[4], other.customdata)) {
this.customdata = data().deepCopy(fields()[4].schema(), other.customdata);
fieldSetFlags()[4] = true;
}
if (isValidValue(fields()[5], other.nbr)) {
this.nbr = data().deepCopy(fields()[5].schema(), other.nbr);
fieldSetFlags()[5] = true;
}
}
public Builder(BidResponseAvro other) {
super(BidResponseAvro.SCHEMA$);
if (isValidValue(fields()[0], other.id)) {
this.id = data().deepCopy(fields()[0].schema(), other.id);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.seatbid)) {
this.seatbid = data().deepCopy(fields()[1].schema(), other.seatbid);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.bidid)) {
this.bidid = data().deepCopy(fields()[2].schema(), other.bidid);
fieldSetFlags()[2] = true;
}
if (isValidValue(fields()[3], other.cur)) {
this.cur = data().deepCopy(fields()[3].schema(), other.cur);
fieldSetFlags()[3] = true;
}
if (isValidValue(fields()[4], other.customdata)) {
this.customdata = data().deepCopy(fields()[4].schema(), other.customdata);
fieldSetFlags()[4] = true;
}
if (isValidValue(fields()[5], other.nbr)) {
this.nbr = data().deepCopy(fields()[5].schema(), other.nbr);
fieldSetFlags()[5] = true;
}
}
/** Gets the value of the 'id' field. */
public org.apache.avro.util.Utf8 getId() {
return id;
}
/** Sets the value of the 'id' field. */
public BidResponseAvro.Builder setId(org.apache.avro.util.Utf8 value) {
validate(fields()[0], value);
this.id = value;
fieldSetFlags()[0] = true;
return this;
}
/** Checks whether the 'id' field has been set. */
public boolean hasId() {
return fieldSetFlags()[0];
}
/** Clears the value of the 'id' field. */
public BidResponseAvro.Builder clearId() {
id = null;
fieldSetFlags()[0] = false;
return this;
}
/** Gets the value of the 'seatbid' field. */
public org.apache.avro.generic.GenericData.Array getSeatbid() {
return seatbid;
}
/** Sets the value of the 'seatbid' field. */
public BidResponseAvro.Builder setSeatbid(org.apache.avro.generic.GenericData.Array value) {
validate(fields()[1], value);
this.seatbid = value;
fieldSetFlags()[1] = true;
return this;
}
/** Checks whether the 'seatbid' field has been set. */
public boolean hasSeatbid() {
return fieldSetFlags()[1];
}
/** Clears the value of the 'seatbid' field. */
public BidResponseAvro.Builder clearSeatbid() {
seatbid = null;
fieldSetFlags()[1] = false;
return this;
}
/** Gets the value of the 'bidid' field. */
public org.apache.avro.util.Utf8 getBidid() {
return bidid;
}
/** Sets the value of the 'bidid' field. */
public BidResponseAvro.Builder setBidid(org.apache.avro.util.Utf8 value) {
validate(fields()[2], value);
this.bidid = value;
fieldSetFlags()[2] = true;
return this;
}
/** Checks whether the 'bidid' field has been set. */
public boolean hasBidid() {
return fieldSetFlags()[2];
}
/** Clears the value of the 'bidid' field. */
public BidResponseAvro.Builder clearBidid() {
bidid = null;
fieldSetFlags()[2] = false;
return this;
}
/** Gets the value of the 'cur' field. */
public org.apache.avro.util.Utf8 getCur() {
return cur;
}
/** Sets the value of the 'cur' field. */
public BidResponseAvro.Builder setCur(org.apache.avro.util.Utf8 value) {
validate(fields()[3], value);
this.cur = value;
fieldSetFlags()[3] = true;
return this;
}
/** Checks whether the 'cur' field has been set. */
public boolean hasCur() {
return fieldSetFlags()[3];
}
/** Clears the value of the 'cur' field. */
public BidResponseAvro.Builder clearCur() {
cur = null;
fieldSetFlags()[3] = false;
return this;
}
/** Gets the value of the 'customdata' field. */
public org.apache.avro.util.Utf8 getCustomdata() {
return customdata;
}
/** Sets the value of the 'customdata' field. */
public BidResponseAvro.Builder setCustomdata(org.apache.avro.util.Utf8 value) {
validate(fields()[4], value);
this.customdata = value;
fieldSetFlags()[4] = true;
return this;
}
/** Checks whether the 'customdata' field has been set. */
public boolean hasCustomdata() {
return fieldSetFlags()[4];
}
/** Clears the value of the 'customdata' field. */
public BidResponseAvro.Builder clearCustomdata() {
customdata = null;
fieldSetFlags()[4] = false;
return this;
}
/** Gets the value of the 'nbr' field. */
public int getNbr() {
return nbr;
}
/** Sets the value of the 'nbr' field. */
public BidResponseAvro.Builder setNbr(int value) {
validate(fields()[5], value);
this.nbr = value;
fieldSetFlags()[5] = true;
return this;
}
/** Checks whether the 'nbr' field has been set. */
public boolean hasNbr() {
return fieldSetFlags()[5];
}
/** Clears the value of the 'nbr' field. */
public BidResponseAvro.Builder clearNbr() {
fieldSetFlags()[5] = false;
return this;
}
@Override
public BidResponseAvro build() {
final BidResponseAvro record;
try {
record = new BidResponseAvro();
record.id = fieldSetFlags()[0] ? this.id : (org.apache.avro.util.Utf8) defaultValue(fields()[0]);
record.seatbid = fieldSetFlags()[1] ? this.seatbid : (org.apache.avro.generic.GenericData.Array) defaultValue(fields()[1]);
record.bidid = fieldSetFlags()[2] ? this.bidid : (org.apache.avro.util.Utf8) defaultValue(fields()[2]);
record.cur = fieldSetFlags()[3] ? this.cur : (org.apache.avro.util.Utf8) defaultValue(fields()[3]);
record.customdata = fieldSetFlags()[4] ? this.customdata : (org.apache.avro.util.Utf8) defaultValue(fields()[4]);
record.nbr = fieldSetFlags()[5] ? this.nbr : (int) defaultValue(fields()[5]);
} catch (Exception e) {
throw new org.apache.avro.AvroRuntimeException(e);
}
return record.freeze();
}
}
/** Creates a new BidResponseAvro RecordBuilder. */
static public BidResponseAvro.Builder newBuilder() {
return new BidResponseAvro.Builder();
}
/** Creates a new BidResponseAvro RecordBuilder by copying an existing BidResponseAvro.Builder instance. */
static public BidResponseAvro.Builder newBuilder(BidResponseAvro.Builder other) {
return new BidResponseAvro.Builder(other);
}
/** Creates a new BidResponseAvro RecordBuilder by copying an existing BidResponseAvro instance. */
static public BidResponseAvro.Builder newBuilder(BidResponseAvro other) {
return new BidResponseAvro.Builder(other);
}
/** Returns Avro record schema. */
static public org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
static public final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"BidResponseAvro\",\"namespace\":\"open_rtb\",\"doc\":\"4.3.1 Bid Response Object\\nThe top-level bid response object is defined below. The “id” attribute is a reflection of the bid request ID for logging purposes. Similarly, “bidid” is an optional response tracking ID for bidders. If specified, it can be included in the subsequent win notice call if the bidder wins. At least one “seatbid” object is required, which contains a bid on at least one impression. Other attributes are optional since an exchange may establish default values.\\nNo-Bids on all impressions should be indicated as a HTTP 204 response. For no-bids on specific impressions, the bidder should omit these from the bid response.\",\"fields\":[{\"name\":\"id\",\"type\":\"string\",\"doc\":\"ID of the bid request.\",\"default\":\"\",\"ordinal_\":1},{\"name\":\"seatbid\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"SeatBidAvro\",\"doc\":\"4.3.2 Seat Bid Object\\nA bid response can contain multiple “seatbid” objects, each on behalf of a different bidder seat. Since a bid request can include multiple impressions, each “seatbid” object can contain multiple bids each pertaining to a different impression on behalf of a seat. Thus, each “bid” object must include the impression ID to which it pertains as well as the bid price. The “group” attribute can be used to specify if a seat is willing to accept any impressions that it can win (default) or if it is only interested in winning any if it can win them all (i.e., all or nothing).\",\"fields\":[{\"name\":\"bid\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"BidAvro\",\"doc\":\"4.3.3 Bid Object\\nFor each bid, the “nurl” attribute contains the win notice URL. If the bidder wins the impression, the exchange calls this notice URL a) to inform the bidder of the win and b) to convey certain information using substitution macros (see Section 4.6 Substitution Macros).\\nThe “adomain” attribute can be used to check advertiser block list compliance. The “iurl” attribute can provide a link to an image that is representative of the campaign’s content (irrespective of whether the campaign may have multiple creatives). This enables human review for spotting inappropriate content. The “cid” attribute can be used to block ads that were previously identified as inappropriate; essentially a safety net beyond the block lists. The “crid” attribute can be helpful in reporting creative issues back to bidders. Finally, the “attr” array indicates the creative attributes that describe the ad to be served.\\nBEST PRACTICE: Substitution macros may allow a bidder to use a static notice URL for all of its bids. Thus, exchanges should offer the option of a default notice URL that can be pre- configured per bidder to reduce redundant data transfer.\",\"fields\":[{\"name\":\"id\",\"type\":\"string\",\"doc\":\"ID for the bid object chosen by the bidder for tracking and debugging purposes. Useful when multiple bids are submitted for a single impression for a given seat.\",\"default\":\"\",\"ordinal_\":1},{\"name\":\"impid\",\"type\":\"string\",\"doc\":\"ID of the impression object to which this bid applies.\",\"default\":\"\",\"ordinal_\":2},{\"name\":\"price\",\"type\":{\"type\":\"double\",\"min\":0.0},\"doc\":\"Bid price in CPM. WARNING/Best Practice Note: Although this value is a float, OpenRTB strongly suggests using integer math for accounting to avoid rounding errors.\",\"default\":0.0,\"ordinal_\":3},{\"name\":\"adid\",\"type\":\"string\",\"doc\":\"ID that references the ad to be served if the bid wins.\",\"default\":\"\",\"ordinal_\":4},{\"name\":\"nurl\",\"type\":\"string\",\"doc\":\"Win notice URL. Note that ad markup is also typically, but not necessarily, returned via this URL.\",\"default\":\"\",\"ordinal_\":5},{\"name\":\"adm\",\"type\":\"string\",\"doc\":\"Actual ad markup. XHTML if a response to a banner object, or VAST XML if a response to a video object.\",\"default\":\"\",\"ordinal_\":6},{\"name\":\"adomain\",\"type\":{\"type\":\"array\",\"items\":\"string\"},\"doc\":\"Advertiser’s primary or top-level domain for advertiser checking. This can be a list of domains if there is a rotating creative. However, exchanges may mandate that only one landing domain is allowed.\",\"default\":[],\"ordinal_\":7},{\"name\":\"lurl\",\"type\":\"string\",\"doc\":\"Sample image URL (without cache busting) for content checking.\",\"default\":\"\",\"ordinal_\":8},{\"name\":\"cid\",\"type\":\"string\",\"doc\":\"Campaign ID or similar that appears within the ad markup.\",\"default\":\"\",\"ordinal_\":9},{\"name\":\"crid\",\"type\":\"string\",\"doc\":\"Creative ID for reporting content issues or defects. This could also be used as a reference to a creative ID that is posted with an exchange.\",\"default\":\"\",\"ordinal_\":10},{\"name\":\"attr\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"int\",\"max\":255,\"min\":0}},\"doc\":\"Array of creative attributes. See Table 6.3 Creative Attributes.\",\"default\":[],\"ordinal_\":11},{\"name\":\"dealid\",\"type\":\"string\",\"doc\":\"A unique identifier for the direct deal associated with the bid. If the bid is associated and in response to a dealid in the request object it is _required_ in the response object.\",\"default\":\"\",\"ordinal_\":12},{\"name\":\"w\",\"type\":{\"type\":\"int\",\"max\":4294967295,\"min\":0},\"doc\":\"Width of the ad in pixels. If the bid request contained the wmax/hmax and wmin/hmin optional fields it is recommended that the response bid contains this field to signal the size of ad chosen.\",\"default\":0,\"ordinal_\":13},{\"name\":\"h\",\"type\":{\"type\":\"int\",\"max\":4294967295,\"min\":0},\"doc\":\"Height of the ad in pixels. If the bid request contained the wmax/hmax and wmin/hmin optional fields it is recommended that the response bid contains this field to signal the size of ad chosen.\",\"default\":0,\"ordinal_\":14}]}},\"doc\":\"Array of bid objects; each bid object relates to an imp object in the bid request. Note that, if supported by an exchange, one imp object can have many bid objects.\",\"default\":[],\"ordinal_\":1},{\"name\":\"seat\",\"type\":\"string\",\"doc\":\"ID of the bidder seat on whose behalf this bid is made.\",\"default\":\"\",\"ordinal_\":2},{\"name\":\"group\",\"type\":{\"type\":\"int\",\"max\":1,\"min\":0},\"doc\":\"“1” means impressions must be won-lost as a group; default is “0”.\",\"default\":0,\"ordinal_\":3}]}},\"doc\":\"Array of seatbid objects.\",\"default\":[],\"ordinal_\":2},{\"name\":\"bidid\",\"type\":\"string\",\"doc\":\"Bid response ID to assist tracking for bidders. This value is chosen by the bidder for cross-reference.\",\"default\":\"\",\"ordinal_\":3},{\"name\":\"cur\",\"type\":\"string\",\"doc\":\"Bid currency using ISO-4217 alphabetic codes; default is “USD”.\",\"default\":\"USD\",\"ordinal_\":4},{\"name\":\"customdata\",\"type\":\"string\",\"doc\":\"This is an optional feature, which allows a bidder to set data in the exchange’s cookie. The string may be in base85 cookie safe characters, and be in any format. This may be useful for storing user features. Note: Proper JSON encoding must be used to include “escaped” quotation marks.\",\"default\":\"\",\"ordinal_\":5},{\"name\":\"nbr\",\"type\":{\"type\":\"int\",\"max\":255,\"min\":0},\"doc\":\"Reason for not bidding. See Table 6.19 No-Bid Reason Codes.\",\"default\":0,\"ordinal_\":6}]}");
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy