Skip to content

Commit

Permalink
feat: update sell Marketing API v1.17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dantio committed Oct 8, 2023
1 parent 91725b4 commit c3acbfb
Show file tree
Hide file tree
Showing 7 changed files with 3,129 additions and 252 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ It supports `client credentials grant` and `authorization code grant` \(Auth'N'A
| **Commerce API** | ✔ Catalog API<br>✔ Charity API `v1.2.0`<br>✔ Identity API<br>✔ Notification API `v1.2.0`<br>✔ Taxonomy API `v1.0.0`<br>✔ Translation API `v1_beta.1.4` |
| **Developer API** | ✔ Analytics API |
| **Post Order API** | ✔ Cancellation API<br>✔ Case Management API<br>✔ Inquiry API<br>✔ Return API |
| **Sell API** | ✔ Account API `v1.9.0`<br>✔ Analytics API `v1.3.0`<br>✔ Compliance API `v1.4.1`<br>✔ Feed API<br>✔ Finance API `v1.9.0`<br>✔ Fulfillment API `v1.19.10`<br>✔ Inventory API `v1.14.0`<br>✔ Listing API<br>✔ Logistics API<br>✔ Marketing API `v1.14.0`<br>✔ Metadata API<br>✔ Negotiation API `v1.1.0`<br>✔ Recommendation API `v1.1.0` |
| **Sell API** | ✔ Account API `v1.9.0`<br>✔ Analytics API `v1.3.0`<br>✔ Compliance API `v1.4.1`<br>✔ Feed API<br>✔ Finance API `v1.9.0`<br>✔ Fulfillment API `v1.19.10`<br>✔ Inventory API `v1.14.0`<br>✔ Listing API<br>✔ Logistics API<br>✔ Marketing API `v1.17.0`<br>✔ Metadata API<br>✔ Negotiation API `v1.1.0`<br>✔ Recommendation API `v1.1.0` |

### Traditional API

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"prerelease": "npm run tslint && npm run test && npm run build",
"release": "standard-version",
"rc": "npm run release -- --prerelease RC && git push --follow-tags origin next",
"gen-openai": "npx openapi-typescript \"specs/*.json\" --output src/types/restful/"
"gen-openapi": "npx openapi-typescript \"specs/*.json\" --output src/types/restful/"
},
"dependencies": {
"axios": "^1.2.1",
Expand Down
2,468 changes: 2,275 additions & 193 deletions specs/sell_marketing_v1_oas3.json

Large diffs are not rendered by default.

101 changes: 101 additions & 0 deletions src/api/restful/sell/marketing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,21 @@ import {
CreateAdRequest,
CreateAdsByInventoryReferenceRequest,
CreateCampaignRequest,
CreateEmailCampaignRequest,
CreateKeywordRequest,
CreateNegativeKeywordRequest,
CreateReportTask,
ItemPriceMarkdown,
ItemPromotion,
QuickSetupRequest,
TargetedBidRequest,
TargetedKeywordRequest,
UpdateAdGroupRequest,
UpdateAdrateStrategyRequest,
UpdateBidPercentageRequest,
UpdateCampaignBudgetRequest,
UpdateCampaignIdentificationRequest,
UpdateCampaignRequest,
UpdateKeywordRequest,
UpdateNegativeKeywordRequest
} from '../../../../types/index.js';
Expand Down Expand Up @@ -147,6 +150,23 @@ export default class Marketing extends Restful implements OpenApi<operations> {
return this.post(`/ad_campaign/${campaignId}/bulk_update_ads_status_by_listing_id`, body);
}

/**
* This method launches a Promoted Listings Advanced campaign.
* @param campaignId teh campaign id
*/
public launchCampaign(campaignId: string) {
campaignId = encodeURIComponent(campaignId);
return this.post(`/ad_campaign/${campaignId}/launch`);
}

/**
* This method allows the seller to expedite the creation of a Promoted Listings Advanced (PLA) campaign.
* @param body This type defines the fields to create a quick setup Promoted Listings Advanced (PLA) campaign.
*/
public setupQuickCampaign(body: QuickSetupRequest) {
return this.post(`/ad_campaign/setup_quick_campaign`, body);
}

/**
* This method retrieves all the ads for the specified campaign.
*
Expand Down Expand Up @@ -1012,4 +1032,85 @@ export default class Marketing extends Restful implements OpenApi<operations> {
}
});
}

/**
* This method returns the details of a single email campaign specified by the <b>email_campaign_id</b> path parameter.
*/
public getEmailCampaign(emailCampaignId: string) {
emailCampaignId = encodeURIComponent(emailCampaignId);
return this.get(`/email_campaign/${emailCampaignId}`);
}

/**
* This method retrieves a list of email campaigns from a seller's eBay store.
*/
public getEmailCampaigns({limit, q, offset, sort}:
{ limit?: number, q?: string, offset?: number, sort?: string } = {}) {
return this.get(`/email_campaign`, {
params: {
limit,
offset,
q,
sort
}
});
}

/**
* This method creates a new email campaign.
* @param body Create a new email campaign request.
*/
public createEmailCampaign(body: CreateEmailCampaignRequest) {
return this.post(`/email_campaign`, body);
}

/**
* This method lets users update an existing email campaign.
* @param emailCampaignId the email campaign id
* @param body the UpdateCampaignRequest
*/
public updateEmailCampaign(emailCampaignId: string, body: UpdateCampaignRequest) {
emailCampaignId = encodeURIComponent(emailCampaignId);
return this.put(`/email_campaign/${emailCampaignId}`, body);
}

/**
* This method deletes the email campaign specified by the <b>email_campaign_id</b> path parameter.
* @param emailCampaignId the email campaign id
*/
public deleteEmailCampaign(emailCampaignId: string) {
emailCampaignId = encodeURIComponent(emailCampaignId);
return this.delete(`/email_campaign/${emailCampaignId}`);
}

/**
* This method returns a preview of the email sent by the email campaign indicated by the <b>email_campaign_id</b> path parameter.
* @param emailCampaignId the email campaign id
*/
public getEmailPreview(emailCampaignId: string) {
emailCampaignId = encodeURIComponent(emailCampaignId);
return this.get(`/email_campaign/${emailCampaignId}/email_preview`);
}

/**
* This method retrieves all available email newsletter audiences.
*/
public getAudiences() {
return this.get(`/email_campaign/audience`);
};

/**
* This method returns the seller's email campaign performance report for a time period specified by the <b>startDate</b> and <b>endDate</b> path parameters.
* @param startDate The start date for the report, given in UTC format. The maximum date range for a report retrieved by this method is one year.
* @param endDate The end date for the report, given in UTC format. The maximum date range for a report retrieved by this method is one year.
*/
public getEmailReport(startDate: string, endDate: string) {
return this.get(`/email_campaign/report`, {
params: {
startDate,
endDate
}
});
}

}
Loading

0 comments on commit c3acbfb

Please sign in to comment.