Skip to content

Commit

Permalink
Merge pull request #13 from iboldurev/0.3.0
Browse files Browse the repository at this point in the history
0.3.0
  • Loading branch information
iboldurev authored Oct 27, 2017
2 parents d0cbdf1 + cafca7b commit b0aef50
Show file tree
Hide file tree
Showing 25 changed files with 92 additions and 94 deletions.
31 changes: 14 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Dialogflow PHP sdk
DialogFlow PHP sdk
==============

[![version][packagist-version]][packagist-url]
[![Downloads][packagist-downloads]][packagist-url]

[packagist-url]: https://packagist.org/packages/iboldurev/api-ai-php
[packagist-version]: https://img.shields.io/packagist/v/iboldurev/api-ai-php.svg?style=flat
[packagist-downloads]: https://img.shields.io/packagist/dm/iboldurev/api-ai-php.svg?style=flat
[packagist-url]: https://packagist.org/packages/iboldurev/dialogflow
[packagist-version]: https://img.shields.io/packagist/v/iboldurev/dialogflow.svg?style=flat
[packagist-downloads]: https://img.shields.io/packagist/dm/iboldurev/dialogflow.svg?style=flat

This is an unofficial php sdk for [Dialogflow][1] and it's still in progress...

Expand All @@ -29,7 +29,7 @@ Using the low level `Client`:
```php
require_once __DIR__.'/vendor/autoload.php';

use ApiAi\Client;
use DialogFlow\Client;

try {
$client = new Client('access_token');
Expand All @@ -51,9 +51,9 @@ Using the low level `Query`:
```php
require_once __DIR__.'/vendor/autoload.php';

use ApiAi\Client;
use ApiAi\Model\Query;
use ApiAi\Method\QueryApi;
use DialogFlow\Client;
use DialogFlow\Model\Query;
use DialogFlow\Method\QueryApi;

