From 4685572deffa3d4f59d5dac0321fc76d0803e8da Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Fri, 29 Nov 2019 19:09:03 +0100 Subject: [PATCH] Added version param to endpoints --- .../definitions/InvalidShortUrlMeta.json | 6 ---- docs/swagger/parameters/version.json | 13 +++++++ docs/swagger/paths/v1_short-urls.json | 21 ++++++++++- docs/swagger/paths/v1_short-urls_shorten.json | 3 ++ .../paths/v1_short-urls_{shortCode}.json | 36 ++++++++++++++++++- .../paths/v1_short-urls_{shortCode}_tags.json | 3 ++ .../v1_short-urls_{shortCode}_visits.json | 3 ++ docs/swagger/paths/v1_tags.json | 18 ++++++++++ docs/swagger/swagger.json | 12 +++---- 9 files changed, 101 insertions(+), 14 deletions(-) delete mode 100644 docs/swagger/definitions/InvalidShortUrlMeta.json create mode 100644 docs/swagger/parameters/version.json diff --git a/docs/swagger/definitions/InvalidShortUrlMeta.json b/docs/swagger/definitions/InvalidShortUrlMeta.json deleted file mode 100644 index ebe1fa34..00000000 --- a/docs/swagger/definitions/InvalidShortUrlMeta.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "type": "object", - "properties": { - - } -} diff --git a/docs/swagger/parameters/version.json b/docs/swagger/parameters/version.json new file mode 100644 index 00000000..c2b1cc1a --- /dev/null +++ b/docs/swagger/parameters/version.json @@ -0,0 +1,13 @@ +{ + "name": "version", + "description": "The API version to be consumed", + "in": "path", + "required": true, + "schema": { + "type": "string", + "enum": [ + "2", + "1" + ] + } +} diff --git a/docs/swagger/paths/v1_short-urls.json b/docs/swagger/paths/v1_short-urls.json index 07ed36cc..a8bf0368 100644 --- a/docs/swagger/paths/v1_short-urls.json +++ b/docs/swagger/paths/v1_short-urls.json @@ -7,6 +7,9 @@ "summary": "List short URLs", "description": "Returns the list of short URLs.

**Important note**: Before shlink v1.13, this endpoint used to use the `/short-codes` path instead of `/short-urls`. Both of them will keep working, while the first one is considered deprecated.", "parameters": [ + { + "$ref": "../parameters/version.json" + }, { "name": "page", "in": "query", @@ -175,6 +178,11 @@ "Bearer": [] } ], + "parameters": [ + { + "$ref": "../parameters/version.json" + } + ], "requestBody": { "description": "Request body.", "required": true, @@ -269,7 +277,18 @@ "type": "object", "properties": { "invalidElements": { - "$ref": "./InvalidShortUrlMeta.json" + "type": "array", + "items": { + "type": "string", + "enum": [ + "validSince", + "validUntil", + "customSlug", + "maxVisits", + "findIfExists", + "domain" + ] + } }, "url": { "type": "string", diff --git a/docs/swagger/paths/v1_short-urls_shorten.json b/docs/swagger/paths/v1_short-urls_shorten.json index d1887ddd..49233c49 100644 --- a/docs/swagger/paths/v1_short-urls_shorten.json +++ b/docs/swagger/paths/v1_short-urls_shorten.json @@ -7,6 +7,9 @@ "summary": "Create a short URL", "description": "Creates a short URL in a single API call. Useful for third party integrations.

**Important note**: Before shlink v1.13, this endpoint used to use the `/short-codes` path instead of `/short-urls`. Both of them will keep working, while the first one is considered deprecated.", "parameters": [ + { + "$ref": "../parameters/version.json" + }, { "name": "apiKey", "in": "query", diff --git a/docs/swagger/paths/v1_short-urls_{shortCode}.json b/docs/swagger/paths/v1_short-urls_{shortCode}.json index 0a5cbed7..1588d71c 100644 --- a/docs/swagger/paths/v1_short-urls_{shortCode}.json +++ b/docs/swagger/paths/v1_short-urls_{shortCode}.json @@ -7,6 +7,9 @@ "summary": "Parse short code", "description": "Get the long URL behind a short URL's short code.

**Important note**: Before shlink v1.13, this endpoint used to use the `/short-codes` path instead of `/short-urls`. Both of them will keep working, while the first one is considered deprecated.", "parameters": [ + { + "$ref": "../parameters/version.json" + }, { "name": "shortCode", "in": "path", @@ -93,6 +96,9 @@ "summary": "Edit short URL", "description": "Update certain meta arguments from an existing short URL.

