Manage redirects, missing URLs, repositories and settings through the API
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
51
app/Http/Resources/RepositoryResource.php
Normal file
51
app/Http/Resources/RepositoryResource.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\Repository;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin Repository
|
||||
*/
|
||||
class RepositoryResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'provider' => $this->provider->value,
|
||||
'full_name' => $this->full_name,
|
||||
'project_id' => $this->project_id,
|
||||
'is_primary' => (bool) $this->is_primary,
|
||||
'show_publicly' => (bool) $this->show_publicly,
|
||||
|
||||
// What the provider last reported.
|
||||
'html_url' => $this->html_url,
|
||||
'description' => $this->description,
|
||||
'homepage' => $this->homepage,
|
||||
'default_branch' => $this->default_branch,
|
||||
'primary_language' => $this->primary_language,
|
||||
'license' => $this->license,
|
||||
'topics' => $this->topics ?? [],
|
||||
'stars' => (int) $this->stars,
|
||||
'forks' => (int) $this->forks,
|
||||
'open_issues_count' => (int) $this->open_issues_count,
|
||||
'is_archived' => (bool) $this->is_archived,
|
||||
'pushed_at' => $this->pushed_at?->toIso8601String(),
|
||||
|
||||
'last_synced_at' => $this->last_synced_at?->toIso8601String(),
|
||||
'sync_error' => $this->sync_error,
|
||||
'sync_failures' => (int) $this->sync_failures,
|
||||
|
||||
'created_at' => $this->created_at?->toIso8601String(),
|
||||
'updated_at' => $this->updated_at?->toIso8601String(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user