try {
$client = new Client('access_token');
Expand All @@ -76,9 +76,9 @@ Using the low level asynchronous api:
```php
require_once __DIR__.'/vendor/autoload.php';

use ApiAi\Client;
use ApiAi\Model\Query;
use ApiAi\Method\QueryApi;
use DialogFlow\Client;
use DialogFlow\Model\Query;
use DialogFlow\Method\QueryApi;
use GuzzleHttp\HandlerStack;
use React\EventLoop\Factory;
use WyriHaximus\React\GuzzlePsr7\HttpClientAdapter;
Expand Down Expand Up @@ -152,9 +152,9 @@ And using it in the `Dialog` class.
```php
require_once __DIR__.'/vendor/autoload.php';

use ApiAi\Client;
use ApiAi\Method\QueryApi;
use ApiAi\Dialog;
use DialogFlow\Client;
use DialogFlow\Method\QueryApi;
use DialogFlow\Dialog;
use Custom\MyActionMapping;

try {
Expand All @@ -172,7 +172,4 @@ try {

```

Some examples are describe in the [iboldurev/api-ai-php-example][2] repository.

[1]: https://dialogflow.com
[2]: https://github.com/iboldurev/api-ai-php-example
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "iboldurev/api-ai-php",
"name": "iboldurev/dialogflow",
"description": "Dialogflow php sdk",
"minimum-stability": "stable",
"version": "0.3.0",
"license": "MIT",
"authors": [
{
Expand All @@ -18,7 +19,7 @@
],
"autoload": {
"psr-4": {
"ApiAi\\": "src/"
"DialogFlow\\": "src/"
}
},
"require": {
Expand Down
6 changes: 3 additions & 3 deletions src/ActionMapping.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

namespace ApiAi;
namespace DialogFlow;

use ApiAi\Model\Context;
use DialogFlow\Model\Context;

/**
* Class ActionMapping
*
* @package ApiAi
* @package DialogFlow
*/
abstract class ActionMapping
{
Expand Down
10 changes: 5 additions & 5 deletions src/Client.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php

namespace ApiAi;
namespace DialogFlow;

use ApiAi\HttpClient\HttpClient;
use ApiAi\HttpClient\GuzzleHttpClient;
use ApiAi\Exception\BadResponseException;
use DialogFlow\HttpClient\HttpClient;
use DialogFlow\HttpClient\GuzzleHttpClient;
use DialogFlow\Exception\BadResponseException;
use GuzzleHttp\Promise\PromiseInterface;
use function GuzzleHttp\Promise\rejection_for;
use Psr\Http\Message\ResponseInterface;

/**
* Class Client
*
* @package ApiAi
* @package DialogFlow
*/
class Client
{
Expand Down
18 changes: 9 additions & 9 deletions src/Dialog.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php

namespace ApiAi;
namespace DialogFlow;

use ApiAi\Method\QueryApi;
use ApiAi\Model\Query;
use ApiAi\Model\Step;
use ApiAi\Model\Step\Action;
use ApiAi\Model\Step\Speech;
use ApiAi\Exception\DialogException;
use ApiAi\Exception\InvalidStepException;
use DialogFlow\Method\QueryApi;
use DialogFlow\Model\Query;
use DialogFlow\Model\Step;
use DialogFlow\Model\Step\Action;
use DialogFlow\Model\Step\Speech;
use DialogFlow\Exception\DialogException;
use DialogFlow\Exception\InvalidStepException;

/**
* Class Dialog
*
* @package ApiAi
* @package DialogFlow
*/
class Dialog
{
Expand Down
4 changes: 2 additions & 2 deletions src/Exception/BadResponseException.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

namespace ApiAi\Exception;
namespace DialogFlow\Exception;

use Psr\Http\Message\ResponseInterface;

/**
* Class BadResponseException
*
* @package ApiAi\Exception
* @package DialogFlow\Exception
*/
class BadResponseException extends \RuntimeException
{
Expand Down
6 changes: 3 additions & 3 deletions src/Exception/DialogException.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

namespace ApiAi\Exception;
namespace DialogFlow\Exception;

use ApiAi\Model\Query;
use DialogFlow\Model\Query;

/**
* Class DialogException
*
* @package ApiAi\Exception
* @package DialogFlow\Exception
*/
class DialogException extends \RuntimeException
{
Expand Down
6 changes: 3 additions & 3 deletions src/Exception/InvalidStepException.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

namespace ApiAi\Exception;
namespace DialogFlow\Exception;

use ApiAi\Model\Query;
use DialogFlow\Model\Query;

/**
* Class InvalidStepException
*
* @package ApiAi\Exception
* @package DialogFlow\Exception
*/
class InvalidStepException extends \RuntimeException
{
Expand Down
6 changes: 3 additions & 3 deletions src/HttpClient/GuzzleHttpClient.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php

namespace ApiAi\HttpClient;
namespace DialogFlow\HttpClient;

use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\RequestOptions;
use ApiAi\Client;
use DialogFlow\Client;

/**
* Class GuzzleHttpClient
*
* @package ApiAi\HttpClient
* @package DialogFlow\HttpClient
*/
class GuzzleHttpClient implements HttpClient
{
Expand Down
4 changes: 2 additions & 2 deletions src/HttpClient/HttpClient.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php

namespace ApiAi\HttpClient;
namespace DialogFlow\HttpClient;

use GuzzleHttp\Promise\PromiseInterface;
use Psr\Http\Message\ResponseInterface;

/**
* Interface HttpClient
*
* @package ApiAi\HttpClient
* @package DialogFlow\HttpClient
*/
interface HttpClient
{
Expand Down
8 changes: 4 additions & 4 deletions src/Method/QueryApi.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php

namespace ApiAi\Method;
namespace DialogFlow\Method;

use ApiAi\Client;
use ApiAi\ResponseHandler;
use DialogFlow\Client;
use DialogFlow\ResponseHandler;
use GuzzleHttp\Promise\PromiseInterface;
use Psr\Http\Message\ResponseInterface;

/**
* Class QueryApi
*
* @package ApiAi\Method
* @package DialogFlow\Method
*/
class QueryApi
{
Expand Down
4 changes: 2 additions & 2 deletions src/Model/Base.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace ApiAi\Model;
namespace DialogFlow\Model;

/**
* Class Base
*
* @package ApiAi\Model
* @package DialogFlow\Model
*/
class Base implements \JsonSerializable
{
Expand Down
4 changes: 2 additions & 2 deletions src/Model/Context.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace ApiAi\Model;
namespace DialogFlow\Model;

/**
* Class Context
*
* @package ApiAi\Model
* @package DialogFlow\Model
*/
class Context extends Base
{
Expand Down
4 changes: 2 additions & 2 deletions src/Model/Fulfillment.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace ApiAi\Model;
namespace DialogFlow\Model;

/**
* Class Fulfillment
*
* @package ApiAi\Model
* @package DialogFlow\Model
*/
class Fulfillment extends Base
{
Expand Down
4 changes: 2 additions & 2 deletions src/Model/Metadata.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace ApiAi\Model;
namespace DialogFlow\Model;

/**
* Class Metadata
*
* @package ApiAi\Model
* @package DialogFlow\Model
*/
class Metadata extends Base
{
Expand Down
4 changes: 2 additions & 2 deletions src/Model/Query.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace ApiAi\Model;
namespace DialogFlow\Model;

/**
* Class Query
*
* @package ApiAi\Model
* @package DialogFlow\Model
*/
class Query extends Base
{
Expand Down
4 changes: 2 additions & 2 deletions src/Model/QueryResult.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace ApiAi\Model;
namespace DialogFlow\Model;

/**
* Class QueryResult
*
* @package ApiAi\Model
* @package DialogFlow\Model
*/
class QueryResult extends Base
{
Expand Down
4 changes: 2 additions & 2 deletions src/Model/Status.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace ApiAi\Model;
namespace DialogFlow\Model;

/**
* Class Status
*
* @package ApiAi\Model
* @package DialogFlow\Model
*/
class Status extends Base
{
Expand Down
4 changes: 2 additions & 2 deletions src/Model/Step.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace ApiAi\Model;
namespace DialogFlow\Model;

/**
* Interface Step
*
* @package ApiAi\Model
* @package DialogFlow\Model
*/
interface Step
{
Expand Down
Loading

0 comments on commit b0aef50

Please sign in to comment.