PHP Интерфейс Gush\Adapter\Adapter

Note that each adapter instance can be only used for one repository.
Показать файл Открыть проект Примеры использования интерфейса

Открытые методы

Метод Описание
authenticate ( ) : boolean Authenticates the Adapter.
closePullRequest ( integer $id ) Close a pull-request by id.
createComment ( integer $id, string $message ) : string | null Creates a new a comment on an issue/pull-request.
createFork ( string $org ) : array Creates a fork from upstream and returns an array with the forked url.
createRelease ( string $name, array $parameters = [] ) : array Creates a new release.
createReleaseAssets ( integer $id, string $name, string $contentType, string $content ) : integer Creates a new release asset.
createRepo ( string $name, string $description, string $homepage, boolean $public = true, null $organization = null, boolean $hasIssues = true, boolean $hasWiki = false, boolean $hasDownloads = false, integer $teamId, boolean $autoInit = true ) : array
getComments ( integer $id ) : array[] Gets comments of a pull-request.
getLabels ( ) : string[] Gets the supported labels.
getMilestones ( array $parameters = [] ) : string[] Gets the supported milestones.
getPullRequest ( integer $id ) : array Gets the information of a pull-request by id.
getPullRequestCommits ( integer $id ) : array[] Gets the version-commits of a pull-request.
getPullRequestStates ( ) : string[] Gets the supported pull-request states.
getPullRequests ( string $state = null, integer $limit = 30 ) : array[] Gets the pull-requests.
getReleaseAssets ( integer $id ) : array[] Gets all available release assets of an release.
getReleases ( ) : array[] Gets all available created-releases.
getRepositoryInfo ( string $org, string $repository ) : array Gets the information from the requested repository.
isAuthenticated ( ) : boolean Returns true if the adapter is authenticated, false otherwise.
openPullRequest ( string $base, string $head, string $subject, string $body, array $parameters = [] ) : array Opens a new pull-request.
removeRelease ( integer $id ) Deletes a release.
supportsRepository ( string $remoteUrl ) : boolean Returns whether the repository is supported by this adapter.
switchPullRequestBase ( integer $prNumber, string $newBase, string $newHead, boolean $forceNewPr = false ) : array Switches the pull-request base.
updatePullRequest ( integer $id, array $parameters ) Updates the state of a pull-request by id.

Описание методов

authenticate() публичный Метод

Authenticates the Adapter.
public authenticate ( ) : boolean
Результат boolean

closePullRequest() публичный Метод

Close a pull-request by id.
public closePullRequest ( integer $id )
$id integer

createComment() публичный Метод

Creates a new a comment on an issue/pull-request.
public createComment ( integer $id, string $message ) : string | null
$id integer
$message string
Результат string | null URL to the comment ex. "https://github.com/octocat/Hello-World/pull/1347#issuecomment-1

createFork() публичный Метод

Creates a fork from upstream and returns an array with the forked url.
public createFork ( string $org ) : array
$org string Organisation name
Результат array An array the with following keys: git_url, html_url

createRelease() публичный Метод

For clarity, a release is a tagged version with additional information like a changelog.
public createRelease ( string $name, array $parameters = [] ) : array
$name string
$parameters array
Результат array Returns an array with url and id of the created release

createReleaseAssets() публичный Метод

An asset can be eg documentation or a full download (library package with vendors). Not every Hub provider supports this however, so implementation is optional.
public createReleaseAssets ( integer $id, string $name, string $contentType, string $content ) : integer
$id integer Id of the release (must exist)
$name string Name of the asset (including file extension)
$contentType string Mime-type of the asset
$content string Actual asset (in raw-binary form without conversion)
Результат integer returns the id of the asset

createRepo() публичный Метод

public createRepo ( string $name, string $description, string $homepage, boolean $public = true, null $organization = null, boolean $hasIssues = true, boolean $hasWiki = false, boolean $hasDownloads = false, integer $teamId, boolean $autoInit = true ) : array
$name string
$description string
$homepage string
$public boolean
$organization null
$hasIssues boolean
$hasWiki boolean
$hasDownloads boolean
$teamId integer
$autoInit boolean
Результат array

getComments() публичный Метод

. Returned value must be an array with the following data per entry (values are by example). If a value is not supported null must be used instead. "id": 1 "url": "https://github.com/octocat/Hello-World/pull/1347#issuecomment-1" "body": "Me too" "user": "username" "created_at": "DateTime Object" "updated_at": "DateTime Object"
public getComments ( integer $id ) : array[]
$id integer
Результат array[] [['id' => 1, ...]]

getLabels() публичный Метод

When the issue tracker does not support labels, this will return an empty array.
public getLabels ( ) : string[]
Результат string[]

getMilestones() публичный Метод

Gets the supported milestones.
public getMilestones ( array $parameters = [] ) : string[]
$parameters array
Результат string[]

