Skip to content

Commit

Permalink
feat: adds advertising account time zone
Browse files Browse the repository at this point in the history
  • Loading branch information
moltar authored and Roman committed Feb 26, 2020
1 parent c556075 commit f20dbc8
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 8 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ a structured class.
* Sponsored Brands
* Minimum bid
* Maximum bid
* Account time zone

### Code Demo

Expand Down Expand Up @@ -85,7 +86,8 @@ const US = findAmazonMarketplaceOrFail('countryCode', 'US')
"min": 2,
"max": 100000
}
}
},
"timeZone": "America/Los_Angeles"
}
}
```
Expand All @@ -111,6 +113,8 @@ version, because others may rely on iterating over the available marketplaces.
* [Amazon Advertising API](https://advertising.amazon.com/API/docs/en-us/get-started/how-to-use-api)
* [Amazon Marketplace Web Service](https://docs.developer.amazonservices.com/en_US/dev_guide/DG_Endpoints.html)
* [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#X_currencies)
* [Regional profile time zone codes](https://advertising.amazon.com/API/docs/en-us/reference/2/profiles#regional-profile-time-zone-codes)
* [List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)

### Authors or Acknowledgments

Expand Down
19 changes: 18 additions & 1 deletion src/amazon-marketplace.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
/**
* Time Zone Enum.
*/
export enum AmazonMarketplaceAdvertisingTimeZone {
AMERICA_LOS_ANGELES = 'America/Los_Angeles',
ASIA_DUBAI = 'Asia/Dubai',
ASIA_TOKYO = 'Asia/Tokyo',
AUSTRALIA_SYDNEY = 'Australia/Sydney',
EUROPE_LONDON = 'Europe/London',
EUROPE_PARIS = 'Europe/Paris',
}

export interface AmazonMarketplaceAdvertising {
/**
* Amazon Advertising API endpoint URI
* Amazon Advertising API endpoint URI.
*/
readonly uri: string

/**
* Amazon Advertising account time zone.
*/
readonly timeZone: AmazonMarketplaceAdvertisingTimeZone

/**
* Minimum and maximum bids for each advertising type.
*/
Expand Down
3 changes: 2 additions & 1 deletion src/marketplaces/AE.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AmazonMarketplace } from '../amazon-marketplace'
import { AmazonMarketplace, AmazonMarketplaceAdvertisingTimeZone } from '../amazon-marketplace'

export const AE = new AmazonMarketplace({
countryCode: 'AE',
Expand All @@ -19,5 +19,6 @@ export const AE = new AmazonMarketplace({
max: 18400,
},
},
timeZone: AmazonMarketplaceAdvertisingTimeZone.ASIA_DUBAI,
},
})
3 changes: 2 additions & 1 deletion src/marketplaces/AU.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AmazonMarketplace } from '../amazon-marketplace'
import { AmazonMarketplace, AmazonMarketplaceAdvertisingTimeZone } from '../amazon-marketplace'

export const AU = new AmazonMarketplace({
countryCode: 'AU',
Expand All @@ -19,5 +19,6 @@ export const AU = new AmazonMarketplace({
max: 141000,
},
},
timeZone: AmazonMarketplaceAdvertisingTimeZone.AUSTRALIA_SYDNEY,
},
})
3 changes: 2 additions & 1 deletion src/marketplaces/DE.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AmazonMarketplace } from '../amazon-marketplace'
import { AmazonMarketplace, AmazonMarketplaceAdvertisingTimeZone } from '../amazon-marketplace'

export const DE = new AmazonMarketplace({
countryCode: 'DE',
Expand All @@ -19,5 +19,6 @@ export const DE = new AmazonMarketplace({
max: 100000,
},
},
timeZone: AmazonMarketplaceAdvertisingTimeZone.EUROPE_PARIS,
},
})
3 changes: 2 additions & 1 deletion src/marketplaces/GB.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AmazonMarketplace } from '../amazon-marketplace'
import { AmazonMarketplace, AmazonMarketplaceAdvertisingTimeZone } from '../amazon-marketplace'
import { DE } from './DE'

if (!DE.advertising) {
Expand All @@ -24,5 +24,6 @@ export const GB = new AmazonMarketplace({
max: 100000,
},
},
timeZone: AmazonMarketplaceAdvertisingTimeZone.EUROPE_LONDON,
},
})
3 changes: 2 additions & 1 deletion src/marketplaces/JP.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AmazonMarketplace } from '../amazon-marketplace'
import { AmazonMarketplace, AmazonMarketplaceAdvertisingTimeZone } from '../amazon-marketplace'

export const JP = new AmazonMarketplace({
countryCode: 'JP',
Expand All @@ -19,5 +19,6 @@ export const JP = new AmazonMarketplace({
max: 10000000,
},
},
timeZone: AmazonMarketplaceAdvertisingTimeZone.ASIA_TOKYO,
},
})
3 changes: 2 additions & 1 deletion src/marketplaces/US.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AmazonMarketplace } from '../amazon-marketplace'
import { AmazonMarketplace, AmazonMarketplaceAdvertisingTimeZone } from '../amazon-marketplace'

export const US = new AmazonMarketplace({
countryCode: 'US',
Expand All @@ -19,5 +19,6 @@ export const US = new AmazonMarketplace({
max: 100000,
},
},
timeZone: AmazonMarketplaceAdvertisingTimeZone.AMERICA_LOS_ANGELES,
},
})
2 changes: 2 additions & 0 deletions tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
amazonMarketplacesList,
findAmazonMarketplace,
findAmazonMarketplaceOrFail,
AmazonMarketplaceAdvertisingTimeZone,
} from '../src'

describe('index', () => {
Expand All @@ -12,6 +13,7 @@ describe('index', () => {
expect(AmazonMarketplace).toBeTruthy()
expect(findAmazonMarketplace).toBeTruthy()
expect(findAmazonMarketplaceOrFail).toBeTruthy()
expect(AmazonMarketplaceAdvertisingTimeZone).toBeTruthy()
})

it('should also provide a list of marketplaces', () => {
Expand Down

0 comments on commit f20dbc8

Please sign in to comment.