4
0
Fork 0
api-powers/src/a752e4b2-9b5e-4188-8d33-379.../code.power

74 lines
2.0 KiB
Plaintext

/**
* Get the chapters in a book in a translation
*
* @param string $translation The translation.
* @param int $book The book number.
*
* @return object|null The response object or null if an error occurs.
* @since 2.0.1
*/
public function get(string $translation, int $book): ?object
{
return $this->response->get(
$this->http->get(
$this->uri->get($translation . '/' . $book . '.json')
)
);
}
/**
* List the chapters of a book in a translation
*
* @param string $translation The translation.
* @param int $book The book number.
*
* @return object|null The response object or null if an error occurs.
* @since 2.0.1
*/
public function list( string $translation, int $book): ?object
{
return $this->response->get(
$this->http->get(
$this->uri->get($translation . '/' . $book . '/chapters.json')
)
);
}
/**
* List the chapters checksums of a book in a translation
*
* @param string $translation The translation.
* @param int $book The book number.
*
* @return object|null The response object or null if an error occurs.
* @since 2.0.1
*/
public function checksum(string $translation, int $book): ?object
{
return $this->response->get(
$this->http->get(
$this->uri->get($translation . '/' . $book . '/checksum.json')
)
);
}
/**
* Get the chapter's checksums of a book in a translation
*
* @param string $translation The translation.
* @param int $book The book number.
* @param int $chapter The chapter number.
*
* @return string|null The response checksum or null if an error occurs.
* @since 2.0.1
*/
public function sha(string $translation, int $book, int $chapter): ?string
{
return trim(
$this->response->get(
$this->http->get(
$this->uri->get($translation . '/' . $book . '/' . $chapter . '.sha')
)
)
);
}