getPullRequest() публичный Метод

Returned value must be an array with the following data (values are by example). If a value is not supported null must be used instead. "url": "https://github.com/octocat/Hello-World/pull/1" "number": 1 "state": "open" "title": "new-feature" "body": "Please pull these awesome changes" "labels": ["bug"] "milestone": "v1.0" "created_at": "DateTime Object" "updated_at": "DateTime Object" "user": "username" "assignee": "username" "merged": false "merged_by": "username" "head": [ "ref": "new-topic" "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e" "user": "username" "repo": "Hello-World" ] "base": [ "label": "master" "ref": "master" "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e" "user": "username" "repo": "Hello-World" ]
public getPullRequest ( integer $id ) : array
$id integer
Результат array

getPullRequestCommits() публичный Метод

Returned value must be an array with the following data per entry (values are by example). If a value is not supported null must be used instead. 'sha': '6dcb09b5b57875f334f61aebed695e2e4193db5e' 'message': 'Fix all the bugs' 'user': 'username'
public getPullRequestCommits ( integer $id ) : array[]
$id integer
Результат array[] [['sha1' => 'dcb09b5b57875f334f61aebed695e2e4193db5e', ...]]

getPullRequestStates() публичный Метод

Gets the supported pull-request states.
public getPullRequestStates ( ) : string[]
Результат string[]

getPullRequests() публичный Метод

Gets the pull-requests.
public getPullRequests ( string $state = null, integer $limit = 30 ) : array[]
$state string Only get pull-requests with this state (use getPullRequestStates() for supported states)
$limit integer
Результат array[] An array where each entry has the same structure as described in getPullRequest()

getReleaseAssets() публичный Метод

Returned value must be an array with the following data per entry (values are by example). If a value is not supported null must be used instead. Note. Size is in bytes, url contains a link to the asset. but may not necessarily download the actual asset. State can be: "uploaded", "empty", or "uploading". "url": "https://api.github.com/repos/octocat/Hello-World/releases/assets/1" "id": 1 "name": "example.zip" "label": "short description" "state": "uploaded" "content_type": "application/zip" "size": 1024 "created_at": "DateTime Object" "updated_at": "DateTime Object" "uploader": "username"
public getReleaseAssets ( integer $id ) : array[]
$id integer Id of the release (must exist)
Результат array[] [['id' => 1, ...]]

getReleases() публичный Метод

Returned value must be an array with the following data per entry (values are by example). If a value is not supported null must be used instead. "url": "https://github.com/octocat/Hello-World/releases/v1.0.0" "id": 1 "name": "v1.0.0" "tag_name": "v1.0.0" "body": "Description of the release" "draft": false "prerelease": false "created_at": "DateTime Object" "published_at": "DateTime Object" "user": "username"
public getReleases ( ) : array[]
Результат array[] [['id' => 1, ...]]

getRepositoryInfo() публичный Метод

Returned value must be an array with the following data (values are by example). If a value is not supported null must be used instead, or false in case of a boolean. "owner": "username" "html_url": "https://github.com/octocat/Hello-World" "fetch_url": "https://github.com/octocat/Hello-World.git" "push_url": "[email protected]:octocat/Hello-World.git" "is_fork": false "is_private": false "fork_origin": [ "org": null "repo": null ] fork_origin is used to find the original organization and repository. When this repository is the head-parent, "fork_origin" may be null.
public getRepositoryInfo ( string $org, string $repository ) : array
$org string
$repository string
Результат array

isAuthenticated() публичный Метод

Returns true if the adapter is authenticated, false otherwise.
public isAuthenticated ( ) : boolean
Результат boolean

openPullRequest() публичный Метод

Opens a new pull-request.
public openPullRequest ( string $base, string $head, string $subject, string $body, array $parameters = [] ) : array
$base string
$head string
$subject string
$body string
$parameters array
Результат array An array the with following keys: html_url, number

removeRelease() публичный Метод

Deletes a release.
public removeRelease ( integer $id )
$id integer

supportsRepository() публичный Метод

Returns whether the repository is supported by this adapter.
public supportsRepository ( string $remoteUrl ) : boolean
$remoteUrl string
Результат boolean

switchPullRequestBase() публичный Метод

When the adapter does not support changing the base-branch, a new PR should be opened with same subject, body and labels. And the old PR should be closed.
public switchPullRequestBase ( integer $prNumber, string $newBase, string $newHead, boolean $forceNewPr = false ) : array
$prNumber integer
$newBase string New base for the PR
$newHead string org:branch
$forceNewPr boolean Open new PR (even when switching is supported)
Результат array An array with the following keys: html_url, number (either the current or the new PR)

updatePullRequest() публичный Метод

Updates the state of a pull-request by id.
public updatePullRequest ( integer $id, array $parameters )
$id integer
$parameters array