Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 15638ac

Browse files
Merge pull request #88 from ScaleLeap/revert-85-feature/subscriptions-api
Revert "feature: subscriptions api"
2 parents 5a80260 + b4789a3 commit 15638ac

18 files changed

+5
-1137
lines changed

src/http.ts

Lines changed: 5 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,16 @@ export interface MWSOptions {
5858
}
5959

6060
type HttpMethod = 'GET' | 'POST'
61-
type ParameterTypes =
62-
| string
63-
| number
64-
| (number | string)[]
65-
| object[]
66-
| boolean
67-
| { [key: string]: ParameterTypes }
68-
| undefined
69-
61+
type ParameterTypes = string | number | (number | string)[] | object[] | boolean | undefined
7062
type Parameters = Record<string, ParameterTypes>
7163
type CleanParameters = Record<string, string>
7264

7365
export enum Resource {
74-
FulfilmentInventory = 'FulfillmentInventory',
66+
Sellers = 'Sellers',
7567
Orders = 'Orders',
7668
Products = 'Products',
69+
FulfilmentInventory = 'FulfillmentInventory',
7770
Reports = 'Reports',
78-
Sellers = 'Sellers',
79-
Subscriptions = 'Subscriptions',
8071
}
8172

8273
interface ResourceActions {
@@ -126,17 +117,6 @@ interface ResourceActions {
126117
| 'GetReportScheduleListByNextToken'
127118
| 'GetReportScheduleCount'
128119
| 'UpdateReportAcknowledgements'
129-
[Resource.Subscriptions]:
130-
| 'RegisterDestination'
131-
| 'DeregisterDestination'
132-
| 'ListRegisteredDestinations'
133-
| 'SendTestNotificationToDestination'
134-
| 'CreateSubscription'
135-
| 'GetSubscription'
136-
| 'DeleteSubscription'
137-
| 'ListSubscriptions'
138-
| 'UpdateSubscription'
139-
| 'GetServiceStatus'
140120
}
141121

142122
interface Request {
@@ -193,15 +173,7 @@ export const cleanParameters = (parameters: Parameters): CleanParameters =>
193173
Object.entries(parameters)
194174
.filter(([, parameter]) => parameter !== undefined)
195175
.reduce((result, [key, parameter]) => {
196-
if (typeof parameter === 'string' || !Number.isNaN(Number(parameter))) {
197-
/**
198-
* If parameter is type string or number, assign it to result
199-
*/
200-
Object.assign(result, { [key]: String(parameter) })
201-
} else if (Array.isArray(parameter)) {
202-
/**
203-
* If parameter is type array reduce it to dotnotation
204-
*/
176+
if (Array.isArray(parameter)) {
205177
parameter.forEach((parameterChild: string | number | object, index: number) => {
206178
if (typeof parameterChild === 'string' || !Number.isNaN(Number(parameterChild))) {
207179
Object.assign(result, { [`${key}.${index + 1}`]: String(parameterChild) })
@@ -210,14 +182,7 @@ export const cleanParameters = (parameters: Parameters): CleanParameters =>
210182
}
211183
})
212184
} else {
213-
/**
214-
* If parameter is type object parameterize it
215-
*/
216-
Object.entries(
217-
cleanParameters(parameter as Parameters),
218-
).forEach(([innerKey, innerValue]: [string, string]) =>
219-
Object.assign(result, { [`${key}.${innerKey}`]: innerValue }),
220-
)
185+
Object.assign(result, { [key]: String(parameter) })
221186
}
222187

223188
return result

src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
export * from './http'
22
export * from './mws'
33
export * from './sections/sellers'
4-
export * from './sections/subscriptions'
54
export * from './sections/orders'
65
export * from './sections/products/products'
76
export * from './sections/fulfillment-inventory'

src/mws.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { Orders } from './sections/orders'
44
import { Products } from './sections/products/products'
55
import { Reports } from './sections/reports'
66
import { Sellers } from './sections/sellers'
7-
import { Subscriptions } from './sections/subscriptions'
87

98
export class MWS {
109
private _sellers!: Sellers
@@ -17,8 +16,6 @@ export class MWS {
1716

1817
private _reports!: Reports
1918

20-
private _subscriptions!: Subscriptions
21-
2219
constructor(private httpClient: HttpClient) {}
2320

2421
get sellers() {
@@ -60,12 +57,4 @@ export class MWS {
6057

6158
return this._reports
6259
}
63-
64-
get subscriptions() {
65-
if (!this._subscriptions) {
66-
this._subscriptions = new Subscriptions(this.httpClient)
67-
}
68-
69-
return this._subscriptions
70-
}
7160
}

0 commit comments

Comments
 (0)