From 933bf66a2948fd1dd3bcd0356a8c7e9a32f35bde Mon Sep 17 00:00:00 2001 From: Kyle Welch Date: Tue, 23 Oct 2018 14:55:26 -0500 Subject: [PATCH 1/6] Add pagination constants --- src/constants.ts | 4 ++++ src/index.ts | 2 ++ 2 files changed, 6 insertions(+) create mode 100644 src/constants.ts diff --git a/src/constants.ts b/src/constants.ts new file mode 100644 index 0000000..2a9f031 --- /dev/null +++ b/src/constants.ts @@ -0,0 +1,4 @@ +export const PAGINATION_TYPE = { + PAGINATION: 'page', + CONTINUATION: 'continuation', +}; diff --git a/src/index.ts b/src/index.ts index 678b796..0a5a4f4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,8 @@ import {Sdk, SdkConfig} from './types'; import request from './request'; +export * from './constants'; + const DEFAULT_API_URL = 'https://www.eventbriteapi.com/v3'; const eventbrite = ({ From 8c2541173db3084e78debca7b5bc0d15612d4da7 Mon Sep 17 00:00:00 2001 From: Kyle Welch Date: Tue, 23 Oct 2018 15:08:36 -0500 Subject: [PATCH 2/6] add pagination look up --- src/constants.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/constants.ts b/src/constants.ts index 2a9f031..d64a23c 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -2,3 +2,17 @@ export const PAGINATION_TYPE = { PAGINATION: 'page', CONTINUATION: 'continuation', }; + +export const PAGINATION_MAP = { + [PAGINATION_TYPE.PAGINATION]: { + hasMoreItems: ({page_number: pageNumber, page_count: pageCount}) => + pageNumber >= pageCount, + getNextPage: ({page_number: pageNumber}) => pageNumber + 1, + initialPageId: 1, + }, + [PAGINATION_TYPE.CONTINUATION]: { + donePredicate: ({has_more_items: hasMoreItems}) => !hasMoreItems, + getNextPage: ({continuation}) => continuation, + initialPageId: null, + }, +}; From 1b1a5e95926bbd26d100151a8e42e21d89c9dfe2 Mon Sep 17 00:00:00 2001 From: Kyle Welch Date: Wed, 24 Oct 2018 14:33:57 -0500 Subject: [PATCH 3/6] fixed up exported constants and removed map --- src/constants.ts | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index d64a23c..1fc5c78 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,18 +1,2 @@ -export const PAGINATION_TYPE = { - PAGINATION: 'page', - CONTINUATION: 'continuation', -}; - -export const PAGINATION_MAP = { - [PAGINATION_TYPE.PAGINATION]: { - hasMoreItems: ({page_number: pageNumber, page_count: pageCount}) => - pageNumber >= pageCount, - getNextPage: ({page_number: pageNumber}) => pageNumber + 1, - initialPageId: 1, - }, - [PAGINATION_TYPE.CONTINUATION]: { - donePredicate: ({has_more_items: hasMoreItems}) => !hasMoreItems, - getNextPage: ({continuation}) => continuation, - initialPageId: null, - }, -}; +export const PAGINATION = 'page'; +export const CONTINUATION = 'continuation'; From 90d2193b996c2d86d91bc8b7c8c871da202c3021 Mon Sep 17 00:00:00 2001 From: Kyle Welch Date: Wed, 24 Oct 2018 14:50:52 -0500 Subject: [PATCH 4/6] update constants name --- src/constants.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index 1fc5c78..47dfeed 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,2 +1,2 @@ -export const PAGINATION = 'page'; -export const CONTINUATION = 'continuation'; +export const PAGINATION_KEY = 'page'; +export const CONTINUATION_KEY = 'continuation'; From e3669f761e3147b4a6b9911a25382a15cdab6946 Mon Sep 17 00:00:00 2001 From: Kyle Welch Date: Wed, 24 Oct 2018 15:05:27 -0500 Subject: [PATCH 5/6] fixed constant based on Ben's comment --- src/constants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants.ts b/src/constants.ts index 47dfeed..8f6a034 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,2 +1,2 @@ -export const PAGINATION_KEY = 'page'; +export const PAGE_KEY = 'page'; export const CONTINUATION_KEY = 'continuation'; From 47a9a1eb7ecdcbf86ba900a99cc2e099c42031a5 Mon Sep 17 00:00:00 2001 From: Kyle Welch Date: Thu, 25 Oct 2018 14:36:41 -0500 Subject: [PATCH 6/6] remove node host from travis file --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c4a3864..405a494 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: node_js node_js: - - "node" +# Removed until v11 bug is resolve see #43 +# - "node" - "10" - "8" - "6"