Skip to content

Added some new repo APIs #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/Api/Repositories/Workspaces.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use Bitbucket\Api\Repositories\Workspaces\Forks;
use Bitbucket\Api\Repositories\Workspaces\Hooks;
use Bitbucket\Api\Repositories\Workspaces\Issues;
use Bitbucket\Api\Repositories\Workspaces\MergeBases;
use Bitbucket\Api\Repositories\Workspaces\Milestones;
use Bitbucket\Api\Repositories\Workspaces\Patches;
use Bitbucket\Api\Repositories\Workspaces\Pipelines;
Expand Down Expand Up @@ -281,6 +282,16 @@ public function issues(string $repo)
return new Issues($this->getHttpClient(), $this->workspace, $repo);
}

/**
* @param string $repo
*
* @return \Bitbucket\Api\Repositories\Workspaces\Patches
*/
public function mergeBases(string $repo)
{
return new MergeBases($this->getHttpClient(), $this->workspace, $repo);
}

/**
* @param string $repo
*
Expand Down
11 changes: 11 additions & 0 deletions src/Api/Repositories/Workspaces/Commit.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Bitbucket\Api\Repositories\Workspaces\Commit\Comments;
use Bitbucket\Api\Repositories\Workspaces\Commit\Properties as CommitProperties;
use Bitbucket\Api\Repositories\Workspaces\Commit\PullRequests as CommitPullRequests;
use Bitbucket\Api\Repositories\Workspaces\Commit\Reports;
use Bitbucket\Api\Repositories\Workspaces\Commit\Statuses;

/**
Expand Down Expand Up @@ -81,6 +82,16 @@ public function pullRequests(string $commit)
return new CommitPullRequests($this->getHttpClient(), $this->workspace, $this->repo, $commit);
}

/**
* @param string $commit
*
* @return \Bitbucket\Api\Repositories\Workspaces\Commit\Reports
*/
public function reports(string $commit)
{
return new Reports($this->getHttpClient(), $this->workspace, $this->repo, $commit);
}

