Release of v4.0.0-alpha8

Add power path override option on component level. Fix the sql build feature. #1032.
This commit is contained in:
2024-04-06 23:29:23 +02:00
parent 23af2f0b29
commit 359b4dd92b
761 changed files with 1893 additions and 1235 deletions

View File

@@ -0,0 +1,72 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Admin;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Admin Cron
*
* @since 3.2.0
*/
class Cron extends Api
{
/**
* List cron tasks.
*
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(int $page = 1, int $limit = 10): ?array
{
// Build the request path.
$path = "/admin/cron";
// Set the query parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Run cron task.
*
* @param string $task The cron task to run.
*
* @return string
* @since 3.2.0
**/
public function run(string $task): string
{
// Build the request path.
$path = "/admin/cron/{$task}";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path)
), 204, 'success'
);
}
}

View File

@@ -0,0 +1,51 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Admin;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Admin Organizations
*
* @since 3.2.0
*/
class Organizations extends Api
{
/**
* List all organizations.
*
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(int $page = 1, int $limit = 10): ?array
{
// Build the request path.
$path = "/admin/orgs";
// Set the query parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
}

View File

@@ -0,0 +1,101 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Admin;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Admin Unadopted
*
* @since 3.2.0
*/
class Unadopted extends Api
{
/**
* List unadopted repositories.
*
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
* @param string $pattern Pattern of repositories to search for.
*
* @return array|null
* @since 3.2.0
**/
public function list(int $page = 1, int $limit = 10, string $pattern = ''): ?array
{
// Build the request path.
$path = "/admin/unadopted";
// Set the query parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
if (!empty($pattern))
{
$uri->setVar('pattern', $pattern);
}
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Adopt unadopted files as a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
*
* @return string
* @since 3.2.0
**/
public function adopt(string $owner, string $repo): string
{
// Build the request path.
$path = "/admin/unadopted/{$owner}/{$repo}";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), ''
), 204, 'success'
);
}
/**
* Delete unadopted files.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
*
* @return string
* @since 3.2.0
**/
public function delete(string $owner, string $repo): string
{
// Build the request path.
$path = "/admin/unadopted/{$owner}/{$repo}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}

View File

@@ -0,0 +1,207 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Admin;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Admin Users
*
* @since 3.2.0
*/
class Users extends Api
{
/**
* List all users.
*
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(int $page = 1, int $limit = 10): ?array
{
// Build the request path.
$path = "/admin/users";
// build the URL
$url = $this->uri->get($path);
$url->setVar('page', $page);
$url->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($url)
);
}
/**
* Create a user with extended options.
*
* @param string $loginName The user's login name.
* @param string $email The user's email address.
* @param string $password The user's password.
* @param string|null $username The username.
* @param string|null $fullName The user's full name (optional).
* @param bool|null $mustChangePassword User must change password on next login (optional).
* @param bool|null $restricted Restrict the user (optional).
* @param bool|null $sendNotify Send a notification email to the user (optional).
* @param int|null $sourceId Source ID (optional).
* @param string|null $visibility The user's visibility (optional).
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $loginName,
string $email,
string $password,
string $username,
?string $fullName = null,
?bool $mustChangePassword = null,
?bool $restricted = null,
?bool $sendNotify = null,
?int $sourceId = null,
?string $visibility = null
): ?object
{
// Build the request path.
$path = "/admin/users";
// Set the user data.
$data = new \stdClass();
$data->login_name = $loginName;
$data->email = $email;
$data->password = $password;
$data->username = $username;
$data->full_name = $fullName;
$data->must_change_password = $mustChangePassword;
$data->restricted = $restricted;
$data->send_notify = $sendNotify;
$data->source_id = $sourceId;
$data->visibility = $visibility;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
/**
* Delete a user.
*
* @param string $username The user's display name.
*
* @return string
* @since 3.2.0
**/
public function delete(string $username): string
{
// Build the request path.
$path = "/admin/users/{$username}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Edit an existing user.
*
* @param string $username The user's display name.
* @param string $loginName The user's login name.
* @param int $sourceId The user's source ID.
* @param bool $active Optional. Is the user active? Default: false.
* @param bool $admin Optional. Is the user an admin? Default: false.
* @param bool $allowCreateOrganization Optional. Can the user create an organization? Default: false.
* @param bool $allowGitHook Optional. Can the user create Git hooks? Default: false.
* @param bool $allowImportLocal Optional. Can the user import local repositories? Default: false.
* @param string $description Optional. The user's description. Default: ''.
* @param string $email Optional. The user's email address. Default: ''.
* @param string $fullName Optional. The user's full name. Default: ''.
* @param string $location Optional. The user's location. Default: ''.
* @param int $maxRepoCreation Optional. Maximum repositories the user can create. Default: 0.
* @param bool $mustChangePassword Optional. Must the user change their password? Default: false.
* @param string $password Optional. The user's password. Default: ''.
* @param bool $prohibitLogin Optional. Is the user's login prohibited? Default: false.
* @param bool $restricted Optional. Is the user restricted? Default: false.
* @param string $visibility Optional. The user's visibility setting. Default: ''.
* @param string $website Optional. The user's website. Default: ''.
*
* @return object|null
* @since 3.2.0
**/
public function edit(
string $username,
string $loginName,
int $sourceId,
bool $active = false,
bool $admin = false,
bool $allowCreateOrganization = false,
bool $allowGitHook = false,
bool $allowImportLocal = false,
string $description = '',
string $email = '',
string $fullName = '',
string $location = '',
int $maxRepoCreation = 0,
bool $mustChangePassword = false,
string $password = '',
bool $prohibitLogin = false,
bool $restricted = false,
string $visibility = '',
string $website = ''
): ?object
{
// Build the request path.
$path = "/admin/users/{$username}";
// Set the data.
$data = [
'login_name' => $loginName,
'source_id' => $sourceId,
'active' => $active,
'admin' => $admin,
'allow_create_organization' => $allowCreateOrganization,
'allow_git_hook' => $allowGitHook,
'allow_import_local' => $allowImportLocal,
'description' => $description,
'email' => $email,
'full_name' => $fullName,
'location' => $location,
'max_repo_creation' => $maxRepoCreation,
'must_change_password' => $mustChangePassword,
'password' => $password,
'prohibit_login' => $prohibitLogin,
'restricted' => $restricted,
'visibility' => $visibility,
'website' => $website
];
// Send the patch request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path), json_encode($data)
)
);
}
}

