Hosting Handler

delete()

Signature

public function delete(ProductHosting $productHosting): ServerHostingLockedResponse

Description

Deletes the hosting product

Return value

ServerHostingDeletedResponse for success, Exception with the mesage on error. Example:

return new ServerHostingDeletedResponse()

Example

/**
 * @param ProductHosting $productHosting
 * @return ServerHostingDeletedResponse
 * @throws GuzzleException
 */
public function unlock(ProductHosting $productHosting): ServerHostingDeletedResponse{
        // API request to delete the user
        $res = $this->getClient($productHosting->host)->killUser($productHosting->custom_fields['nextcloudUser']);
        
        // error handling
        if (isset($res['meta']) && $res['meta']['statuscode'] !== "100") {
		throw new Exception(json_encode($res));
        }

        // success
	return new ServerHostingDeletedResponse();
}
Was this helpful?