Skip to content

Commit

Permalink
Revert "[sc-50473] Enabled pixel client api key to be set by client a…
Browse files Browse the repository at this point in the history
…pi key."

This reverts commit 4858f8d.
  • Loading branch information
Simon Ramzi committed Sep 19, 2023
1 parent 4858f8d commit f236738
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@ class DecisionClient {
logger(
'warn',
'--------------------------------------------------------------\n' +
'--------------!!! WARNING - WARNING - WARNING !!!-------------\n' +
'' +
'You have opted to include explainer details with this request!\n' +
'This will cause performance degradation and should not be done\n' +
'in production environments.\n' +
'--------------------------------------------------------------'
'--------------!!! WARNING - WARNING - WARNING !!!-------------\n' +
'' +
'You have opted to include explainer details with this request!\n' +
'This will cause performance degradation and should not be done\n' +
'in production environments.\n' +
'--------------------------------------------------------------'
);

if (additionalOpts.desiredAds) {
Expand Down Expand Up @@ -295,22 +295,16 @@ class UserDbClient {
}
}

type PixelClientOptions = {
apiKey?: string;
}

class PixelClient {
private _fetch: FetchAPI;
private _agent: any;
private _logger: LoggerFunc;
private _options?: PixelClientOptions;
private _versionString: string;

constructor(fetch: FetchAPI, agent: any, logger: LoggerFunc, versionString: string, options?: PixelClientOptions) {
constructor(fetch: FetchAPI, agent: any, logger: LoggerFunc, versionString: string) {
this._fetch = fetch;
this._agent = agent;
this._logger = logger;
this._options = options;
this._versionString = versionString;
}

Expand Down Expand Up @@ -341,7 +335,7 @@ class PixelClient {
method: 'GET',
headers: {
'X-Adzerk-Sdk-Version': this._versionString,
'X-Kevel-ApiKey': additionalOpts?.apiKey ?? this._options?.apiKey,
'X-Kevel-ApiKey': additionalOpts?.apiKey,
'User-Agent': additionalOpts?.userAgent || 'OpenAPI-Generator/1.0/js',
},
redirect: 'manual',
Expand Down Expand Up @@ -458,7 +452,7 @@ export class Client {
adzerkApiKey
);
this._userDbClient = new UserDbClient(configuration, opts.networkId);
this._pixelClient = new PixelClient(fetch, this._agent, logger, versionString, { apiKey: adzerkApiKey });
this._pixelClient = new PixelClient(fetch, this._agent, logger, versionString);
}

get decisions(): DecisionClient {
Expand Down

0 comments on commit f236738

Please sign in to comment.