From aab4a986ba4568b02563a92a05a843db16edbade Mon Sep 17 00:00:00 2001 From: Dan Garner Date: Tue, 8 Feb 2022 12:25:59 +0000 Subject: [PATCH 1/2] Prepare for 3.1.0-beta release. Update swagger. Connectors should use default http client. --- lib/Connector/ConnectorTrait.php | 4 + lib/Connector/PixabayConnector.php | 11 +- lib/Connector/XiboExchangeConnector.php | 3 +- web/swagger.json | 442 +++++++++++++++++++++++- 4 files changed, 453 insertions(+), 7 deletions(-) diff --git a/lib/Connector/ConnectorTrait.php b/lib/Connector/ConnectorTrait.php index 20a5f85a31..ac0366f7b7 100644 --- a/lib/Connector/ConnectorTrait.php +++ b/lib/Connector/ConnectorTrait.php @@ -120,6 +120,10 @@ public function useHttpOptions($options): ConnectorInterface return $this; } + /** + * Get an HTTP client with the default proxy settings, etc + * @return \GuzzleHttp\Client + */ public function getClient(): Client { return new Client($this->httpOptions); diff --git a/lib/Connector/PixabayConnector.php b/lib/Connector/PixabayConnector.php index 921a591988..3b3b81926b 100644 --- a/lib/Connector/PixabayConnector.php +++ b/lib/Connector/PixabayConnector.php @@ -23,7 +23,6 @@ namespace Xibo\Connector; use Carbon\Carbon; -use GuzzleHttp\Client; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Xibo\Entity\SearchResult; use Xibo\Event\LibraryProviderEvent; @@ -84,6 +83,12 @@ public function onLibraryProvider(LibraryProviderEvent $event) { $this->getLogger()->debug('onLibraryProvider'); + // Do we have an alternative URL (we may proxy requests for cache) + $baseUrl = $this->getSetting('proxyUri'); + if (empty($baseUrl)) { + $baseUrl = 'https://pixabay.com/api/'; + } + // Do we have an API key? $apiKey = $this->getSetting('apiKey'); if (empty($apiKey)) { @@ -138,9 +143,7 @@ public function onLibraryProvider(LibraryProviderEvent $event) $this->getLogger()->debug('onLibraryProvider: cache miss, generating.'); // Make the request - $client = new Client(); - $uri = $type === 'video' ? 'https://pixabay.com/api/videos' : 'https://pixabay.com/api/'; - $request = $client->request('GET', $uri, [ + $request = $this->getClient()->request('GET', $baseUrl . ($type === 'video' ? 'videos' : ''), [ 'query' => $query ]); diff --git a/lib/Connector/XiboExchangeConnector.php b/lib/Connector/XiboExchangeConnector.php index 71280bf801..494d9e38fa 100644 --- a/lib/Connector/XiboExchangeConnector.php +++ b/lib/Connector/XiboExchangeConnector.php @@ -101,8 +101,7 @@ public function onTemplateProvider(TemplateProviderEvent $event) $this->getLogger()->debug('onTemplateProvider: cache miss, generating.'); // Make the request - $client = new Client(); - $request = $client->request('GET', $uri); + $request = $this->getClient()->request('GET', $uri); $body = $request->getBody()->getContents(); if (empty($body)) { diff --git a/web/swagger.json b/web/swagger.json index b9cf8f2c3f..0f619fc2b3 100644 --- a/web/swagger.json +++ b/web/swagger.json @@ -250,6 +250,20 @@ "required": false, "type": "string" }, + { + "name": "exactTags", + "in": "query", + "description": "A flag indicating whether to treat the tags filter as an exact match", + "required": false, + "type": "integer" + }, + { + "name": "logicalOperator", + "in": "query", + "description": "When filtering by multiple Tags, which logical operator should be used? AND|OR", + "required": false, + "type": "string" + }, { "name": "hasLayouts", "in": "query", @@ -1522,6 +1536,13 @@ "description": "Flag indicating whether value must be provided for this Column.", "required": false, "type": "integer" + }, + { + "name": "dateFormat", + "in": "formData", + "description": "PHP date format for the dates in the source of the remote DataSet", + "required": false, + "type": "string" } ], "responses": { @@ -1639,6 +1660,13 @@ "description": "Flag indicating whether value must be provided for this Column.", "required": false, "type": "integer" + }, + { + "name": "dateFormat", + "in": "formData", + "description": "PHP date format for the dates in the source of the remote DataSet", + "required": false, + "type": "string" } ], "responses": { @@ -2273,6 +2301,27 @@ "required": false, "type": "string" }, + { + "name": "tags", + "in": "query", + "description": "Filter by tags", + "required": false, + "type": "string" + }, + { + "name": "exactTags", + "in": "query", + "description": "A flag indicating whether to treat the tags filter as an exact match", + "required": false, + "type": "integer" + }, + { + "name": "logicalOperator", + "in": "query", + "description": "When filtering by multiple Tags, which logical operator should be used? AND|OR", + "required": false, + "type": "string" + }, { "name": "macAddress", "in": "query", @@ -2816,6 +2865,27 @@ "required": false, "type": "string" }, + { + "name": "tags", + "in": "query", + "description": "Filter by tags", + "required": false, + "type": "string" + }, + { + "name": "exactTags", + "in": "query", + "description": "A flag indicating whether to treat the tags filter as an exact match", + "required": false, + "type": "integer" + }, + { + "name": "logicalOperator", + "in": "query", + "description": "When filtering by multiple Tags, which logical operator should be used? AND|OR", + "required": false, + "type": "string" + }, { "name": "isDisplaySpecific", "in": "query", @@ -2899,6 +2969,27 @@ "required": false, "type": "string" }, + { + "name": "dynamicCriteriaTags", + "in": "formData", + "description": "The filter criteria for this dynamic group. A comma separated set of regular expressions to apply", + "required": false, + "type": "string" + }, + { + "name": "exactTags", + "in": "formData", + "description": "When filtering by Tags, should we use exact match?", + "required": false, + "type": "integer" + }, + { + "name": "logicalOperator", + "in": "formData", + "description": "When filtering by Tags, which logical operator should be used? AND|OR", + "required": false, + "type": "string" + }, { "name": "folderId", "in": "formData", @@ -2974,6 +3065,27 @@ "required": false, "type": "string" }, + { + "name": "dynamicCriteriaTags", + "in": "formData", + "description": "The filter criteria for this dynamic group. A comma separated set of regular expressions to apply", + "required": false, + "type": "string" + }, + { + "name": "exactTags", + "in": "formData", + "description": "When filtering by Tags, should we use exact match?", + "required": false, + "type": "integer" + }, + { + "name": "logicalOperator", + "in": "formData", + "description": "When filtering by Tags, which logical operator should be used? AND|OR", + "required": false, + "type": "string" + }, { "name": "folderId", "in": "formData", @@ -4059,6 +4171,13 @@ "required": false, "type": "integer" }, + { + "name": "logicalOperator", + "in": "query", + "description": "When filtering by multiple Tags, which logical operator should be used? AND|OR", + "required": false, + "type": "string" + }, { "name": "ownerUserGroupId", "in": "query", @@ -4750,6 +4869,13 @@ "required": false, "type": "integer" }, + { + "name": "logicalOperator", + "in": "query", + "description": "When filtering by multiple Tags, which logical operator should be used? AND|OR", + "required": false, + "type": "string" + }, { "name": "duration", "in": "query", @@ -5455,6 +5581,13 @@ "description": "Filter by name", "required": false, "type": "string" + }, + { + "name": "code", + "in": "query", + "description": "Filter by code", + "required": false, + "type": "string" } ], "responses": { @@ -5493,6 +5626,13 @@ "required": false, "type": "string" }, + { + "name": "code", + "in": "formData", + "description": "Menu Board code identifier", + "required": false, + "type": "string" + }, { "name": "folderId", "in": "formData", @@ -5547,6 +5687,13 @@ "required": false, "type": "string" }, + { + "name": "code", + "in": "formData", + "description": "Menu Board code identifier", + "required": false, + "type": "string" + }, { "name": "folderId", "in": "formData", @@ -5647,6 +5794,13 @@ "description": "Filter by name", "required": false, "type": "string" + }, + { + "name": "code", + "in": "query", + "description": "Filter by code", + "required": false, + "type": "string" } ], "responses": { @@ -5691,6 +5845,13 @@ "description": "Media ID associated with this Menu Board Category", "required": false, "type": "integer" + }, + { + "name": "code", + "in": "formData", + "description": "Menu Board Category code identifier", + "required": false, + "type": "string" } ], "responses": { @@ -5738,6 +5899,13 @@ "description": "Media ID from CMS Library to associate with this Menu Board Category", "required": false, "type": "integer" + }, + { + "name": "code", + "in": "formData", + "description": "Menu Board Category code identifier", + "required": false, + "type": "string" } ], "responses": { @@ -5798,6 +5966,13 @@ "description": "Filter by name", "required": false, "type": "string" + }, + { + "name": "code", + "in": "query", + "description": "Filter by code", + "required": false, + "type": "string" } ], "responses": { @@ -5829,12 +6004,67 @@ "required": true, "type": "string" }, + { + "name": "description", + "in": "formData", + "description": "Menu Board Product description", + "required": false, + "type": "string" + }, + { + "name": "price", + "in": "formData", + "description": "Menu Board Product price, including the currency symbol if needed", + "required": true, + "type": "string" + }, + { + "name": "allergyInfo", + "in": "formData", + "description": "Menu Board Product allergyInfo", + "required": false, + "type": "string" + }, + { + "name": "availability", + "in": "formData", + "description": "Menu Board Product availability", + "required": false, + "type": "integer" + }, { "name": "mediaId", "in": "formData", - "description": "Media ID associated with this Menu Board Product", + "description": "Media ID from CMS Library to associate with this Menu Board Product", "required": false, "type": "integer" + }, + { + "name": "code", + "in": "formData", + "description": "Menu Board Product code", + "required": false, + "type": "string" + }, + { + "name": "productOptions", + "in": "formData", + "description": "An array of optional Product Option names", + "required": false, + "type": "array", + "items": { + "type": "string" + } + }, + { + "name": "productValues", + "in": "formData", + "description": "An array of optional Product Option values", + "required": false, + "type": "array", + "items": { + "type": "string" + } } ], "responses": { @@ -5911,6 +6141,13 @@ "required": false, "type": "integer" }, + { + "name": "code", + "in": "formData", + "description": "Menu Board Product code", + "required": false, + "type": "string" + }, { "name": "productOptions", "in": "formData", @@ -6592,6 +6829,13 @@ "required": false, "type": "integer" }, + { + "name": "logicalOperator", + "in": "query", + "description": "When filtering by multiple Tags, which logical operator should be used? AND|OR", + "required": false, + "type": "string" + }, { "name": "ownerUserGroupId", "in": "query", @@ -6669,6 +6913,20 @@ "required": false, "type": "string" }, + { + "name": "exactTags", + "in": "formData", + "description": "When filtering by Tags, should we use exact match?", + "required": false, + "type": "integer" + }, + { + "name": "logicalOperator", + "in": "formData", + "description": "When filtering by Tags, which logical operator should be used? AND|OR", + "required": false, + "type": "string" + }, { "name": "maxNumberOfItems", "in": "formData", @@ -6751,6 +7009,20 @@ "required": false, "type": "string" }, + { + "name": "exactTags", + "in": "formData", + "description": "When filtering by Tags, should we use exact match?", + "required": false, + "type": "integer" + }, + { + "name": "logicalOperator", + "in": "formData", + "description": "When filtering by Tags, which logical operator should be used? AND|OR", + "required": false, + "type": "string" + }, { "name": "maxNumberOfItems", "in": "formData", @@ -7370,6 +7642,13 @@ "required": false, "type": "string" }, + { + "name": "partialResolution", + "in": "query", + "description": "Filter by Partial Resolution Name", + "required": false, + "type": "string" + }, { "name": "enabled", "in": "query", @@ -9806,6 +10085,13 @@ "description": "Trigger code for a current event action", "required": false, "type": "string" + }, + { + "name": "backgroundColor", + "in": "formData", + "description": "A HEX color to use as the background color of this widget", + "required": false, + "type": "string" } ], "responses": { @@ -10676,6 +10962,20 @@ "description": "Optional StyleSheet Pass only with overrideTemplate set to 1 ", "required": false, "type": "string" + }, + { + "name": "alignH", + "in": "formData", + "description": "Horizontal alignment - left, center, bottom", + "required": false, + "type": "string" + }, + { + "name": "alignV", + "in": "formData", + "description": "Vertical alignment - top, middle, bottom", + "required": false, + "type": "string" } ], "responses": { @@ -10875,6 +11175,20 @@ "description": "Optional JavaScript, Pass only with overrideTemplate set to 1 ", "required": false, "type": "string" + }, + { + "name": "alignH", + "in": "formData", + "description": "Horizontal alignment - left, center, bottom", + "required": false, + "type": "string" + }, + { + "name": "alignV", + "in": "formData", + "description": "Vertical alignment - top, middle, bottom", + "required": false, + "type": "string" } ], "responses": { @@ -11534,6 +11848,20 @@ "description": "Optional JavaScript, Pass only with overrideTemplate set to 1 ", "required": false, "type": "string" + }, + { + "name": "alignH", + "in": "formData", + "description": "Horizontal alignment - left, center, bottom", + "required": false, + "type": "string" + }, + { + "name": "alignV", + "in": "formData", + "description": "Vertical alignment - top, middle, bottom", + "required": false, + "type": "string" } ], "responses": { @@ -11963,6 +12291,20 @@ "description": "The option (On, Off, Inherit) to enable the collection of Widget Proof of Play statistics", "required": false, "type": "string" + }, + { + "name": "alignH", + "in": "formData", + "description": "Horizontal alignment - left, center, bottom", + "required": false, + "type": "string" + }, + { + "name": "alignV", + "in": "formData", + "description": "Vertical alignment - top, middle, bottom", + "required": false, + "type": "string" } ], "responses": { @@ -12440,6 +12782,20 @@ "description": "Optional JavaScript, Pass only with overrideTemplate set to 1 ", "required": false, "type": "string" + }, + { + "name": "alignH", + "in": "formData", + "description": "Horizontal alignment - left, center, bottom", + "required": false, + "type": "string" + }, + { + "name": "alignV", + "in": "formData", + "description": "Vertical alignment - top, middle, bottom", + "required": false, + "type": "string" } ], "responses": { @@ -13101,6 +13457,20 @@ "description": "Optional JavaScript, Pass only with overrideTemplate set to 1 ", "required": false, "type": "string" + }, + { + "name": "alignH", + "in": "formData", + "description": "Horizontal alignment - left, center, bottom", + "required": false, + "type": "string" + }, + { + "name": "alignV", + "in": "formData", + "description": "Vertical alignment - top, middle, bottom", + "required": false, + "type": "string" } ], "responses": { @@ -13584,6 +13954,20 @@ "description": "Optional JavaScript, Pass only with overrideTemplate set to 1 ", "required": false, "type": "string" + }, + { + "name": "alignH", + "in": "formData", + "description": "Horizontal alignment - left, center, bottom", + "required": false, + "type": "string" + }, + { + "name": "alignV", + "in": "formData", + "description": "Vertical alignment - top, middle, bottom", + "required": false, + "type": "string" } ], "responses": { @@ -13967,6 +14351,30 @@ "isConfidential": { "description": "Flag indicating whether this Application will be confidential or not (can it keep a secret?)", "type": "integer" + }, + "description": { + "description": "Application description", + "type": "string" + }, + "logo": { + "description": "Path to Application logo", + "type": "string" + }, + "coverImage": { + "description": "Path to Application Cover Image", + "type": "string" + }, + "companyName": { + "description": "Company name associated with this Application", + "type": "string" + }, + "termsUrl": { + "description": "URL to Application terms", + "type": "string" + }, + "privacyUrl": { + "description": "URL to Application privacy policy", + "type": "string" } } }, @@ -14308,6 +14716,10 @@ "isRequired": { "description": "Flag indicating whether value must be provided for this Column.", "type": "integer" + }, + "dateFormat": { + "description": "Date format of dates in the source for remote DataSet.", + "type": "string" } } }, @@ -14621,6 +15033,14 @@ "description": "Criteria for this dynamic group. A comma separated set of tags to apply", "type": "string" }, + "dynamicCriteriaExactTags": { + "description": "Flag indicating whether to filter by exact Tag match", + "type": "integer" + }, + "dynamicCriteriaLogicalOperator": { + "description": "Which logical operator should be used when filtering by multiple Tags? OR|AND", + "type": "string" + }, "userId": { "description": "The UserId who owns this display group", "type": "integer" @@ -15037,6 +15457,10 @@ "description": "The Menu Board description", "type": "string" }, + "code": { + "description": "The Menu Board code identifier", + "type": "string" + }, "userId": { "description": "The Menu Board owner Id", "type": "integer" @@ -15073,6 +15497,10 @@ "description": "The Menu Board Category name", "type": "string" }, + "code": { + "description": "The Menu Board Category code identifier", + "type": "string" + }, "mediaId": { "description": "The Menu Board Category associated mediaId", "type": "integer" @@ -15105,6 +15533,10 @@ "description": "The Menu Board Product description", "type": "string" }, + "code": { + "description": "The Menu Board Product code identifier", + "type": "string" + }, "availability": { "description": "The Menu Board Product availability", "type": "string" @@ -15449,6 +15881,14 @@ "description": "Filter Tags for a Dynamic Playlist", "type": "string" }, + "filterExactTags": { + "description": "Flag indicating whether to filter by exact Tag match", + "type": "integer" + }, + "filterLogicalOperator": { + "description": "Which logical operator should be used when filtering by multiple Tags? OR|AND", + "type": "string" + }, "maxNumberOfItems": { "description": "Maximum number of Media items matching dynamic Playlist filters", "type": "integer" From db411005dc0d57ef3a83d2380e1fd25bd752ec51 Mon Sep 17 00:00:00 2001 From: Dan Garner Date: Tue, 8 Feb 2022 13:49:20 +0000 Subject: [PATCH 2/2] Connectors: fix incorrect setting name. --- lib/Connector/PixabayConnector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Connector/PixabayConnector.php b/lib/Connector/PixabayConnector.php index 3b3b81926b..7de217bb7a 100644 --- a/lib/Connector/PixabayConnector.php +++ b/lib/Connector/PixabayConnector.php @@ -84,7 +84,7 @@ public function onLibraryProvider(LibraryProviderEvent $event) $this->getLogger()->debug('onLibraryProvider'); // Do we have an alternative URL (we may proxy requests for cache) - $baseUrl = $this->getSetting('proxyUri'); + $baseUrl = $this->getSetting('baseUrl'); if (empty($baseUrl)) { $baseUrl = 'https://pixabay.com/api/'; }