diff --git a/src/Actions/ManagesSitemaps.php b/src/Actions/ManagesSitemaps.php new file mode 100644 index 0000000..2356f1c --- /dev/null +++ b/src/Actions/ManagesSitemaps.php @@ -0,0 +1,26 @@ +get("sitemap/{$siteId}") ?? []; + + $issues = $this->transformCollection($response['issues'], SitemapIssue::class); + $sitemapIndexes = $this->transformCollection($response['sitemapIndexes'], SitemapIndex::class); + $sitemaps = $this->transformCollection($response['sitemaps'], Sitemap::class); + + $response['issues'] = $issues; + $response['sitemapIndexes'] = $sitemapIndexes; + $response['sitemaps'] = $sitemaps; + + return new SitemapResult($response); + } +} diff --git a/src/OhDear.php b/src/OhDear.php index 8986c7f..ce26ef2 100644 --- a/src/OhDear.php +++ b/src/OhDear.php @@ -21,6 +21,7 @@ use OhDear\PhpSdk\Actions\ManagesStatusPageUpdates; use OhDear\PhpSdk\Actions\ManagesUptime; use OhDear\PhpSdk\Actions\ManagesUsers; +use OhDear\PhpSdk\Actions\ManagesSitemaps; class OhDear { @@ -41,6 +42,7 @@ class OhDear use ManagesSites; use ManagesStatusPages; use ManagesStatusPageUpdates; + use ManagesSitemaps; use ManagesUptime; use ManagesUsers; diff --git a/src/Resources/Sitemap.php b/src/Resources/Sitemap.php new file mode 100644 index 0000000..cce9768 --- /dev/null +++ b/src/Resources/Sitemap.php @@ -0,0 +1,19 @@ + + */ + public array $issues; +} diff --git a/src/Resources/SitemapIndex.php b/src/Resources/SitemapIndex.php new file mode 100644 index 0000000..cb6039c --- /dev/null +++ b/src/Resources/SitemapIndex.php @@ -0,0 +1,13 @@ + + */ + public array $issues; +} diff --git a/src/Resources/SitemapIssue.php b/src/Resources/SitemapIssue.php new file mode 100644 index 0000000..28e7984 --- /dev/null +++ b/src/Resources/SitemapIssue.php @@ -0,0 +1,17 @@ + + */ + public array $issues; + + /* + * The sitemap indexes found along with any issues. + * @return array + */ + public array $sitemapIndexes; + + /* + * The sitemaps found. + * @return array + */ + public array $sitemaps; + + public function __construct(mixed $attributes, $ohDear = null) + { + parent::__construct($attributes, $ohDear); + } +}