Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
GammaJS
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GSC Libraries
GammaJS
Commits
1c4ccc93
Commit
1c4ccc93
authored
May 21, 2018
by
Ben Galloway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add and parse new VisitorStats method
parent
7dc80fe9
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
5 deletions
+46
-5
dist/index.js
dist/index.js
+2
-1
dist/methods/availability-methods.js
dist/methods/availability-methods.js
+11
-0
dist/util.js
dist/util.js
+7
-2
src/index.js
src/index.js
+1
-0
src/methods/availability-methods.js
src/methods/availability-methods.js
+12
-0
src/util.js
src/util.js
+13
-2
No files found.
dist/index.js
View file @
1c4ccc93
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
value
:
true
});
});
exports
.
gammaModifiedMembers
=
exports
.
gammaMembershipSubscriptionsLoad
=
exports
.
gammaMembershipCancellation
=
exports
.
gammaMembershipPurchase
=
exports
.
gammaChangeMemberDetails
=
exports
.
gammaCancelSeats
=
exports
.
gammaReserveXTSeats
=
exports
.
gammaCancelBookAvailableSpaces
=
exports
.
gammaBookAvailableSpacesRequest
=
exports
.
gammaUpdateBookingStatus
=
exports
.
gammaUpdateBooking
=
exports
.
gammaSaveCustomerDetails
=
exports
.
gammaRemoveContactInterests
=
exports
.
gammaCancelBookingRequest
=
exports
.
gammaBookingAllSave
=
exports
.
gammaAmendBooking
=
exports
.
gammaVoucherListLoad
=
exports
.
gammaVoucherDiscountCheck
=
exports
.
gammaViewResourcesLoad
=
exports
.
gammaResourceViewListLoad
=
exports
.
gammaResourceListLoad
=
exports
.
gammaResourceListByViewLoad
=
exports
.
gammaResourceListByViewByDateLoad
=
exports
.
gammaResourceDatesListLoad
=
exports
.
gammaRedeemedBookings
=
exports
.
gammaProductMapListLoad
=
exports
.
gammaProductListLoad
=
exports
.
gammaGetTourList
=
exports
.
gammaGetBookingStatusList
=
exports
.
gammaGetBookingHistory
=
exports
.
gammaEventsOnlyListLoad
=
exports
.
gammaEventListLoad
=
exports
.
gammaEventEditList
=
exports
.
gammaCustomerLoad
=
exports
.
gammaContactInterests
=
exports
.
gammaBookingStatusUpdateCheck
=
exports
.
gammaBookingETicketExportRequest
=
exports
.
gammaAllContactInterests
=
undefined
;
exports
.
gammaModifiedMembers
=
exports
.
gammaMembershipSubscriptionsLoad
=
exports
.
gammaMembershipCancellation
=
exports
.
gammaMembershipPurchase
=
exports
.
gammaChangeMemberDetails
=
exports
.
gammaCancelSeats
=
exports
.
gammaReserveXTSeats
=
exports
.
gammaCancelBookAvailableSpaces
=
exports
.
gammaBookAvailableSpacesRequest
=
exports
.
gammaUpdateBookingStatus
=
exports
.
gammaUpdateBooking
=
exports
.
gammaSaveCustomerDetails
=
exports
.
gammaRemoveContactInterests
=
exports
.
gammaCancelBookingRequest
=
exports
.
gammaBookingAllSave
=
exports
.
gammaAmendBooking
=
exports
.
gammaV
isitorStats
=
exports
.
gammaV
oucherListLoad
=
exports
.
gammaVoucherDiscountCheck
=
exports
.
gammaViewResourcesLoad
=
exports
.
gammaResourceViewListLoad
=
exports
.
gammaResourceListLoad
=
exports
.
gammaResourceListByViewLoad
=
exports
.
gammaResourceListByViewByDateLoad
=
exports
.
gammaResourceDatesListLoad
=
exports
.
gammaRedeemedBookings
=
exports
.
gammaProductMapListLoad
=
exports
.
gammaProductListLoad
=
exports
.
gammaGetTourList
=
exports
.
gammaGetBookingStatusList
=
exports
.
gammaGetBookingHistory
=
exports
.
gammaEventsOnlyListLoad
=
exports
.
gammaEventListLoad
=
exports
.
gammaEventEditList
=
exports
.
gammaCustomerLoad
=
exports
.
gammaContactInterests
=
exports
.
gammaBookingStatusUpdateCheck
=
exports
.
gammaBookingETicketExportRequest
=
exports
.
gammaAllContactInterests
=
undefined
;
var
_methods
=
require
(
"
./methods
"
);
var
_methods
=
require
(
"
./methods
"
);
...
@@ -56,6 +56,7 @@ const gammaResourceViewListLoad = exports.gammaResourceViewListLoad = create("Re
...
@@ -56,6 +56,7 @@ const gammaResourceViewListLoad = exports.gammaResourceViewListLoad = create("Re
const
gammaViewResourcesLoad
=
exports
.
gammaViewResourcesLoad
=
create
(
"
ViewResourcesLoad
"
);
const
gammaViewResourcesLoad
=
exports
.
gammaViewResourcesLoad
=
create
(
"
ViewResourcesLoad
"
);
const
gammaVoucherDiscountCheck
=
exports
.
gammaVoucherDiscountCheck
=
create
(
"
VoucherDiscountCheck
"
);
const
gammaVoucherDiscountCheck
=
exports
.
gammaVoucherDiscountCheck
=
create
(
"
VoucherDiscountCheck
"
);
const
gammaVoucherListLoad
=
exports
.
gammaVoucherListLoad
=
create
(
"
VoucherListLoad
"
);
const
gammaVoucherListLoad
=
exports
.
gammaVoucherListLoad
=
create
(
"
VoucherListLoad
"
);
const
gammaVisitorStats
=
exports
.
gammaVisitorStats
=
create
(
"
VisitorStats
"
);
// These methods seem to be unsupported by the Gamma API (based on testing in May 2018).
// These methods seem to be unsupported by the Gamma API (based on testing in May 2018).
// They are not made available individually here, to discourage their use.
// They are not made available individually here, to discourage their use.
//export const gammaResourceDatesNotAvailable = create("ResourceDatesNotAvailable");
//export const gammaResourceDatesNotAvailable = create("ResourceDatesNotAvailable");
...
...
dist/methods/availability-methods.js
View file @
1c4ccc93
...
@@ -264,6 +264,17 @@ const availabilityMethods = [{
...
@@ -264,6 +264,17 @@ const availabilityMethods = [{
inputFormat
:
{
inputFormat
:
{
VouchCode
:
"
Optional
"
VouchCode
:
"
Optional
"
}
}
},
{
name
:
"
VisitorStats
"
,
// This method is not in the general documentation - it is GSC-specific!
type
:
"
XMLVisitorStatsRequest
"
,
responseWrapper
:
"
XMLVisitorStatsResponse
"
,
returnType
:
false
,
endpoint
:
"
availability
"
,
inputFormat
:
{
StartDate
:
"
Undocumented
"
,
EndDate
:
"
Undocumented
"
}
}];
}];
exports
.
default
=
availabilityMethods
;
exports
.
default
=
availabilityMethods
;
\ No newline at end of file
dist/util.js
View file @
1c4ccc93
...
@@ -57,8 +57,13 @@ const getXml = exports.getXml = (callObject, method) => {
...
@@ -57,8 +57,13 @@ const getXml = exports.getXml = (callObject, method) => {
const
parseResponseField
=
(
fieldContents
,
fieldKey
,
methodSpecs
)
=>
{
const
parseResponseField
=
(
fieldContents
,
fieldKey
,
methodSpecs
)
=>
{
if
(
fieldContents
.
constructor
===
Object
&&
Object
.
keys
(
fieldContents
).
length
===
0
)
return
{
[
fieldKey
]:
""
};
if
(
fieldContents
.
constructor
===
Object
&&
Object
.
keys
(
fieldContents
).
length
===
0
)
return
{
[
fieldKey
]:
""
};
if
(
fieldKey
===
"
xs:schema
"
)
return
{};
if
(
fieldKey
===
"
mResults
"
&&
fieldContents
.
hasOwnProperty
(
"
diffgr:diffgram
"
))
return
{
[
fieldKey
]:
processAnyType
(
fieldContents
[
"
diffgr:diffgram
"
].
NewDataSet
.
Table
,
methodSpecs
,
true
)
};
if
(
methodSpecs
.
returnType
===
false
&&
fieldKey
===
"
_attributes
"
&&
fieldContents
.
hasOwnProperty
(
"
xmlns:xsi
"
)
&&
fieldContents
.
hasOwnProperty
(
"
xmlns:xsd
"
))
return
{
GammaResponseType
:
methodSpecs
.
responseWrapper
};
if
(
methodSpecs
.
returnType
===
false
&&
fieldKey
===
"
_attributes
"
&&
fieldContents
.
hasOwnProperty
(
"
xmlns:xsi
"
)
&&
fieldContents
.
hasOwnProperty
(
"
xmlns:xsd
"
))
return
{
GammaResponseType
:
methodSpecs
.
responseWrapper
};
if
(
fieldKey
===
"
_attributes
"
&&
fieldContents
.
hasOwnProperty
(
"
xsi:type
"
))
return
{
GammaResponseType
:
fieldContents
[
"
xsi:type
"
]
};
if
(
fieldKey
===
"
_attributes
"
&&
fieldContents
.
hasOwnProperty
(
"
xsi:type
"
))
return
{
GammaResponseType
:
fieldContents
[
"
xsi:type
"
]
};
if
(
fieldKey
===
"
_attributes
"
&&
fieldContents
.
hasOwnProperty
(
"
diffgr:id
"
)
&&
fieldContents
.
hasOwnProperty
(
"
msdata:rowOrder
"
))
return
{
GammaResponseType
:
"
VisitorStatsDay
"
};
if
(
fieldContents
.
hasOwnProperty
(
"
_text
"
))
return
{
[
fieldKey
]:
fieldContents
[
"
_text
"
]
};
if
(
fieldContents
.
hasOwnProperty
(
"
_text
"
))
return
{
[
fieldKey
]:
fieldContents
[
"
_text
"
]
};
if
(
fieldContents
.
hasOwnProperty
(
"
anyType
"
))
return
{
[
fieldKey
]:
processAnyType
(
fieldContents
.
anyType
,
methodSpecs
)
};
if
(
fieldContents
.
hasOwnProperty
(
"
anyType
"
))
return
{
[
fieldKey
]:
processAnyType
(
fieldContents
.
anyType
,
methodSpecs
)
};
if
(
fieldContents
.
hasOwnProperty
(
fieldKey
))
return
{
[
fieldKey
]:
parseResponseField
(
fieldContents
[
fieldKey
],
fieldKey
,
methodSpecs
)
};
if
(
fieldContents
.
hasOwnProperty
(
fieldKey
))
return
{
[
fieldKey
]:
parseResponseField
(
fieldContents
[
fieldKey
],
fieldKey
,
methodSpecs
)
};
...
@@ -71,7 +76,7 @@ const parseResponseField = (fieldContents, fieldKey, methodSpecs) => {
...
@@ -71,7 +76,7 @@ const parseResponseField = (fieldContents, fieldKey, methodSpecs) => {
return
{
[
fieldKey
]:
fieldContents
};
return
{
[
fieldKey
]:
fieldContents
};
};
};
const
processAnyType
=
(
anyType
,
methodSpecs
)
=>
{
const
processAnyType
=
(
anyType
,
methodSpecs
,
internal
=
false
)
=>
{
// A single <anyType></anyType> response needs converted for the array operations to work
// A single <anyType></anyType> response needs converted for the array operations to work
const
anyTypeArray
=
Array
.
isArray
(
anyType
)
?
anyType
:
new
Array
(
anyType
);
const
anyTypeArray
=
Array
.
isArray
(
anyType
)
?
anyType
:
new
Array
(
anyType
);
...
@@ -83,7 +88,7 @@ const processAnyType = (anyType, methodSpecs) => {
...
@@ -83,7 +88,7 @@ const processAnyType = (anyType, methodSpecs) => {
return
distilled
;
return
distilled
;
});
});
const
result
=
methodSpecs
.
returnType
===
false
&&
reduced
.
length
===
1
?
reduced
[
0
]
:
reduced
;
// Only return an array if necessary
const
result
=
!
internal
&&
methodSpecs
.
returnType
===
false
&&
reduced
.
length
===
1
?
reduced
[
0
]
:
reduced
;
// Only return an array if necessary
return
result
;
return
result
;
};
};
...
...
src/index.js
View file @
1c4ccc93
...
@@ -39,6 +39,7 @@ export const gammaResourceViewListLoad = create("ResourceViewListLoad");
...
@@ -39,6 +39,7 @@ export const gammaResourceViewListLoad = create("ResourceViewListLoad");
export
const
gammaViewResourcesLoad
=
create
(
"
ViewResourcesLoad
"
);
export
const
gammaViewResourcesLoad
=
create
(
"
ViewResourcesLoad
"
);
export
const
gammaVoucherDiscountCheck
=
create
(
"
VoucherDiscountCheck
"
);
export
const
gammaVoucherDiscountCheck
=
create
(
"
VoucherDiscountCheck
"
);
export
const
gammaVoucherListLoad
=
create
(
"
VoucherListLoad
"
);
export
const
gammaVoucherListLoad
=
create
(
"
VoucherListLoad
"
);
export
const
gammaVisitorStats
=
create
(
"
VisitorStats
"
);
// These methods seem to be unsupported by the Gamma API (based on testing in May 2018).
// These methods seem to be unsupported by the Gamma API (based on testing in May 2018).
// They are not made available individually here, to discourage their use.
// They are not made available individually here, to discourage their use.
//export const gammaResourceDatesNotAvailable = create("ResourceDatesNotAvailable");
//export const gammaResourceDatesNotAvailable = create("ResourceDatesNotAvailable");
...
...
src/methods/availability-methods.js
View file @
1c4ccc93
...
@@ -284,6 +284,18 @@ const availabilityMethods = [
...
@@ -284,6 +284,18 @@ const availabilityMethods = [
VouchCode
:
"
Optional
"
,
VouchCode
:
"
Optional
"
,
},
},
},
},
{
name
:
"
VisitorStats
"
,
// This method is not in the general documentation - it is GSC-specific!
type
:
"
XMLVisitorStatsRequest
"
,
responseWrapper
:
"
XMLVisitorStatsResponse
"
,
returnType
:
false
,
endpoint
:
"
availability
"
,
inputFormat
:
{
StartDate
:
"
Undocumented
"
,
EndDate
:
"
Undocumented
"
,
},
},
];
];
export
default
availabilityMethods
;
export
default
availabilityMethods
;
src/util.js
View file @
1c4ccc93
...
@@ -45,6 +45,11 @@ export const getXml = (callObject, method) => {
...
@@ -45,6 +45,11 @@ export const getXml = (callObject, method) => {
const
parseResponseField
=
(
fieldContents
,
fieldKey
,
methodSpecs
)
=>
{
const
parseResponseField
=
(
fieldContents
,
fieldKey
,
methodSpecs
)
=>
{
if
(
fieldContents
.
constructor
===
Object
&&
Object
.
keys
(
fieldContents
).
length
===
0
)
return
{
[
fieldKey
]:
""
};
if
(
fieldContents
.
constructor
===
Object
&&
Object
.
keys
(
fieldContents
).
length
===
0
)
return
{
[
fieldKey
]:
""
};
if
(
fieldKey
===
"
xs:schema
"
)
return
{};
if
(
fieldKey
===
"
mResults
"
&&
fieldContents
.
hasOwnProperty
(
"
diffgr:diffgram
"
))
return
{
[
fieldKey
]:
processAnyType
(
fieldContents
[
"
diffgr:diffgram
"
].
NewDataSet
.
Table
,
methodSpecs
,
true
),
};
if
(
if
(
methodSpecs
.
returnType
===
false
&&
methodSpecs
.
returnType
===
false
&&
fieldKey
===
"
_attributes
"
&&
fieldKey
===
"
_attributes
"
&&
...
@@ -54,6 +59,12 @@ const parseResponseField = (fieldContents, fieldKey, methodSpecs) => {
...
@@ -54,6 +59,12 @@ const parseResponseField = (fieldContents, fieldKey, methodSpecs) => {
return
{
GammaResponseType
:
methodSpecs
.
responseWrapper
};
return
{
GammaResponseType
:
methodSpecs
.
responseWrapper
};
if
(
fieldKey
===
"
_attributes
"
&&
fieldContents
.
hasOwnProperty
(
"
xsi:type
"
))
if
(
fieldKey
===
"
_attributes
"
&&
fieldContents
.
hasOwnProperty
(
"
xsi:type
"
))
return
{
GammaResponseType
:
fieldContents
[
"
xsi:type
"
]
};
return
{
GammaResponseType
:
fieldContents
[
"
xsi:type
"
]
};
if
(
fieldKey
===
"
_attributes
"
&&
fieldContents
.
hasOwnProperty
(
"
diffgr:id
"
)
&&
fieldContents
.
hasOwnProperty
(
"
msdata:rowOrder
"
)
)
return
{
GammaResponseType
:
"
VisitorStatsDay
"
};
if
(
fieldContents
.
hasOwnProperty
(
"
_text
"
))
return
{
[
fieldKey
]:
fieldContents
[
"
_text
"
]
};
if
(
fieldContents
.
hasOwnProperty
(
"
_text
"
))
return
{
[
fieldKey
]:
fieldContents
[
"
_text
"
]
};
if
(
fieldContents
.
hasOwnProperty
(
"
anyType
"
))
if
(
fieldContents
.
hasOwnProperty
(
"
anyType
"
))
return
{
[
fieldKey
]:
processAnyType
(
fieldContents
.
anyType
,
methodSpecs
)
};
return
{
[
fieldKey
]:
processAnyType
(
fieldContents
.
anyType
,
methodSpecs
)
};
...
@@ -68,7 +79,7 @@ const parseResponseField = (fieldContents, fieldKey, methodSpecs) => {
...
@@ -68,7 +79,7 @@ const parseResponseField = (fieldContents, fieldKey, methodSpecs) => {
return
{
[
fieldKey
]:
fieldContents
};
return
{
[
fieldKey
]:
fieldContents
};
};
};
const
processAnyType
=
(
anyType
,
methodSpecs
)
=>
{
const
processAnyType
=
(
anyType
,
methodSpecs
,
internal
=
false
)
=>
{
// A single <anyType></anyType> response needs converted for the array operations to work
// A single <anyType></anyType> response needs converted for the array operations to work
const
anyTypeArray
=
Array
.
isArray
(
anyType
)
?
anyType
:
new
Array
(
anyType
);
const
anyTypeArray
=
Array
.
isArray
(
anyType
)
?
anyType
:
new
Array
(
anyType
);
...
@@ -80,7 +91,7 @@ const processAnyType = (anyType, methodSpecs) => {
...
@@ -80,7 +91,7 @@ const processAnyType = (anyType, methodSpecs) => {
return
distilled
;
return
distilled
;
});
});
const
result
=
methodSpecs
.
returnType
===
false
&&
reduced
.
length
===
1
?
reduced
[
0
]
:
reduced
;
// Only return an array if necessary
const
result
=
!
internal
&&
methodSpecs
.
returnType
===
false
&&
reduced
.
length
===
1
?
reduced
[
0
]
:
reduced
;
// Only return an array if necessary
return
result
;
return
result
;
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment