mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Documented new title prop in swagger docs
This commit is contained in:
@@ -34,7 +34,13 @@
|
|||||||
},
|
},
|
||||||
"domain": {
|
"domain": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"nullable": true,
|
||||||
"description": "The domain in which the short URL was created. Null if it belongs to default domain."
|
"description": "The domain in which the short URL was created. Null if it belongs to default domain."
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"type": "string",
|
||||||
|
"nullable": true,
|
||||||
|
"description": "A descriptive title of the short URL."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,7 +137,8 @@
|
|||||||
"validUntil": null,
|
"validUntil": null,
|
||||||
"maxVisits": 100
|
"maxVisits": 100
|
||||||
},
|
},
|
||||||
"domain": null
|
"domain": null,
|
||||||
|
"title": "Welcome to Steam"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortCode": "12Kb3",
|
"shortCode": "12Kb3",
|
||||||
@@ -153,7 +154,8 @@
|
|||||||
"validUntil": null,
|
"validUntil": null,
|
||||||
"maxVisits": null
|
"maxVisits": null
|
||||||
},
|
},
|
||||||
"domain": null
|
"domain": null,
|
||||||
|
"title": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortCode": "123bA",
|
"shortCode": "123bA",
|
||||||
@@ -167,7 +169,8 @@
|
|||||||
"validUntil": null,
|
"validUntil": null,
|
||||||
"maxVisits": null
|
"maxVisits": null
|
||||||
},
|
},
|
||||||
"domain": "example.com"
|
"domain": "example.com",
|
||||||
|
"title": null
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"pagination": {
|
"pagination": {
|
||||||
@@ -264,6 +267,10 @@
|
|||||||
"validateUrl": {
|
"validateUrl": {
|
||||||
"description": "Tells if the long URL should or should not be validated as a reachable URL. If not provided, it will fall back to app-level config",
|
"description": "Tells if the long URL should or should not be validated as a reachable URL. If not provided, it will fall back to app-level config",
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "A descriptive title of the short URL."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,8 @@
|
|||||||
"validUntil": null,
|
"validUntil": null,
|
||||||
"maxVisits": 100
|
"maxVisits": 100
|
||||||
},
|
},
|
||||||
"domain": null
|
"domain": null,
|
||||||
|
"title": null
|
||||||
},
|
},
|
||||||
"text/plain": "https://doma.in/abc123"
|
"text/plain": "https://doma.in/abc123"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,8 @@
|
|||||||
"validUntil": null,
|
"validUntil": null,
|
||||||
"maxVisits": 100
|
"maxVisits": 100
|
||||||
},
|
},
|
||||||
"domain": null
|
"domain": null,
|
||||||
|
"title": null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -118,15 +119,18 @@
|
|||||||
},
|
},
|
||||||
"validSince": {
|
"validSince": {
|
||||||
"description": "The date (in ISO-8601 format) from which this short code will be valid",
|
"description": "The date (in ISO-8601 format) from which this short code will be valid",
|
||||||
"type": "string"
|
"type": "string",
|
||||||
|
"nullable": true
|
||||||
},
|
},
|
||||||
"validUntil": {
|
"validUntil": {
|
||||||
"description": "The date (in ISO-8601 format) until which this short code will be valid",
|
"description": "The date (in ISO-8601 format) until which this short code will be valid",
|
||||||
"type": "string"
|
"type": "string",
|
||||||
|
"nullable": true
|
||||||
},
|
},
|
||||||
"maxVisits": {
|
"maxVisits": {
|
||||||
"description": "The maximum number of allowed visits for this short code",
|
"description": "The maximum number of allowed visits for this short code",
|
||||||
"type": "number"
|
"type": "number",
|
||||||
|
"nullable": true
|
||||||
},
|
},
|
||||||
"validateUrl": {
|
"validateUrl": {
|
||||||
"description": "Tells if the long URL (if provided) should or should not be validated as a reachable URL. If not provided, it will fall back to app-level config",
|
"description": "Tells if the long URL (if provided) should or should not be validated as a reachable URL. If not provided, it will fall back to app-level config",
|
||||||
@@ -138,6 +142,11 @@
|
|||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"description": "The list of tags to set to the short URL."
|
"description": "The list of tags to set to the short URL."
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "A descriptive title of the short URL.",
|
||||||
|
"nullable": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,7 +183,8 @@
|
|||||||
"validUntil": null,
|
"validUntil": null,
|
||||||
"maxVisits": 100
|
"maxVisits": 100
|
||||||
},
|
},
|
||||||
"domain": null
|
"domain": null,
|
||||||
|
"title": "Shlink - The URL shortener"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -184,6 +184,9 @@ class ShortUrl extends AbstractEntity
|
|||||||
$relationResolver = $relationResolver ?? new SimpleShortUrlRelationResolver();
|
$relationResolver = $relationResolver ?? new SimpleShortUrlRelationResolver();
|
||||||
$this->tags = $relationResolver->resolveTags($shortUrlEdit->tags());
|
$this->tags = $relationResolver->resolveTags($shortUrlEdit->tags());
|
||||||
}
|
}
|
||||||
|
if ($shortUrlEdit->hasTitle()) {
|
||||||
|
$this->title = $shortUrlEdit->title();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ final class ShortUrlEdit
|
|||||||
private ?int $maxVisits = null;
|
private ?int $maxVisits = null;
|
||||||
private bool $tagsPropWasProvided = false;
|
private bool $tagsPropWasProvided = false;
|
||||||
private array $tags = [];
|
private array $tags = [];
|
||||||
|
private bool $titlePropWasProvided = false;
|
||||||
|
private ?string $title = null;
|
||||||
private ?bool $validateUrl = null;
|
private ?bool $validateUrl = null;
|
||||||
|
|
||||||
private function __construct()
|
private function __construct()
|
||||||
@@ -56,6 +58,7 @@ final class ShortUrlEdit
|
|||||||
$this->validUntilPropWasProvided = array_key_exists(ShortUrlInputFilter::VALID_UNTIL, $data);
|
$this->validUntilPropWasProvided = array_key_exists(ShortUrlInputFilter::VALID_UNTIL, $data);
|
||||||
$this->maxVisitsPropWasProvided = array_key_exists(ShortUrlInputFilter::MAX_VISITS, $data);
|
$this->maxVisitsPropWasProvided = array_key_exists(ShortUrlInputFilter::MAX_VISITS, $data);
|
||||||
$this->tagsPropWasProvided = array_key_exists(ShortUrlInputFilter::TAGS, $data);
|
$this->tagsPropWasProvided = array_key_exists(ShortUrlInputFilter::TAGS, $data);
|
||||||
|
$this->titlePropWasProvided = array_key_exists(ShortUrlInputFilter::TITLE, $data);
|
||||||
|
|
||||||
$this->longUrl = $inputFilter->getValue(ShortUrlInputFilter::LONG_URL);
|
$this->longUrl = $inputFilter->getValue(ShortUrlInputFilter::LONG_URL);
|
||||||
$this->validSince = parseDateField($inputFilter->getValue(ShortUrlInputFilter::VALID_SINCE));
|
$this->validSince = parseDateField($inputFilter->getValue(ShortUrlInputFilter::VALID_SINCE));
|
||||||
@@ -63,6 +66,7 @@ final class ShortUrlEdit
|
|||||||
$this->maxVisits = getOptionalIntFromInputFilter($inputFilter, ShortUrlInputFilter::MAX_VISITS);
|
$this->maxVisits = getOptionalIntFromInputFilter($inputFilter, ShortUrlInputFilter::MAX_VISITS);
|
||||||
$this->validateUrl = getOptionalBoolFromInputFilter($inputFilter, ShortUrlInputFilter::VALIDATE_URL);
|
$this->validateUrl = getOptionalBoolFromInputFilter($inputFilter, ShortUrlInputFilter::VALIDATE_URL);
|
||||||
$this->tags = $inputFilter->getValue(ShortUrlInputFilter::TAGS);
|
$this->tags = $inputFilter->getValue(ShortUrlInputFilter::TAGS);
|
||||||
|
$this->title = $inputFilter->getValue(ShortUrlInputFilter::TITLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function longUrl(): ?string
|
public function longUrl(): ?string
|
||||||
@@ -118,6 +122,16 @@ final class ShortUrlEdit
|
|||||||
return $this->tagsPropWasProvided;
|
return $this->tagsPropWasProvided;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function title(): ?string
|
||||||
|
{
|
||||||
|
return $this->title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasTitle(): bool
|
||||||
|
{
|
||||||
|
return $this->titlePropWasProvided;
|
||||||
|
}
|
||||||
|
|
||||||
public function doValidateUrl(): ?bool
|
public function doValidateUrl(): ?bool
|
||||||
{
|
{
|
||||||
return $this->validateUrl;
|
return $this->validateUrl;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ class ListShortUrlsTest extends ApiTestCase
|
|||||||
'maxVisits' => null,
|
'maxVisits' => null,
|
||||||
],
|
],
|
||||||
'domain' => null,
|
'domain' => null,
|
||||||
|
'title' => 'Shlink',
|
||||||
];
|
];
|
||||||
private const SHORT_URL_DOCS = [
|
private const SHORT_URL_DOCS = [
|
||||||
'shortCode' => 'ghi789',
|
'shortCode' => 'ghi789',
|
||||||
@@ -39,6 +40,7 @@ class ListShortUrlsTest extends ApiTestCase
|
|||||||
'maxVisits' => null,
|
'maxVisits' => null,
|
||||||
],
|
],
|
||||||
'domain' => null,
|
'domain' => null,
|
||||||
|
'title' => null,
|
||||||
];
|
];
|
||||||
private const SHORT_URL_CUSTOM_SLUG_AND_DOMAIN = [
|
private const SHORT_URL_CUSTOM_SLUG_AND_DOMAIN = [
|
||||||
'shortCode' => 'custom-with-domain',
|
'shortCode' => 'custom-with-domain',
|
||||||
@@ -53,6 +55,7 @@ class ListShortUrlsTest extends ApiTestCase
|
|||||||
'maxVisits' => null,
|
'maxVisits' => null,
|
||||||
],
|
],
|
||||||
'domain' => 'some-domain.com',
|
'domain' => 'some-domain.com',
|
||||||
|
'title' => null,
|
||||||
];
|
];
|
||||||
private const SHORT_URL_META = [
|
private const SHORT_URL_META = [
|
||||||
'shortCode' => 'def456',
|
'shortCode' => 'def456',
|
||||||
@@ -69,6 +72,7 @@ class ListShortUrlsTest extends ApiTestCase
|
|||||||
'maxVisits' => null,
|
'maxVisits' => null,
|
||||||
],
|
],
|
||||||
'domain' => null,
|
'domain' => null,
|
||||||
|
'title' => null,
|
||||||
];
|
];
|
||||||
private const SHORT_URL_CUSTOM_SLUG = [
|
private const SHORT_URL_CUSTOM_SLUG = [
|
||||||
'shortCode' => 'custom',
|
'shortCode' => 'custom',
|
||||||
@@ -83,6 +87,7 @@ class ListShortUrlsTest extends ApiTestCase
|
|||||||
'maxVisits' => 2,
|
'maxVisits' => 2,
|
||||||
],
|
],
|
||||||
'domain' => null,
|
'domain' => null,
|
||||||
|
'title' => null,
|
||||||
];
|
];
|
||||||
private const SHORT_URL_CUSTOM_DOMAIN = [
|
private const SHORT_URL_CUSTOM_DOMAIN = [
|
||||||
'shortCode' => 'ghi789',
|
'shortCode' => 'ghi789',
|
||||||
@@ -99,6 +104,7 @@ class ListShortUrlsTest extends ApiTestCase
|
|||||||
'maxVisits' => null,
|
'maxVisits' => null,
|
||||||
],
|
],
|
||||||
'domain' => 'example.com',
|
'domain' => 'example.com',
|
||||||
|
'title' => null,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ class ShortUrlsFixture extends AbstractFixture implements DependentFixtureInterf
|
|||||||
'apiKey' => $authorApiKey,
|
'apiKey' => $authorApiKey,
|
||||||
'longUrl' => 'https://shlink.io',
|
'longUrl' => 'https://shlink.io',
|
||||||
'tags' => ['foo'],
|
'tags' => ['foo'],
|
||||||
|
'title' => 'Shlink',
|
||||||
]), $relationResolver),
|
]), $relationResolver),
|
||||||
'2018-05-01',
|
'2018-05-01',
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user