Skip to content

Commit

Permalink
added status param to translations api and default param to assets api
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Whitlock committed Sep 1, 2015
1 parent c9b6a10 commit 454873b
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 30 deletions.
1 change: 1 addition & 0 deletions src/Console/Command/Generated/CreateAssetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ protected function configure(){
->addOption('name','',InputOption::VALUE_REQUIRED,'Source text or just a name describing what the asset is',null)
->addOption('id','',InputOption::VALUE_REQUIRED,'Optional machine friendly ID if you want something specific','')
->addOption('type','',InputOption::VALUE_REQUIRED,'Media type, defaults to plain old text','text')
->addOption('default','',InputOption::VALUE_REQUIRED,'Status of the default source language translation. Specify \'untranslated\' to avoid creation','translated')
->addOption('key','k',InputOption::VALUE_OPTIONAL,'Override configured API key for this request','')
;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Command/Generated/DeleteTagCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected function configure(){
$this
->setName( 'loco:delete:tag' )
->setMethod( 'deleteTag' )
->setDescription( 'Delete a single tag' )
->setDescription( 'Delete an existing tag' )
->addOption('key','k',InputOption::VALUE_OPTIONAL,'Override configured API key for this request','')
->addArgument('tag',InputArgument::REQUIRED,'Name of a single asset tag.',null)
;
Expand Down
2 changes: 1 addition & 1 deletion src/Http/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class ApiClient extends Client {

const VERSION = '1.0.11';
const VERSION = '1.0.12';

/**
* Factory method to create a new Loco API client.
Expand Down
45 changes: 33 additions & 12 deletions src/Http/Resources/service.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Loco",
"apiVersion": "1.0.11",
"apiVersion": "1.0.12",
"baseUrl": "https:\/\/localise.biz\/",
"description": "Loco REST API",
"operations": {
Expand Down Expand Up @@ -100,7 +100,7 @@
"responseClass": "Success",
"responseType": "model",
"responseNotes": "Deletes an existing tag in the currently authenticated project",
"summary": "Delete a single tag",
"summary": "Delete an existing tag",
"parameters": {
"key": {
"required": true,
Expand Down Expand Up @@ -739,7 +739,7 @@
"class": "\\Loco\\Http\\Command\\LocoCommand",
"responseClass": "Asset",
"responseType": "model",
"responseNotes": "<p>Adds a new asset to the currently authenticated project.<\/p>\n <p>If the asset is created successfully the response will be 201 (created).<\/p>\n <p>If you specify the asset ID and it clashes with an existing asset the response will be 409 (conflict).<\/p>\n <p>If another asset exists with the same name and you <strong>haven't specified the ID<\/strong>, a new asset will be created with a unique id.<\/p>",
"responseNotes": "<p>Adds a new asset to the currently authenticated project.<\/p>\n <p>If the asset is created successfully the response will be 201 (created).<\/p>\n <p>If you specify the asset ID and it clashes with an existing asset the response will be 409 (conflict).<\/p>\n <p>If another asset exists with the same name and you <strong>haven't specified the ID<\/strong>, a new asset will be created with a unique id.<\/p>\n <p>Creating a new asset also creates a translation in your source language with the value of the 'name' parameter. Use the 'default' parameter to control this behaviour.<\/p>",
"summary": "Add a new translatable asset",
"parameters": {
"name": {
Expand Down Expand Up @@ -769,6 +769,21 @@
],
"default": "text"
},
"default": {
"description": "Status of the default source language translation. Specify 'untranslated' to avoid creation",
"type": "string",
"location": "postField",
"enum": [
"translated",
"untranslated",
"incorrect",
"provisional",
"unapproved",
"fuzzy",
"incomplete"
],
"default": "translated"
},
"key": {
"required": true,
"description": "Project API key - preferably sent in request header as `Authorization: Loco <key>`",
Expand Down Expand Up @@ -1406,7 +1421,7 @@
"class": "\\Loco\\Http\\Command\\LocoCommand",
"responseClass": "Translation",
"responseType": "model",
"responseNotes": "<p>Translates a single asset in a single locale in the currently authenticated project.<\/p>\n <p>If the asset is already translated, a new revision will be added and the <code>revision<\/code> field incremented.<\/p>\n <p>If the asset is untranslated the locale must have already been added to the project.<\/p>\n <p>Binary file uploads are not yet supported, but will be soon.<\/p>",
"responseNotes": "<p>Translates a single asset in a single locale in the currently authenticated project.<\/p>\n <p>If the asset is already translated, a new revision will be added and the <code>revision<\/code> field incremented.<\/p>\n <p>If the asset is untranslated the locale must have already been added to the project.<\/p>\n <p>Binary file uploads are not yet supported via this endpoint.<\/p>",
"summary": "Add a new translation in a given locale",
"parameters": {
"translation": {
Expand Down Expand Up @@ -1502,10 +1517,11 @@
"type": "string",
"location": "postField",
"enum": [
"incorrect",
"provisional",
"unapproved",
"fuzzy",
"error",
"review",
"pending"
"incomplete"
],
"default": "fuzzy"
},
Expand Down Expand Up @@ -1818,7 +1834,7 @@
"location": "json"
},
"incomplete": {
"description": "Number of translations that are flagged as incomplete",
"description": "Number of translations that are flagged as requiring attention",
"type": "integer",
"location": "json"
},
Expand Down Expand Up @@ -2027,7 +2043,7 @@
"location": "json"
},
"incomplete": {
"description": "Number of translations that are flagged as incomplete",
"description": "Number of translations that are flagged as requiring attention",
"type": "integer",
"location": "json"
},
Expand Down Expand Up @@ -2331,7 +2347,7 @@
},
"flagged": {
"required": true,
"description": "Whether translation is incomplete due to an issue requiring attention",
"description": "Whether translation is flagged as requiring attention",
"type": "boolean",
"location": "json",
"default": false
Expand Down Expand Up @@ -2387,11 +2403,16 @@
},
"flagged": {
"required": true,
"description": "Whether translation is incomplete due to an issue requiring attention",
"description": "Whether translation is flagged as requiring attention",
"type": "boolean",
"location": "json",
"default": false
},
"status": {
"description": "Status of translation as string compatible with export status parameter",
"type": "string",
"location": "json"
},
"translation": {
"required": true,
"description": "Translated text in specified locale",
Expand Down Expand Up @@ -2534,7 +2555,7 @@
},
"flagged": {
"required": true,
"description": "Whether translation is incomplete due to an issue requiring attention",
"description": "Whether translation is flagged as requiring attention",
"type": "boolean",
"location": "json",
"default": false
Expand Down
53 changes: 39 additions & 14 deletions src/Http/Resources/service.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
/**
* Auto-generated with Swizzle at 2015-07-01 11:17:38 +0100
* Auto-generated with Swizzle at 2015-09-01 18:27:05 +0100
*/
return array (
'name' => 'Loco',
'apiVersion' => '1.0.11',
'apiVersion' => '1.0.12',
'baseUrl' => 'https://localise.biz/',
'description' => 'Loco REST API',
'operations' =>
Expand Down Expand Up @@ -125,7 +125,7 @@
'responseClass' => 'Success',
'responseType' => 'model',
'responseNotes' => 'Deletes an existing tag in the currently authenticated project',
'summary' => 'Delete a single tag',
'summary' => 'Delete an existing tag',
'parameters' =>
array (
'key' =>
Expand Down Expand Up @@ -901,7 +901,8 @@
'responseNotes' => '<p>Adds a new asset to the currently authenticated project.</p>
<p>If the asset is created successfully the response will be 201 (created).</p>
<p>If you specify the asset ID and it clashes with an existing asset the response will be 409 (conflict).</p>
<p>If another asset exists with the same name and you <strong>haven\'t specified the ID</strong>, a new asset will be created with a unique id.</p>',
<p>If another asset exists with the same name and you <strong>haven\'t specified the ID</strong>, a new asset will be created with a unique id.</p>
<p>Creating a new asset also creates a translation in your source language with the value of the \'name\' parameter. Use the \'default\' parameter to control this behaviour.</p>',
'summary' => 'Add a new translatable asset',
'parameters' =>
array (
Expand Down Expand Up @@ -936,6 +937,23 @@
),
'default' => 'text',
),
'default' =>
array (
'description' => 'Status of the default source language translation. Specify \'untranslated\' to avoid creation',
'type' => 'string',
'location' => 'postField',
'enum' =>
array (
0 => 'translated',
1 => 'untranslated',
2 => 'incorrect',
3 => 'provisional',
4 => 'unapproved',
5 => 'fuzzy',
6 => 'incomplete',
),
'default' => 'translated',
),
'key' =>
array (
'required' => true,
Expand Down Expand Up @@ -1724,7 +1742,7 @@
'responseNotes' => '<p>Translates a single asset in a single locale in the currently authenticated project.</p>
<p>If the asset is already translated, a new revision will be added and the <code>revision</code> field incremented.</p>
<p>If the asset is untranslated the locale must have already been added to the project.</p>
<p>Binary file uploads are not yet supported, but will be soon.</p>',
<p>Binary file uploads are not yet supported via this endpoint.</p>',
'summary' => 'Add a new translation in a given locale',
'parameters' =>
array (
Expand Down Expand Up @@ -1844,10 +1862,11 @@
'location' => 'postField',
'enum' =>
array (
0 => 'fuzzy',
1 => 'error',
2 => 'review',
3 => 'pending',
0 => 'incorrect',
1 => 'provisional',
2 => 'unapproved',
3 => 'fuzzy',
4 => 'incomplete',
),
'default' => 'fuzzy',
),
Expand Down Expand Up @@ -2221,7 +2240,7 @@
),
'incomplete' =>
array (
'description' => 'Number of translations that are flagged as incomplete',
'description' => 'Number of translations that are flagged as requiring attention',
'type' => 'integer',
'location' => 'json',
),
Expand Down Expand Up @@ -2471,7 +2490,7 @@
),
'incomplete' =>
array (
'description' => 'Number of translations that are flagged as incomplete',
'description' => 'Number of translations that are flagged as requiring attention',
'type' => 'integer',
'location' => 'json',
),
Expand Down Expand Up @@ -2839,7 +2858,7 @@
'flagged' =>
array (
'required' => true,
'description' => 'Whether translation is incomplete due to an issue requiring attention',
'description' => 'Whether translation is flagged as requiring attention',
'type' => 'boolean',
'location' => 'json',
'default' => false,
Expand Down Expand Up @@ -2905,11 +2924,17 @@
'flagged' =>
array (
'required' => true,
'description' => 'Whether translation is incomplete due to an issue requiring attention',
'description' => 'Whether translation is flagged as requiring attention',
'type' => 'boolean',
'location' => 'json',
'default' => false,
),
'status' =>
array (
'description' => 'Status of translation as string compatible with export status parameter',
'type' => 'string',
'location' => 'json',
),
'translation' =>
array (
'required' => true,
Expand Down Expand Up @@ -3080,7 +3105,7 @@
'flagged' =>
array (
'required' => true,
'description' => 'Whether translation is incomplete due to an issue requiring attention',
'description' => 'Whether translation is flagged as requiring attention',
'type' => 'boolean',
'location' => 'json',
'default' => false,
Expand Down
4 changes: 2 additions & 2 deletions tests/Http/ApiClientConvertTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ public function testExportSymfony(){
$php = $this->convert('test-fr_FR.po', 'po', 'php', 'symfony' );
$this->assertStringStartsWith('<?php', $php );
$this->assertContains("'sample' => 'échantillon'", $php );
$this->assertContains("'example' => 'one: exemple|other: exemples'", $php );
$this->assertContains("'example' => 'exemple|exemples'", $php );
return 'export/test-fr_FR.symfony.php';
}

Expand Down Expand Up @@ -543,7 +543,7 @@ public function testImportSymfony( $sourcefile ){
$json = $this->convert( $sourcefile, 'php', 'json', '', false );
// re-importing symfony plurals won't work due to the way symfony handles string formatted plurals
$data = json_decode( $json, true );
$this->assertEquals('one: exemple|other: exemples', $data['example'] );
$this->assertEquals('exemple|exemples', $data['example'] );
}


Expand Down

0 comments on commit 454873b

Please sign in to comment.