Skip to content

Commit

Permalink
feat: Screenshots APIs: add the labelIds parameter support (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdelre authored Oct 2, 2024
1 parent a67fd96 commit 596c905
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
14 changes: 14 additions & 0 deletions src/CrowdinApiClient/Model/Screenshot.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ class Screenshot extends BaseModel
*/
protected $updatedAt;

/**
* @var array
*/
protected $labelIds = [];

public function __construct(array $data = [])
{
parent::__construct($data);
Expand All @@ -64,6 +69,7 @@ public function __construct(array $data = [])
$this->tags = (array)$this->getDataProperty('tags');
$this->createdAt = (string)$this->getDataProperty('createdAt');
$this->updatedAt = (string)$this->getDataProperty('updatedAt');
$this->labelIds = (array)$this->getDataProperty('labelIds');
}

/**
Expand Down Expand Up @@ -145,4 +151,12 @@ public function getUpdatedAt(): string
{
return $this->updatedAt;
}

/**
* @return array
*/
public function getLabelIds(): array
{
return $this->labelIds;
}
}
15 changes: 10 additions & 5 deletions tests/CrowdinApiClient/Api/ScreenshotApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public function testList()
}
],
"createdAt": "2019-09-23T09:29:19+00:00",
"updatedAt": "2019-09-23T09:29:19+00:00"
"updatedAt": "2019-09-23T09:29:19+00:00",
"labelIds": [100, 200]
}
}
],
Expand Down Expand Up @@ -99,7 +100,8 @@ public function testCreate()
}
],
"createdAt": "2019-09-23T09:29:19+00:00",
"updatedAt": "2019-09-23T09:29:19+00:00"
"updatedAt": "2019-09-23T09:29:19+00:00",
"labelIds": [100, 200]
}
}'
]);
Expand Down Expand Up @@ -137,7 +139,8 @@ public function testGetAndUpdate()
}
],
"createdAt": "2019-09-23T09:29:19+00:00",
"updatedAt": "2019-09-23T09:29:19+00:00"
"updatedAt": "2019-09-23T09:29:19+00:00",
"labelIds": [100, 200]
}
}');

Expand Down Expand Up @@ -171,7 +174,8 @@ public function testGetAndUpdate()
}
],
"createdAt": "2019-09-23T09:29:19+00:00",
"updatedAt": "2019-09-23T09:29:19+00:00"
"updatedAt": "2019-09-23T09:29:19+00:00",
"labelIds": [100, 200]
}
}');

Expand Down Expand Up @@ -220,7 +224,8 @@ public function testReplace()
}
],
"createdAt": "2019-09-23T09:29:19+00:00",
"updatedAt": "2019-09-23T09:29:19+00:00"
"updatedAt": "2019-09-23T09:29:19+00:00",
"labelIds": [100, 200]
}
}'
]);
Expand Down
5 changes: 5 additions & 0 deletions tests/CrowdinApiClient/Model/ScreenshotTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ class ScreenshotTest extends TestCase
],
'createdAt' => '2019-09-23T09:29:19+00:00',
'updatedAt' => '2019-09-23T09:29:19+00:00',
'labelIds' => [
100,
200,
],
];

/**
Expand Down Expand Up @@ -82,5 +86,6 @@ public function checkData()
$this->assertEquals($this->data['tags'], $this->screenshot->getTags());
$this->assertEquals($this->data['createdAt'], $this->screenshot->getCreatedAt());
$this->assertEquals($this->data['updatedAt'], $this->screenshot->getUpdatedAt());
$this->assertEquals($this->data['labelIds'], $this->screenshot->getLabelIds());
}
}

0 comments on commit 596c905

Please sign in to comment.