forked from prebid/prebid-server-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Adapter.java
50 lines (43 loc) · 1.74 KB
/
Adapter.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package org.prebid.server.bidder;
import com.fasterxml.jackson.core.type.TypeReference;
import org.prebid.server.auction.model.AdapterRequest;
import org.prebid.server.auction.model.PreBidRequestContext;
import org.prebid.server.bidder.model.AdapterHttpRequest;
import org.prebid.server.bidder.model.ExchangeCall;
import org.prebid.server.exception.PreBidException;
import org.prebid.server.proto.response.Bid;
import java.util.List;
/**
* Describes the behavior for {@link Adapter} implementations.
* <p>
* Used by {@link HttpAdapterConnector} while performing requests to exchanges and compose results.
*/
public interface Adapter<T, R> {
/**
* Composes list of http request to submit to exchange.
*
* @throws PreBidException if error occurs while adUnitBids validation.
*/
List<AdapterHttpRequest<T>> makeHttpRequests(AdapterRequest adapterRequest,
PreBidRequestContext preBidRequestContext) throws PreBidException;
/**
* Extracts bids from exchange response.
*
* @throws PreBidException if error occurs while bids validation.
*/
List<Bid.BidBuilder> extractBids(AdapterRequest adapterRequest, ExchangeCall<T, R> exchangeCall)
throws PreBidException;
/**
* If true - {@link org.prebid.server.auction.model.AdapterResponse} will contain bids if at least one valid bid
* exists, otherwise will contain
* error.
* <p>
* If false - {@link org.prebid.server.auction.model.AdapterResponse} will contain error if at least one error
* occurs during processing.
*/
boolean tolerateErrors();
/**
* A class that will be used to parse response from exchange.
*/
TypeReference<R> responseTypeReference();
}