JGithubPackageRepositoriesDownloads
class JGithubPackageRepositoriesDownloads extends JGithubPackage
GitHub API Repositories Downloads class for the Joomla Platform.
The downloads API is for package downloads only. If you want to get source tarballs you should use https://developer.github.com/v3/repos/contents/#get-archive-link instead.
Methods
List downloads for a repository.
Get a single download.
Create a new download (Part 1: Create the resource).
Create a new download (Part 2: Upload file to s3).
Delete a download.
Details
object
create(
string $owner,
string $repo,
string $name,
string $size,
string $description = '',
string $content_type = '')
Create a new download (Part 1: Create the resource).
Creating a new download is a two step process. You must first create a new download resource.
boolean
upload(
string $key,
string $acl,
string $success_action_status,
string $filename,
string $awsAccessKeyId,
string $policy,
string $signature,
string $content_type,
string $file)
Create a new download (Part 2: Upload file to s3).
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/newfile.jpg" \ -F "acl=public-read" \ -F "successactionstatus=201" \ -F "Filename=newfile.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/