Skip to content

Commit

Permalink
Add support for planetApiKey when fetching thumbnail
Browse files Browse the repository at this point in the history
  • Loading branch information
mitjak committed Dec 13, 2023
1 parent 4fdb544 commit 8fea5af
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/dataimport/TPDI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ export class TPDI {
public static async getThumbnail(
collectionId: TPDICollections,
productId: string,
planetApiKey?: string,
reqConfig?: RequestConfiguration,
): Promise<Blob> {
if (!collectionId) {
Expand All @@ -228,8 +229,13 @@ export class TPDI {
const requestConfig: AxiosRequestConfig = createRequestConfig(innerReqConfig);
requestConfig.responseType = 'blob';

const params = new URLSearchParams();
if (planetApiKey) {
params.set('planetApiKey', planetApiKey);
}

const response = await axios.get<Blob>(
`${TPDI_SERVICE_URL}/collections/${collectionId}/products/${productId}/thumbnail`,
`${TPDI_SERVICE_URL}/collections/${collectionId}/products/${productId}/thumbnail?${params.toString()}`,
requestConfig,
);
const thumbnail = response.data;
Expand Down

0 comments on commit 8fea5af

Please sign in to comment.