Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update name space #10

Merged
merged 5 commits into from
Sep 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
},
"minimum-stability": "stable",
"autoload": {
"psr-4": {"LUIS\\": "src/LUIS"}
"psr-4": {"Goodjun\\LUIS\\": "src/LUIS"}
}
}
2 changes: 1 addition & 1 deletion src/LUIS/LuisAbstract.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace LUIS;
namespace Goodjun\LUIS;

use GuzzleHttp\Client;
use \Exception;
Expand Down
26 changes: 24 additions & 2 deletions src/LUIS/LuisAppClient.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace LUIS;
namespace Goodjun\LUIS;

use LUIS\Models\Utterance;
use Goodjun\LUIS\Models\Utterance;
use \Exception;

class LuisAppClient extends LuisAbstract
Expand Down Expand Up @@ -169,4 +169,26 @@ public function deleteUtterance($utteranceId)
{
return $this->request('DELETE', 'apps/' . $this->appId . '/versions/' . $this->versionId . '/examples/' . $utteranceId);
}

/**
* Get version training status
*
* @return mixed
* @throws Exception
*/
public function trainingStatus()
{
return $this->request('GET', 'apps/' . $this->appId . '/versions/' . $this->versionId . '/train');
}

/**
* Train application version
*
* @return mixed
* @throws Exception
*/
public function train()
{
return $this->request('POST', 'apps/' . $this->appId . '/versions/' . $this->versionId . '/train');
}
}
4 changes: 2 additions & 2 deletions src/LUIS/LuisClient.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace LUIS;
namespace Goodjun\LUIS;

use LUIS\Models\App;
use Goodjun\LUIS\Models\App;
use \Exception;

class LuisClient extends LuisAbstract
Expand Down
2 changes: 1 addition & 1 deletion src/LUIS/Models/App.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace LUIS\Models;
namespace Goodjun\LUIS\Models;

class App extends ModelAbstract
{
Expand Down
2 changes: 1 addition & 1 deletion src/LUIS/Models/Entity.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace LUIS\Models;
namespace Goodjun\LUIS\Models;

class Entity extends ModelAbstract
{
Expand Down
2 changes: 1 addition & 1 deletion src/LUIS/Models/Intent.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace LUIS\Models;
namespace Goodjun\LUIS\Models;

class Intent extends ModelAbstract
{
Expand Down
2 changes: 1 addition & 1 deletion src/LUIS/Models/ModelAbstract.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace LUIS\Models;
namespace Goodjun\LUIS\Models;

use ReflectionClass;
use \Exception;
Expand Down
2 changes: 1 addition & 1 deletion src/LUIS/Models/Utterance.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace LUIS\Models;
namespace Goodjun\LUIS\Models;

class Utterance extends ModelAbstract
{
Expand Down
23 changes: 19 additions & 4 deletions tests/LUIS/Tests/FeatureTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace LUIS\Tests;
namespace Goodjun\LUIS\Tests;

use LUIS\LuisClient;
use LUIS\Models\App;
use LUIS\Models\Utterance;
use Goodjun\LUIS\LuisClient;
use Goodjun\LUIS\Models\App;
use Goodjun\LUIS\Models\Utterance;

class FeatureTest extends \PHPUnit_Framework_TestCase
{
Expand All @@ -26,6 +26,10 @@ public function setUp()
$location = getenv('LUIS_LOCATION');
$appId = getenv('LUIS_APP_ID');

$primaryKey = '5e821faee38f471582d04cd97ab1b04c';
$location = 'westus';
$appId = '33dbb1e3-ce22-4137-acca-a3b568d58b03';

$this->luisClient = new LuisClient($primaryKey, $location);
$this->appId = $appId;
}
Expand Down Expand Up @@ -107,4 +111,15 @@ public function testCreateDeleteUtterance()
$this->luisClient->app($this->appId)->deleteEntity($entityId);
$this->luisClient->app($this->appId)->deleteIntent($intentId);
}

public function testTrainApp()
{
$response = $this->luisClient->app($this->appId)->version('0.1')->train();
$this->assertNotNull($response);

sleep(3);

$response = $this->luisClient->app($this->appId)->version('0.1')->trainingStatus();
$this->assertNotNull($response);
}
}