Downloads
Extends AbstractPackageGitHub API Repositories Downloads class for the Joomla Framework.
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
since |
1.0 |
---|
Arguments
- options
\Joomla\Registry\Registry
GitHub options object.- client
\Joomla\Http\Http
The HTTP client object.
Response
mixed
__get
Magic method to lazily create API objects
__get(string name) : \Joomla\Github\AbstractPackage
since |
1.0 |
---|---|
throws |
|
Arguments
- name
string
Name of property to retrieve
Response
\Joomla\Github\AbstractPackage
GitHub 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
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 |
|
deprecated |
The Releases API should be used instead |
Arguments
- owner
string
The name of the owner of the GitHub repository.- repo
string
The name of the GitHub repository.- name
string
The name.- size
string
Size of file in bytes.- description
string
The description.- contentType
string
The content type.
delete
Delete a download.
delete(string owner, string repo, int id) : object
since |
1.0 |
---|---|
deprecated |
The Releases API should be used instead |
Arguments
- owner
string
The name of the owner of the GitHub repository.- repo
string
The name of the GitHub repository.- id
int
The 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
since |
1.0 |
---|
Arguments
- path
string
URL to inflect- page
int
Page to request- limit
int
Number of results to return per page
Response
\Joomla\Uri\Uri
get
Get a single download.
get(string owner, string repo, int id) : object
since |
1.0 |
---|---|
deprecated |
The Releases API should be used instead |
Arguments
- owner
string
The name of the owner of the GitHub repository.- repo
string
The name of the GitHub repository.- id
int
The id of the download.
Response
object
getList
List downloads for a repository.
getList(string owner, string repo) : object
since |
1.0 |
---|---|
deprecated |
The Releases API should be used instead |
Arguments
- owner
string
The name of the owner of the GitHub repository.- repo
string
The name of the GitHub repository.
Response
object
processResponse
Process the response and decode it.
processResponse(\Joomla\Http\Response response, int expectedCode = 200) : mixed
since |
1.0 |
---|---|
throws |
|
Arguments
- response
\Joomla\Http\Response
The response.- expectedCode
int
The 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
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 |
|
deprecated |
The Releases API should be used instead |
Arguments
- key
string
Value of path field in the response.- acl
string
Value of acl field in the response.- successActionStatus
string
201, or whatever you want to get back.- filename
string
Value of name field in the response.- awsAccessKeyId
string
Value of accesskeyid field in the response.- policy
string
Value of policy field in the response.- signature
string
Value of signature field in the response.- contentType
string
Value of mime_type field in the response.- file
string
Local 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.
since |
1.0 |
---|
Type(s)
\Joomla\Registry\Registry
client
The HTTP client object to use in sending HTTP requests.
since |
1.0 |
---|
Type(s)
\Joomla\Http\Http
package
The package the object resides in
since |
1.0 |
---|
Type(s)
string
hookEvents
Array containing the allowed hook events
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