aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sra-spec/src/parameters.ts
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-08-25 04:38:30 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-08-25 04:38:30 +0800
commit44a430802e534f8b1eccb57ed87249925c32d4eb (patch)
treeec3ee9b35c231da47764bea7381f46fa6766b432 /packages/sra-spec/src/parameters.ts
parent6b03cfd40d720096bf772c2966b1372c0e54bf51 (diff)
parent7f36574a57ced8ead0059b90673fe01f97f04827 (diff)
downloaddexon-sol-tools-44a430802e534f8b1eccb57ed87249925c32d4eb.tar
dexon-sol-tools-44a430802e534f8b1eccb57ed87249925c32d4eb.tar.gz
dexon-sol-tools-44a430802e534f8b1eccb57ed87249925c32d4eb.tar.bz2
dexon-sol-tools-44a430802e534f8b1eccb57ed87249925c32d4eb.tar.lz
dexon-sol-tools-44a430802e534f8b1eccb57ed87249925c32d4eb.tar.xz
dexon-sol-tools-44a430802e534f8b1eccb57ed87249925c32d4eb.tar.zst
dexon-sol-tools-44a430802e534f8b1eccb57ed87249925c32d4eb.zip
Merge branch 'development' of https://github.com/0xProject/0x-monorepo into website/feature/react-16
Diffstat (limited to 'packages/sra-spec/src/parameters.ts')
-rw-r--r--packages/sra-spec/src/parameters.ts39
1 files changed, 39 insertions, 0 deletions
diff --git a/packages/sra-spec/src/parameters.ts b/packages/sra-spec/src/parameters.ts
new file mode 100644
index 000000000..48ffb036d
--- /dev/null
+++ b/packages/sra-spec/src/parameters.ts
@@ -0,0 +1,39 @@
+import { ParameterObject } from '@loopback/openapi-v3-types';
+export const paginationParameters: ParameterObject[] = [
+ {
+ name: 'page',
+ in: 'query',
+ description: 'The number of the page to request in the collection.',
+ example: 3,
+ schema: {
+ type: 'number',
+ default: 1,
+ },
+ },
+ {
+ name: 'perPage',
+ in: 'query',
+ description: 'The number of records to return per page.',
+ example: 10,
+ schema: {
+ type: 'number',
+ default: 100,
+ },
+ },
+];
+
+export const networkdIdParameter: ParameterObject = {
+ name: 'networkId',
+ in: 'query',
+ description: 'The id of the Ethereum network',
+ example: 42,
+ schema: {
+ type: 'number',
+ default: 1,
+ },
+};
+
+export const generateParameters = (parameters: ParameterObject[], isPaginated: boolean = false): ParameterObject[] => {
+ const optionalParameters = isPaginated ? paginationParameters : [];
+ return [...parameters, networkdIdParameter, ...optionalParameters];
+};