Downloads

Extends AbstractPackage

GitHub API Repositories Downloads class for the Joomla Framework.

deprecated

The downloads API is for package downloads only. If you want to get source tarballs you should use http://developer.github.com/v3/repos/contents/#get-archive-link instead.

documentation

https://developer.github.com/v3/repos/downloads

since

1.0

deprecated

The Releases API should be used instead

package

Joomla Framework

Methods

__construct

Constructor.

__construct(\Joomla\Registry\Registry options = null, \Joomla\Http\Http client = null) : mixed
inherited
since

1.0

Arguments

options

\Joomla\Registry\RegistryGitHub options object.

client

\Joomla\Http\HttpThe HTTP client object.

Response

mixed

__get

Magic method to lazily create API objects

__get(string name) : \Joomla\Github\AbstractPackage
inherited
since

1.0

throws

\InvalidArgumentException

Arguments

name

stringName of property to retrieve

Response

\Joomla\Github\AbstractPackageGitHub API package object.

create

Create a new download (Part 1: Create the resource).

create(string owner, string repo, string name, string size, string description = '', string contentType = '') : void
deprecated

Creating a new download is a two step process. You must first create a new download resource.

note

This API endpoint no longer exists at GitHub

since

1.0

throws

\RuntimeException

deprecated

The Releases API should be used instead

Arguments

owner

stringThe name of the owner of the GitHub repository.

repo

stringThe name of the GitHub repository.

name

stringThe name.

size

stringSize of file in bytes.

description

stringThe description.

contentType

stringThe content type.

delete

Delete a download.

delete(string owner, string repo, int id) : object
deprecated
since

1.0

deprecated

The Releases API should be used instead

Arguments

owner

stringThe name of the owner of the GitHub repository.

repo

stringThe name of the GitHub repository.

id

intThe id of the download.

Response

object

fetchUrl

Method to build and return a full request URL for the request. This method will add appropriate pagination details if necessary and also prepend the API url to have a complete URL for the request.

fetchUrl(string path, int page, int limit) : \Joomla\Uri\Uri
inherited
since

1.0

Arguments

path

stringURL to inflect

page

intPage to request

limit

intNumber of results to return per page

Response

\Joomla\Uri\Uri

get

Get a single download.

get(string owner, string repo, int id) : object
deprecated
since

1.0

deprecated

The Releases API should be used instead

Arguments

owner

stringThe name of the owner of the GitHub repository.

repo

stringThe name of the GitHub repository.

id

intThe id of the download.

Response

object

getList

List downloads for a repository.

getList(string owner, string repo) : object
deprecated
since

1.0

deprecated

The Releases API should be used instead

Arguments

owner

stringThe name of the owner of the GitHub repository.

repo

stringThe name of the GitHub repository.

Response

object

processResponse

Process the response and decode it.

processResponse(\Joomla\Http\Response response, int expectedCode = 200) : mixed
inherited
since

1.0

throws

\Joomla\Http\Exception\UnexpectedResponseException

Arguments

response

\Joomla\Http\ResponseThe response.

expectedCode

intThe expected "good" code.

Response

mixed

upload

Create a new download (Part 2: Upload file to s3).

upload(string key, string acl, string successActionStatus, string filename, string awsAccessKeyId, string policy, string signature, string contentType, string file) : void
deprecated

Now that you have created the download resource, you can use the information in the response to upload your file to s3. This can be done with a POST to the s3_url you got in the create response. Here is a brief example using curl:

curl
-F "key=downloads/octocat/Hello-World/new_file.jpg"
-F "acl=public-read"
-F "success_action_status=201"
-F "Filename=new_file.jpg"
-F "AWSAccessKeyId=1ABCDEF..."
-F "Policy=ewogIC..."
-F "Signature=mwnF..."
-F "Content-Type=image/jpeg"
-F "file=@new_file.jpg"
https://github.s3.amazonaws.com/

NOTES The order in which you pass these fields matters! Follow the order shown above exactly. All parameters shown are required and if you excluded or modify them your upload will fail because the values are hashed and signed by the policy.

More information about using the REST API to interact with s3 can be found here: http://docs.amazonwebservices.com/AmazonS3/latest/API/

note

This API endpoint no longer exists at GitHub

since

1.0

throws

\RuntimeException

deprecated

The Releases API should be used instead

Arguments

key

stringValue of path field in the response.

acl

stringValue of acl field in the response.

successActionStatus

string201, or whatever you want to get back.

filename

stringValue of name field in the response.

awsAccessKeyId

stringValue of accesskeyid field in the response.

policy

stringValue of policy field in the response.

signature

stringValue of signature field in the response.

contentType

stringValue of mime_type field in the response.

file

stringLocal file. Example assumes the file existing in the directory where you are running the curl command. Yes, the @ matters.

Properties

options

Options for the GitHub object.

inherited
since

1.0

Type(s)

\Joomla\Registry\Registry

client

The HTTP client object to use in sending HTTP requests.

inherited
since

1.0

Type(s)

\Joomla\Http\Http

package

The package the object resides in

inherited
since

1.0

Type(s)

string

hookEvents

Array containing the allowed hook events

inherited
since

1.5.2

link
note

From 1.4.0 to 1.5.1 this was named $events, it was renamed due to naming conflicts with package subclasses

Type(s)

array