Skip to content

Commit

Permalink
Pass IntegrationApi to produceOffers
Browse files Browse the repository at this point in the history
  • Loading branch information
blingdahl authored and mryckman committed Mar 21, 2023
1 parent da78d2a commit 5d7eaff
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
Binary file added .DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion components/core/src/offerproducer/offerproducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

import {ListOffersPayload, Offer, OfferPatch} from 'opr-models';
import { IntegrationApi } from '../coreapi';
import {Pluggable} from '../integrations/pluggable';

export interface OfferSetUpdate {
Expand All @@ -31,5 +32,5 @@ export interface OfferProducer extends Pluggable {

readonly id: string;

produceOffers(payload: ListOffersPayload): Promise<OfferSetUpdate>;
produceOffers(payload: ListOffersPayload, integrationApi: IntegrationApi): Promise<OfferSetUpdate>;
}
3 changes: 2 additions & 1 deletion components/core/src/offerproducer/oprfeedproducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {OprNetworkClient} from '../net/oprnetworkclient';
import {Clock} from '../util/clock';
import {DefaultClock} from '../util/defaultclock';
import {StatusError} from '../util/statuserror';
import { IntegrationApi } from '../coreapi';

export class OprFeedProducer implements OfferProducer {
readonly type = 'offerProducer';
Expand All @@ -52,7 +53,7 @@ export class OprFeedProducer implements OfferProducer {
this.logger = logger;
}

async produceOffers(request: ListOffersPayload): Promise<OfferSetUpdate> {
async produceOffers(request: ListOffersPayload, integrationApi: IntegrationApi): Promise<OfferSetUpdate> {
const result = await this.client.list(this.organizationUrl, request);
let offers: AsyncIterable<Offer> | undefined;
let patchOps: AsyncIterable<OfferPatch> | undefined;
Expand Down
2 changes: 1 addition & 1 deletion components/core/src/server/oprtenantnode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export class OprTenantNode {
requestedResultFormat: 'SNAPSHOT',
};
}
result = await producer.produceOffers(listPayload);
result = await producer.produceOffers(listPayload, this.integrationApi);
nextRunTimestampUTC = result.earliestNextRequestUTC;
await this.offerModel.processUpdate(producer.id, result);
await this.offerModel.writeOfferProducerMetadata({
Expand Down

0 comments on commit 5d7eaff

Please sign in to comment.