diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..4f5a650 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,6 @@ +# Changelog + +All notable changes to `sharefile-api` will be documented in this file + +## 1.0.0 - 2017-08-31 +- initial release diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..4da74e3 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,55 @@ +# Contributing + +Contributions are **welcome** and will be fully **credited**. + +Please read and understand the contribution guide before creating an issue or pull request. + +## Etiquette + +This project is open source, and as such, the maintainers give their free time to build and maintain the source code +held within. They make the code freely available in the hope that it will be of use to other developers. It would be +extremely unfair for them to suffer abuse or anger for their hard work. + +Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the +world that developers are civilized and selfless people. + +It's the duty of the maintainer to ensure that all submissions to the project are of sufficient +quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used. + +## Viability + +When requesting or submitting new features, first consider whether it might be useful to others. Open +source projects are used by many developers, who may have entirely different needs to your own. Think about +whether or not your feature is likely to be used by other users of the project. + +## Procedure + +Before filing an issue: + +- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident. +- Check to make sure your feature suggestion isn't already present within the project. +- Check the pull requests tab to ensure that the bug doesn't have a fix in progress. +- Check the pull requests tab to ensure that the feature isn't already in progress. + +Before submitting a pull request: + +- Check the codebase to ensure that your feature doesn't already exist. +- Check the pull requests to ensure that another person hasn't already submitted the feature or fix. + +## Requirements + +If the project maintainer has any additional requirements, you will find them listed here. + +- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer). + +- **Add tests!** - Your patch won't be accepted if it doesn't have tests. + +- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. + +- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option. + +- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. + +- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. + +**Happy coding**! diff --git a/README.md b/README.md index fd689d9..6d41e8a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,10 @@ -# A minimal implementation of ShareFile Api +[![Latest Version on Packagist](https://img.shields.io/packagist/v/kapersoft/sharefile-api.svg?style=flat-square)](https://packagist.org/packages/kapersoft/sharefile-api) +[![Build Status](https://img.shields.io/travis/kapersoft/sharefile-api/master.svg?style=flat-square)](https://travis-ci.org/kapersoft/sharefile-api) +[![StyleCI](https://styleci.io/repos/101933034/shield?branch=master)](https://styleci.io/repos/101933034) +[![Quality Score](https://img.shields.io/scrutinizer/g/kapersoft/sharefile-api.svg?style=flat-square)](https://scrutinizer-ci.com/g/kapersoft/sharefile-api) +[![Total Downloads](https://img.shields.io/packagist/dt/kapersoft/sharefile-api.svg?style=flat-square)](https://packagist.org/packages/kapersoft/sharefile-api) + +# A minimal implementation of the ShareFile Api This is a minimal PHP implementation of the [ShareFile API](https://api.sharefile.com). I am open to PRs that add extra methods to the client. Here are a few examples on how you can use the package: @@ -12,8 +18,11 @@ $newFolder = $client->createFolder($parentId, $name, $description); // Upload a file in that folder $client->uploadFileStandard($filename, $newFolder['Id']); +// Get details for a file using filepath +$picture = $client->getItemByPath('/Personal Folders/Pictures/Picture.jpg'); + // Get a thumbnail of a file -$client->getThumbnailUrl($itemId); +$client->getThumbnailUrl($picture['Id']); ``` ## Installation @@ -23,17 +32,25 @@ composer require kapersoft/sharefile-api ``` ## Usage -The first thing you need to do is get an OAuth2 key. Go to the [Get an API key](https://api.sharefile.com/rest/oauth2-request.aspx) section on the [ShareFile API site](https://api.sharefile.com/). +The first thing you need to do is get an OAuth2 key. Go to the [Get an API key](https://api.sharefile.com/rest/oauth2-request.aspx) section on the [ShareFile API site](https://api.sharefile.com/) to get this key. With an OAuth2 key you can instantiate a `Kapersoft\Sharefile\Client`: ```php $client = new Client('hostname', 'client_id', 'secret', 'username', 'password'); ``` -Look in [the source code of `Kapersoft\ShareFile\Client`](https://github.com/kapersoft/sharefile-api/blob/master/src/Client.php) to discover the methods you can use. Examples can be found in [the source code of `Kapersoft\ShareFile\Test\TestShareFileApi`](https://github.com/kapersoft/sharefile-api/blob/master/tests/TestShareFileApi.php). +Look in [the source code of `Kapersoft\ShareFile\Client`](https://github.com/kapersoft/sharefile-api/blob/master/src/Client.php) to discover the methods you can use. More examples can be found in [the source code of `Kapersoft\ShareFile\Test\TestShareFileApi`](https://github.com/kapersoft/sharefile-api/blob/master/tests/TestShareFileApi.php). + +## Changelog +Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. +## Testing +In the `/tests`-folder are two tests defined: +- `TestClient.php` tests the `Kapersoft\Sharefile\Client`-class using mock Guzzle objects; +- `TestShareFileApi.php` tests the `Kapersoft\Sharefile\Client`-class using the live ShareFile API. To use this test fill in your ShareFile credentials under section `` of the `phpunit.xml.dist`-file in the project root folder. Some tests need additional parameters to run. These parameters can be found in the first lines of the test. + ## Security If you discover any security related issues, please email kapersoft@gmail.com instead of using the issue tracker. ## License -The MIT License (MIT). Please see [License File](LICENSE.md) for more information. +The MIT License (MIT). Please see [License File](LICENSE.txt) for more information.