View File

@@ -0,0 +1,86 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Admin\Users;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Admin Users Keys
*
* @since 3.2.0
*/
class Keys extends Api
{
/**
* Add a public key on behalf of a user.
*
* @param string $userName The user's display name.
* @param string $publicKey The public key to add.
* @param string $keyTitle Title of the key to add.
* @param bool $readOnly Whether the key has only read access or read/write (optional).
* @param string|null $description Description of the key (optional).
*
* @return object|null
* @since 3.2.0
**/
public function add(
string $userName,
string $publicKey,
string $keyTitle,
bool $readOnly = false,
?string $description = null
): ?object
{
// Build the request path.
$path = "/admin/users/{$userName}/keys";
// Set the key data.
$data = new \stdClass();
$data->key = $publicKey;
$data->title = $keyTitle;
$data->read_only = $readOnly;
$data->description = $description;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
/**
* Delete a user's public key.
*
* @param string $username The user's display name.
* @param int $id The public key ID.
*
* @return string
* @since 3.2.0
**/
public function delete(string $username, int $id): string
{
// Build the request path.
$path = "/admin/users/{$username}/keys/{$id}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}

View File

@@ -0,0 +1,70 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Admin\Users;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Admin Users Organization
*
* @since 3.2.0
*/
class Organization extends Api
{
/**
* Create an organization on behalf of a user.
*
* @param string $username The user's display name.
* @param string $fullName The organization full name.
* @param string|null $description The organization description (optional).
* @param string|null $location The organization location (optional).
* @param bool $repoAdminChangeTeamAccess Whether repo admin can change team access (optional).
* @param string $visibility The organization visibility (optional).
* @param string|null $website The organization website (optional).
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $username,
string $fullName,
?string $description = null,
?string $location = null,
bool $repoAdminChangeTeamAccess = false,
string $visibility = 'public',
?string $website = null
): ?object
{
// Build the request path.
$path = "/admin/users/{$username}/orgs";
// Set the organization data.
$data = new \stdClass();
$data->full_name = $fullName;
$data->description = $description;
$data->location = $location;
$data->repo_admin_change_team_access = $repoAdminChangeTeamAccess;
$data->visibility = $visibility;
$data->website = $website;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
}

View File

@@ -0,0 +1,85 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Gitea\Admin\Users;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Admin Users Repository
*
* @since 3.2.0
*/
class Repository extends Api
{
/**
* Create a repository on behalf of a user.
*
* @param string $username The user's display name.
* @param string $repoName The repository name.
* @param string|null $description The repository description (optional).
* @param bool $auto_init Whether the repository should be auto-initialized? (optional).
* @param string|null $default_branch Default branch of the repository (optional).
* @param string|null $gitignores Gitignores to use (optional).
* @param string|null $issue_labels Label-Set to use (optional).
* @param string|null $license License to use (optional).
* @param bool $private Whether the repository is private (optional).
* @param string|null $readme Readme of the repository to create (optional).
* @param bool $template Whether the repository is template (optional).
* @param string|null $trust_model TrustModel of the repository (optional).
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $username,
string $repoName,
?string $description = null,
bool $auto_init = false,
?string $default_branch = null,
?string $gitignores = null,
?string $issue_labels = null,
?string $license = null,
bool $private = false,
?string $readme = null,
bool $template = false,
?string $trust_model = null
): ?object
{
// Build the request path.
$path = "/admin/users/{$username}/repos";
// Set the repository data.
$data = new \stdClass();
$data->name = $repoName;
$data->description = $description;
$data->auto_init = $auto_init;
$data->default_branch = $default_branch;
$data->gitignores = $gitignores;
$data->issue_labels = $issue_labels;
$data->license = $license;
$data->private = $private;
$data->readme = $readme;
$data->template = $template;
$data->trust_model = $trust_model;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
}

View File

@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>