PushResource

Push devices and the project's push provider under /v1/push.

  • Stable unknown
  • Release candidate not available
  • Development since 0.2.0-dev.32+058a03c
public final class PushResource

Push devices and the project's push provider under /v1/push. Get it from Ovok.push().

Methods

devices

public PushResource.Devices devices()

Returns the signed-in person's push devices.

Returns: the devices resource

provider

public PushResource.Provider provider()

Returns the project's push provider, for project admins.

Returns: the provider resource

PushResource.Devices

public static final class Devices

The devices the signed-in person receives push on, each their own.

Devices.register

public JsonNode register(
        Object device,
        RequestOptions options) throws IOException, InterruptedException

Registers a device token to the signed-in person; the same token again answers the same device (POST /v1/push/devices).

Parameters:

  • device: the token, platform (ios, android or web) and optional appId
  • options: per-request options, such as the timeout

Returns: the device, never with its token

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response

Devices.list

public JsonNode list(RequestOptions options) throws IOException, InterruptedException

Lists the signed-in person's devices (GET /v1/push/devices).

Parameters:

  • options: per-request options, such as the timeout

Returns: the response body, with the devices under devices

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response

Devices.unregister

public void unregister(String id, RequestOptions options) throws IOException, InterruptedException

Removes a device, which then gets no more push (DELETE /v1/push/devices/{id}).

Parameters:

  • id: the device id
  • options: per-request options, such as the timeout

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response

PushResource.Provider

public static final class Provider

The provider the project's push goes through (fcm, apns, expo or relay).

Provider.retrieve

public JsonNode retrieve(RequestOptions options) throws IOException, InterruptedException

Reads the push provider and its settings, never a secret (GET /v1/push/provider).

Parameters:

  • options: per-request options, such as the timeout

Returns: the provider

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response

Provider.create

public JsonNode create(
        Object provider,
        RequestOptions options) throws IOException, InterruptedException

Sets up the push provider; a relay's signing secret is answered this once (POST /v1/push/provider).

Parameters:

  • provider: the provider name and its credentials
  • options: per-request options, such as the timeout

Returns: the provider as set up

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response

Provider.update

public JsonNode update(
        Object changes,
        RequestOptions options) throws IOException, InterruptedException

Changes the push provider (PATCH /v1/push/provider).

Parameters:

  • changes: the provider set up, and the fields to change
  • options: per-request options, such as the timeout

Returns: the provider after the change

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response

Provider.remove

public void remove(RequestOptions options) throws IOException, InterruptedException

Removes the push provider; no push is sent until one is set up again (DELETE /v1/push/provider).

Parameters:

  • options: per-request options, such as the timeout

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response

Last updated on

On this page