github.com/prebid/prebid-server/v2@v2.18.0/stored_requests/backends/empty_fetcher/fetcher.go (about)

     1  package empty_fetcher
     2  
     3  import (
     4  	"context"
     5  	"encoding/json"
     6  
     7  	"github.com/prebid/prebid-server/v2/stored_requests"
     8  )
     9  
    10  // EmptyFetcher is a nil-object which has no Stored Requests.
    11  // If PBS is configured to use this, then all the OpenRTB request data must be sent in the HTTP request.
    12  type EmptyFetcher struct{}
    13  
    14  func (fetcher EmptyFetcher) FetchRequests(ctx context.Context, requestIDs []string, impIDs []string) (requestData map[string]json.RawMessage, impData map[string]json.RawMessage, errs []error) {
    15  	errs = make([]error, 0, len(requestIDs)+len(impIDs))
    16  	for _, id := range requestIDs {
    17  		errs = append(errs, stored_requests.NotFoundError{
    18  			ID:       id,
    19  			DataType: "Request",
    20  		})
    21  	}
    22  	for _, id := range impIDs {
    23  		errs = append(errs, stored_requests.NotFoundError{
    24  			ID:       id,
    25  			DataType: "Imp",
    26  		})
    27  	}
    28  	return
    29  }
    30  
    31  func (fetcher EmptyFetcher) FetchResponses(ctx context.Context, ids []string) (data map[string]json.RawMessage, errs []error) {
    32  	return nil, nil
    33  }
    34  
    35  func (fetcher EmptyFetcher) FetchAccount(ctx context.Context, accountDefaultJSON json.RawMessage, accountID string) (json.RawMessage, []error) {
    36  	return nil, []error{stored_requests.NotFoundError{ID: accountID, DataType: "Account"}}
    37  }
    38  
    39  func (fetcher EmptyFetcher) FetchCategories(ctx context.Context, primaryAdServer, publisherId, iabCategory string) (string, error) {
    40  	return "", nil
    41  }