Nextcloud PHP API (master)

IOCMDiscoveryService

Discover remote OCM services

Tags
since
28.0.0
Attributes
#[Consumable]
$since: '28.0.0'

Table of Contents

Methods

discover()  : IOCMProvider
Discover remote OCM services
getIncomingSignedRequest()  : IIncomingSignedRequest|null
returns signed request if available.
getLocalOCMProvider()  : IOCMProvider
return discovery data about local instance.
requestRemoteOcmEndpoint()  : IResponse
Request a remote OCM endpoint.

Methods

discover()

Discover remote OCM services

public discover(string $remote[, bool $skipCache = false ]) : IOCMProvider
Parameters
$remote : string

address of the remote provider

$skipCache : bool = false

ignore cache, refresh data

Tags
throws
OCMProviderException

if no valid discovery data can be returned

since
28.0.0
since
32.0.0

returns ICapabilityAwareOCMProvider instead of IOCMProvider

since
33.0.0

returns IOCMProvider (rollback)

Return values
IOCMProvider

getIncomingSignedRequest()

returns signed request if available.

public getIncomingSignedRequest() : IIncomingSignedRequest|null

throw an exception:

  • if request is signed, but wrongly signed
  • if request is not signed but instance is configured to only accept signed ocm request
Tags
throws
IncomingRequestException
since
33.0.0
Return values
IIncomingSignedRequest|null

null if remote does not (and never did) support signed request

getLocalOCMProvider()

return discovery data about local instance.

public getLocalOCMProvider([bool $fullDetails = true ]) : IOCMProvider

will generate event LocalOCMDiscoveryEvent so that 3rd parties can define new resources.

Parameters
$fullDetails : bool = true

complete details, including public keys. Set to FALSE for client (capabilities) purpose.

Tags
since
33.0.0
Return values
IOCMProvider

requestRemoteOcmEndpoint()

Request a remote OCM endpoint.

public requestRemoteOcmEndpoint(string|null $capability, string $remote, string $ocmSubPath[, array<string|int, mixed>|null $payload = null ][, string $method = 'get' ][, IClient|null $client = null ][, array<string|int, mixed>|null $options = null ][, bool $signed = true ]) : IResponse

Capability can be filtered out The final path will be generated based on remote discovery.

Parameters
$capability : string|null

when not NULL, method will throw OCMCapabilityException if remote does not support the capability

$remote : string

remote ocm cloud id

$ocmSubPath : string

path to reach, complementing the ocm endpoint extracted from remote discovery data

$payload : array<string|int, mixed>|null = null

payload attached to the request

$method : string = 'get'

method to use ('get', 'post', 'put', 'delete')

$client : IClient|null = null

NULL to use default IClient

$options : array<string|int, mixed>|null = null

options related to IClient

$signed : bool = true

FALSE to not auth the request

Tags
throws
OCMProviderException
throws
OCMCapabilityException

if remote does not support $capability

since
33.0.0
Return values
IResponse

        
On this page

Search results