/**
* @param string $commit
*
Expand Down
89 changes: 89 additions & 0 deletions src/Api/Repositories/Workspaces/Commit/Reports.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?php

declare(strict_types=1);

/*
* This file is part of Bitbucket API Client.
*
* (c) Graham Campbell <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Bitbucket\Api\Repositories\Workspaces\Commit;

use Bitbucket\Api\Repositories\Workspaces\Commit\Reports\Annotations;

/**
* The reports api class.
*
* @author Graham Campbell <[email protected]>
*/
class Reports extends AbstractCommitApi
{
/**
* @param array $params
*
* @throws \Http\Client\Exception
*
* @return array
*/
public function list(array $params = [])
{
$path = $this->buildReportsPath();

return $this->get($path, $params);
}

/**
* @param array $params
*
* @throws \Http\Client\Exception
*
* @return array
*/
public function create(array $params = [])
{
$path = $this->buildReportsPath();

return $this->post($path, $params);
}

/**
* @param string $report
* @param array $params
*
* @throws \Http\Client\Exception
*
* @return array
*/
public function show(string $report, array $params = [])
{
$path = $this->buildReportsPath($report);

return $this->get($path, $params);
}

/**
* @return \Bitbucket\Api\Repositories\Workspaces\Commit\Reports\Annotations
*/
public function annotations()
{
return new Annotations($this->getHttpClient(), $this->workspace, $this->repo, $this->commit);
}

/**
* Build the reports path from the given parts.
*
* @param string[] $parts
*
* @throws \Bitbucket\Exception\InvalidArgumentException
*
* @return string
*/
protected function buildReportsPath(string ...$parts)
{
return static::buildPath('repositories', $this->workspace, $this->repo, 'commit', $this->commit, 'reports', ...$parts);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

/*
* This file is part of Bitbucket API Client.
*
* (c) Graham Campbell <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Bitbucket\Api\Repositories\Workspaces\Commit\Reports;

use Bitbucket\Api\Repositories\Workspaces\Commit\AbstractCommitApi;

/**
* The abstract reports api class.
*
* @author Graham Campbell <[email protected]>
*/
abstract class AbstractReportsApi extends AbstractCommitApi
{
//
}
109 changes: 109 additions & 0 deletions src/Api/Repositories/Workspaces/Commit/Reports/Annotations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?php

declare(strict_types=1);

/*
* This file is part of Bitbucket API Client.
*
* (c) Graham Campbell <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Bitbucket\Api\Repositories\Workspaces\Commit\Reports;

/**
* The annotations api class.
*
* @author Graham Campbell <[email protected]>
*/
class Annotations extends AbstractReportsApi
{
/**
* @param array $params
*
* @throws \Http\Client\Exception
*
* @return array
*/
public function list(array $params = [])
{
$path = $this->buildAnnotationsPath();

return $this->get($path, $params);
}

/**
* @param array $params
*
* @throws \Http\Client\Exception
*
* @return array
*/
public function create(array $params = [])
{
$path = $this->buildAnnotationsPath();

return $this->post($path, $params);
}

/**
* @param string $annotation
* @param array $params
*
* @throws \Http\Client\Exception
*
* @return array
*/
public function show(string $annotation, array $params = [])
{
$path = $this->buildAnnotationsPath($annotation);

return $this->get($path, $params);
}

/**
* @param string $annotation
* @param array $params
*
* @throws \Http\Client\Exception
*
* @return array
*/
public function update(string $annotation, array $params = [])
{
$path = $this->buildAnnotationsPath($annotation);

return $this->put($path, $params);
}

/**
* @param string $annotation
* @param array $params
*
* @throws \Http\Client\Exception
*
* @return array
*/
public function remove(string $annotation, array $params = [])
{
$path = $this->buildAnnotationsPath($annotation);

return $this->delete($path, $params);
}

/**
* Annotations the build path from the given parts.
*
* @param string[] $parts
*
* @throws \Bitbucket\Exception\InvalidArgumentException
*
* @return string
*/
protected function buildAnnotationsPath(string ...$parts)
{
return static::buildPath('repositories', $this->workspace, $this->repo, 'commit', $this->commit, 'reports', 'annotations', ...$parts);
}
}
12 changes: 12 additions & 0 deletions src/Api/Repositories/Workspaces/Deployments.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

namespace Bitbucket\Api\Repositories\Workspaces;

use Bitbucket\Api\Repositories\Workspaces\Deployments\EnvironmentVariables;

/**
* The deployments api class.
*
Expand Down Expand Up @@ -49,6 +51,16 @@ public function show(string $deployments, array $params = [])
return $this->get($path, $params);
}

/**
* @param string $environment
*
* @return \Bitbucket\Api\Repositories\Workspaces\Deployments\EnvironmentVariables
*/
public function environmentVariables(string $environment)
{
return new EnvironmentVariables($this->getHttpClient(), $this->workspace, $this->repo, $environment);
}

/**
* Build the deployments path from the given parts.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

declare(strict_types=1);

/*
* This file is part of Bitbucket API Client.
*
* (c) Graham Campbell <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Bitbucket\Api\Repositories\Workspaces\Deployments;

use Bitbucket\Api\Repositories\Workspaces\AbstractWorkspacesApi;
use Http\Client\Common\HttpMethodsClientInterface;

/**
* The abstract deployments api class.
*
* @author Graham Campbell <[email protected]>
*/
abstract class AbstractDeploymentsApi extends AbstractWorkspacesApi
{
/**
* The environment.
*
* @var string
*/
protected $environment;

/**
* Create a new api instance.
*
* @param \Http\Client\Common\HttpMethodsClientInterface $client
* @param string $workspace
* @param string $repo
* @param string $environment
*/
public function __construct(HttpMethodsClientInterface $client, string $workspace, string $repo, string $environment)
{
parent::__construct($client, $workspace, $repo);
$this->environment = $environment;
}
}
Loading