**Important note**: Before shlink v1.13, this endpoint used to use the `/short-codes` path instead of `/short-urls`. Both of them will keep working, while the first one is considered deprecated.", "parameters": [ + { + "$ref": "../parameters/version.json" + }, { "name": "shortCode", "in": "path", @@ -145,7 +151,29 @@ "content": { "application/problem+json": { "schema": { - "$ref": "../definitions/Error.json" + "type": "object", + "allOf": [ + { + "$ref": "./Error.json" + }, + { + "type": "object", + "required": ["invalidElements"], + "properties": { + "invalidElements": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "validSince", + "validUntil", + "maxVisits" + ] + } + } + } + } + ] } } } @@ -182,6 +210,9 @@ "summary": "[DEPRECATED] Edit short URL", "description": "**[DEPRECATED]** Use [editShortUrl](#/Short_URLs/getShortUrl) instead", "parameters": [ + { + "$ref": "../parameters/version.json" + }, { "name": "shortCode", "in": "path", @@ -270,6 +301,9 @@ "summary": "Delete short URL", "description": "Deletes the short URL for provided short code.

**Important note**: Before shlink v1.13, this endpoint used to use the `/short-codes` path instead of `/short-urls`. Both of them will keep working, while the first one is considered deprecated.", "parameters": [ + { + "$ref": "../parameters/version.json" + }, { "name": "shortCode", "in": "path", diff --git a/docs/swagger/paths/v1_short-urls_{shortCode}_tags.json b/docs/swagger/paths/v1_short-urls_{shortCode}_tags.json index de3d0c9b..45142e62 100644 --- a/docs/swagger/paths/v1_short-urls_{shortCode}_tags.json +++ b/docs/swagger/paths/v1_short-urls_{shortCode}_tags.json @@ -7,6 +7,9 @@ "summary": "Edit tags on short URL", "description": "Edit the tags on URL identified by provided short code.

**Important note**: Before shlink v1.13, this endpoint used to use the `/short-codes` path instead of `/short-urls`. Both of them will keep working, while the first one is considered deprecated.", "parameters": [ + { + "$ref": "../parameters/version.json" + }, { "name": "shortCode", "in": "path", diff --git a/docs/swagger/paths/v1_short-urls_{shortCode}_visits.json b/docs/swagger/paths/v1_short-urls_{shortCode}_visits.json index d5dd243c..508449de 100644 --- a/docs/swagger/paths/v1_short-urls_{shortCode}_visits.json +++ b/docs/swagger/paths/v1_short-urls_{shortCode}_visits.json @@ -7,6 +7,9 @@ "summary": "List visits for short URL", "description": "Get the list of visits on the short URL behind provided short code.

**Important note**: Before shlink v1.13, this endpoint used to use the `/short-codes` path instead of `/short-urls`. Both of them will keep working, while the first one is considered deprecated.", "parameters": [ + { + "$ref": "../parameters/version.json" + }, { "name": "shortCode", "in": "path", diff --git a/docs/swagger/paths/v1_tags.json b/docs/swagger/paths/v1_tags.json index faa83ed9..da0159bd 100644 --- a/docs/swagger/paths/v1_tags.json +++ b/docs/swagger/paths/v1_tags.json @@ -14,6 +14,11 @@ "Bearer": [] } ], + "parameters": [ + { + "$ref": "../parameters/version.json" + } + ], "responses": { "200": { "description": "The list of tags", @@ -78,6 +83,11 @@ "Bearer": [] } ], + "parameters": [ + { + "$ref": "../parameters/version.json" + } + ], "requestBody": { "description": "Request body.", "required": true, @@ -165,6 +175,11 @@ "Bearer": [] } ], + "parameters": [ + { + "$ref": "../parameters/version.json" + } + ], "requestBody": { "description": "Request body.", "required": true, @@ -235,6 +250,9 @@ "summary": "Delete tags", "description": "Deletes provided list of tags", "parameters": [ + { + "$ref": "../parameters/version.json" + }, { "name": "tags[]", "in": "query", diff --git a/docs/swagger/swagger.json b/docs/swagger/swagger.json index 2d0cb1c1..d924b8a0 100644 --- a/docs/swagger/swagger.json +++ b/docs/swagger/swagger.json @@ -71,24 +71,24 @@ ], "paths": { - "/rest/v2/short-urls": { + "/rest/v{version}/short-urls": { "$ref": "paths/v1_short-urls.json" }, - "/rest/v2/short-urls/shorten": { + "/rest/v{version}/short-urls/shorten": { "$ref": "paths/v1_short-urls_shorten.json" }, - "/rest/v2/short-urls/{shortCode}": { + "/rest/v{version}/short-urls/{shortCode}": { "$ref": "paths/v1_short-urls_{shortCode}.json" }, - "/rest/v2/short-urls/{shortCode}/tags": { + "/rest/v{version}/short-urls/{shortCode}/tags": { "$ref": "paths/v1_short-urls_{shortCode}_tags.json" }, - "/rest/v2/tags": { + "/rest/v{version}/tags": { "$ref": "paths/v1_tags.json" }, - "/rest/v2/short-urls/{shortCode}/visits": { + "/rest/v{version}/short-urls/{shortCode}/visits": { "$ref": "paths/v1_short-urls_{shortCode}_visits.json" },