Hosting Handler

unlock()

Signature

public function unlock(ProductHosting $productHosting): ServerHostingLockedResponse

Description

Unsuspension of the product. This happens when the overdue invoice gets paid / the locked hosting gets reactivated

Return value

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

return new ServerHostingUnlockedResponse()

Example

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

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