Skip to content

Commit

Permalink
feat: implement openai spec operations
Browse files Browse the repository at this point in the history
  • Loading branch information
dantio committed Jul 14, 2023
1 parent afdd9c6 commit 035e8c8
Show file tree
Hide file tree
Showing 35 changed files with 138 additions and 113 deletions.
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
"standard-version": "^9.0.0",
"ts-node": "^10.8.0",
"tslint": "^6.1.0",
"typescript": "^4.9.3"
"typescript": "^5.1.6"
},
"repository": {
"type": "git",
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/api/restful/buy/browse/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {components, operations} from '../../../../types/restful/specs/buy_browse_v1_oas3.js';
import Restful from '../../index.js';
import Restful, {OpenApi} from '../../index.js';

/**
* The Browse API has the following resources: item_summary: Lets shoppers search for specific items by keyword, GTIN,
* category, charity, product, or item aspects and refine the results by using filters, such as aspects, compatibility,
* and fields values.
*/
export default class Browse extends Restful {
export default class Browse extends Restful implements OpenApi<operations> {

static id = 'Browse';

Expand Down
25 changes: 16 additions & 9 deletions src/api/restful/buy/deal/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import Restful from '../../index.js';
import {operations} from '../../../../types/restful/specs/buy_deal_v1_oas3.js';
import Restful, {OpenApi} from '../../index.js';

/**
* This API allows third-party developers to search for and retrieve details about eBay deals and events, as well as the items associated with those deals and events.
*/
export default class Deal extends Restful {
export default class Deal extends Restful implements OpenApi<operations> {

static id = 'Deal';

Expand All @@ -21,12 +22,18 @@ export default class Deal extends Restful {
* @param offset The number of items that will be skipped in the result set.
*/
public getDealItems({
categoryIds,
commissionable,
deliveryCountry,
limit,
offset
}: { categoryIds?: string, commissionable?: string, deliveryCountry?: string, limit?: string, offset?: string }) {
categoryIds,
commissionable,
deliveryCountry,
limit,
offset
}: {
categoryIds?: string,
commissionable?: string,
deliveryCountry?: string,
limit?: string,
offset?: string
}) {
return this.get(`/deal_item`, {
params: {
category_ids: categoryIds,
Expand All @@ -44,7 +51,7 @@ export default class Deal extends Restful {
* @param eventId The unique identifier for the eBay event.
*/
public getEvent(eventId: string) {
eventId = encodeURIComponent(eventId)
eventId = encodeURIComponent(eventId);
return this.get(`/event/${eventId}`);
}

Expand Down
5 changes: 3 additions & 2 deletions src/api/restful/buy/feed/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import Restful from '../../index.js';
import {BuyFeedParams} from '../../../../types/index.js';
import {operations} from '../../../../types/restful/specs/buy_feed_v1_beta_oas3.js';
import Restful, {OpenApi} from '../../index.js';

/**
* The Feed API provides the ability to download TSV_GZIP feed files containing eBay items and an hourly snapshot file
* of the items that have changed within an hour for a specific category, date and marketplace.
*/
export default class Feed extends Restful {
export default class Feed extends Restful implements OpenApi<operations> {

static id = 'Feed';

Expand Down
4 changes: 2 additions & 2 deletions src/api/restful/buy/marketing/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {operations} from '../../../../types/restful/specs/buy_marketing_v1_beta_oas3.js';
import Restful from '../../index.js';
import Restful, {OpenApi} from '../../index.js';

/**
* The Marketing API retrieves eBay products based on a metric, such as Best Selling, as well as products that were
* also bought and also viewed.
*/
export default class Marketing extends Restful {
export default class Marketing extends Restful implements OpenApi<operations> {

static id = 'Marketing';

Expand Down
27 changes: 14 additions & 13 deletions src/api/restful/buy/marketplaceInsights/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import Restful from '../../index.js';
import {MarketingInsightsSearchParams} from '../../../../types/index.js';
import {operations} from '../../../../types/restful/specs/buy_marketplace_insights_v1_beta_oas3.js';
import Restful, {OpenApi} from '../../index.js';

/**
* (Limited Release) The Marketplace Insights API provides the ability to search for sold items on eBay by keyword,
* GTIN, category, and product and returns the of sales history of those items.
*/
export default class MarketplaceInsights extends Restful {
export default class MarketplaceInsights extends Restful implements OpenApi<operations> {

static id = 'MarketplaceInsights';

Expand All @@ -31,17 +32,17 @@ export default class MarketplaceInsights extends Restful {
* @param sort This field specifies the order and the field name to use to sort the items.
*/
public search({
aspectFilter,
categoryIds,
epid,
fieldgroups,
filter,
gtin,
limit,
offset,
q,
sort,
}: MarketingInsightsSearchParams) {
aspectFilter,
categoryIds,
epid,
fieldgroups,
filter,
gtin,
limit,
offset,
q,
sort,
}: MarketingInsightsSearchParams) {
return this.get(`/item_sales/search`, {
params: {
aspect_filter: aspectFilter,
Expand Down
8 changes: 4 additions & 4 deletions src/api/restful/buy/offer/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {components} from '../../../../types/restful/specs/buy_offer_v1_beta_oas3.js';
import Restful from '../../index.js';
import {components, operations} from '../../../../types/restful/specs/buy_offer_v1_beta_oas3.js';
import Restful, {OpenApi} from '../../index.js';

/**
* The Api Offer API enables Partners to place proxy bids for a buyer and retrieve the auctions where the buyer is
* bidding. Client Credentials: https://api.ebay.com/oauth/api_scope/buy.offer.auction
*/
export default class Offer extends Restful {
export default class Offer extends Restful implements OpenApi<operations> {

static id = 'Offer';

Expand All @@ -31,6 +31,6 @@ export default class Offer extends Restful {
*/
public placeProxyBid(itemId: string, body?: components['schemas']['PlaceProxyBidRequest']) {
const id = encodeURIComponent(itemId);
return this.post(`/bidding/${id}/place_proxy_bid`, body );
return this.post(`/bidding/${id}/place_proxy_bid`, body);
}
}
6 changes: 3 additions & 3 deletions src/api/restful/buy/order/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {components} from '../../../../types/restful/specs/buy_order_v1_beta_oas3.js';
import Api from '../../index.js';
import {components, operations} from '../../../../types/restful/specs/buy_order_v1_beta_oas3.js';
import Api, {OpenApi} from '../../index.js';

/**
* The Order API provides interfaces that lets shoppers pay for items (for both eBay guest and eBay member buyers).
* Client Credentials: https://api.ebay.com/oauth/api_scope/buy.order
*/
export default class Order extends Api {
export default class Order extends Api implements OpenApi<operations> {

static id = 'Order';

Expand Down
4 changes: 2 additions & 2 deletions src/api/restful/commerce/catalog/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {operations} from '../../../../types/restful/specs/commerce_catalog_v1_beta_oas3.js';
import Restful from '../../index.js';
import Restful, {OpenApi} from '../../index.js';

/**
* Use the Catalog API to search the eBay catalog for products on which to base a seller's item listing;
*/
export default class Catalog extends Restful {
export default class Catalog extends Restful implements OpenApi<Omit<operations, 'createChangeRequest'>> {

static id = 'Catalog';

Expand Down
17 changes: 9 additions & 8 deletions src/api/restful/commerce/charity/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import Restful from '../../index.js';
import {operations} from '../../../../types/restful/specs/commerce_charity_v1_oas3.js';
import Restful, {OpenApi} from '../../index.js';

/**
* The Charity API allows third-party developers to search for and access details on supported charitable organizations.
*/
export default class Charity extends Restful {
export default class Charity extends Restful implements OpenApi<operations> {

static id = 'Charity';

Expand All @@ -17,7 +18,7 @@ export default class Charity extends Restful {
* @param charityOrgId The unique ID of the charitable organization.
*/
public getCharityOrg(charityOrgId: string) {
charityOrgId = encodeURIComponent(charityOrgId)
charityOrgId = encodeURIComponent(charityOrgId);
return this.get(`/charity_org/${charityOrgId}`);
}

Expand All @@ -30,11 +31,11 @@ export default class Charity extends Restful {
* @param registrationIds A comma-separated list of charitable organization registration IDs.
*/
public getCharityOrgs({
limit,
offset,
q,
registrationIds
}: { limit?: string, offset?: string, q?: string, registrationIds?: string }) {
limit,
offset,
q,
registrationIds
}: { limit?: string, offset?: string, q?: string, registrationIds?: string }) {
return this.get(`/charity_org`, {
params: {
limit,
Expand Down
5 changes: 3 additions & 2 deletions src/api/restful/commerce/identity/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import Restful from '../../index.js';
import {operations} from '../../../../types/restful/specs/commerce_identity_v1_oas3.js';
import Restful, {OpenApi} from '../../index.js';

/**
* Retrieves the authenticated user's account profile information.
*/
export default class Identity extends Restful {
export default class Identity extends Restful implements OpenApi<operations> {

static id = 'Identity';

Expand Down
6 changes: 3 additions & 3 deletions src/api/restful/commerce/notification/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {NotificationParams} from '../../../../types/index.js';
import {components} from '../../../../types/restful/specs/commerce_notification_v1_oas3.js';
import Restful from '../../index.js';
import {components, operations} from '../../../../types/restful/specs/commerce_notification_v1_oas3.js';
import Restful, {OpenApi} from '../../index.js';

/**
* The eBay Notification API allows third-party developers and applications to process eBay notifications and verify the integrity of the notification message payload.
*/
export default class Notification extends Restful {
export default class Notification extends Restful implements OpenApi<operations> {

static id = 'Notification';

Expand Down
5 changes: 3 additions & 2 deletions src/api/restful/commerce/taxonomy/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import Restful from '../../index.js';
import {operations} from '../../../../types/restful/specs/commerce_taxonomy_v1_oas3.js';
import Restful, {OpenApi} from '../../index.js';

/**
* Use the Taxonomy API to discover the most appropriate eBay categories under which sellers can offer inventory items
* for sale, and the most likely categories under which buyers can browse or search for items to purchase.
*/
export default class Taxonomy extends Restful {
export default class Taxonomy extends Restful implements OpenApi<operations> {

static id = 'Taxonomy';

Expand Down
6 changes: 3 additions & 3 deletions src/api/restful/commerce/translation/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {components} from '../../../../types/restful/specs/commerce_translation_v1_beta_oas3.js';
import Restful from '../../index.js';
import {components, operations} from '../../../../types/restful/specs/commerce_translation_v1_beta_oas3.js';
import Restful, {OpenApi} from '../../index.js';

/**
* This API allows 3rd party developers to translate item title, description, search query.
*/
export default class Translation extends Restful {
export default class Translation extends Restful implements OpenApi<operations> {

static id = 'Translation';

Expand Down
5 changes: 3 additions & 2 deletions src/api/restful/developer/analytics/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import Restful from '../../index.js';
import {operations} from '../../../../types/restful/specs/developer_analytics_v1_beta_oas3.js';
import Restful, {OpenApi} from '../../index.js';

/**
* This method retrieves the call limit and utilization data for an application.
*/
export default class Analytics extends Restful {
export default class Analytics extends Restful implements OpenApi<operations> {

static id = 'Analytics';

Expand Down
5 changes: 3 additions & 2 deletions src/api/restful/developer/keyManagement/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import Restful from '../../index.js';
import {operations} from '../../../../types/restful/specs/developer_key_management_v1_oas3.js';
import Restful, {OpenApi} from '../../index.js';

/**
* This method retrieves the call limit and utilization data for an application.
*/
export default class KeyManagement extends Restful {
export default class KeyManagement extends Restful implements OpenApi<operations> {

static id = 'KeyManagement';

Expand Down
4 changes: 4 additions & 0 deletions src/api/restful/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ export interface IRestful {
id: string;
}

export type OpenApi<T> = {
[K in keyof T]: any
}

export default abstract class Restful extends Api {

public readonly apiConfig: Required<RestfulApiConfig>;
Expand Down
Loading

0 comments on commit 035e8c8

Please sign in to comment.