Skip to content
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
6 changes: 6 additions & 0 deletions docs/endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ Upload image for an application
uploadImage(int $id, string $image): stdClass
```

Delete the image for an application

```PHP
deleteImage(int $id): stdClass
```

## ApplicationMessage

```PHP
Expand Down
15 changes: 15 additions & 0 deletions src/Endpoint/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,19 @@ public function uploadImage(int $id, string $image): stdClass

return (object) $application;
}

/**
* Delete the image of an application
*
* @param int $id Application Id
*
* @return boolean
*
* @see https://gotify.net/api-docs#/application/removeAppImage API docs for deleting an application image
*/
public function deleteImage(int $id): bool
{
$response = $this->guzzle->delete($this->endpoint . '/' . $id . '/image');
return $response->getStatusCode() === 200 ? true : false;
}
}
10 changes: 10 additions & 0 deletions tests/Endpoints/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,16 @@ public function testUploadImage(): void
$this->assertObjectHasProperty('image', $uploaded);
}

/**
* Test deleting an image for the application
*/
#[Depends('testUploadImage')]
public function testDeleteImage(): void
{
$deleted = self::$application->deleteImage(self::$appId);
$this->assertTrue($deleted);
}

/**
* Test deleting an application
*/
Expand Down