Skip to content

Commit 2a14de7

Browse files
committed
Better support for the federation extension
1 parent 63f59d3 commit 2a14de7

File tree

3 files changed

+78
-1
lines changed

3 files changed

+78
-1
lines changed

openeo.d.ts

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,12 @@ declare module OpenEO {
395395
* @returns {Array.<Link>} Array of link objects (href, title, rel, type)
396396
*/
397397
links(): Array<Link>;
398+
/**
399+
* Returns list of backends in the federation.
400+
*
401+
* @returns {Array.<FederationBackend>} Array of backends
402+
*/
403+
listFederation(): Array<FederationBackend>;
398404
/**
399405
* Lists all supported features.
400406
*
@@ -646,7 +652,7 @@ declare module OpenEO {
646652
* @public
647653
* @type {Array.<string>}
648654
*/
649-
public 'federation:missing': Array<string>;
655+
public "federation:missing": Array<string>;
650656
/**
651657
* Returns the file types response as a JSON serializable representation of the data that is API compliant.
652658
*
@@ -2635,6 +2641,10 @@ declare module OpenEO {
26352641
export type Collections = {
26362642
collections: Array<Collection>;
26372643
links: Array<Link>;
2644+
/**
2645+
* "federation:missing"] A list of backends from the federation that are missing in the response data.
2646+
*/
2647+
"federation:missing": Array<string>;
26382648
};
26392649
export type Collection = object<string, any>;
26402650
export type FileTypesAPI = {
@@ -2815,11 +2825,52 @@ declare module OpenEO {
28152825
* EXPERIMENTAL!
28162826
*/
28172827
namespaces: Array<string> | null;
2828+
/**
2829+
* "federation:missing"] A list of backends from the federation that are missing in the response data.
2830+
*/
2831+
"federation:missing": Array<string>;
28182832
};
28192833
/**
28202834
* An openEO processing chain.
28212835
*/
28222836
export type Process = object<string, any>;
2837+
/**
2838+
* An array of backends in the federation.
2839+
*/
2840+
export type FederationBackend = {
2841+
/**
2842+
* URL to the versioned API endpoint of the back-end.
2843+
*/
2844+
url: string;
2845+
/**
2846+
* Name of the back-end.
2847+
*/
2848+
title: string;
2849+
/**
2850+
* A description of the back-end and its specifics.
2851+
*/
2852+
description: string;
2853+
/**
2854+
* Current status of the back-ends (online or offline).
2855+
*/
2856+
status: string;
2857+
/**
2858+
* The time at which the status of the back-end was checked last, formatted as a RFC 3339 date-time.
2859+
*/
2860+
last_status_check: string;
2861+
/**
2862+
* If the `status` is `offline`: The time at which the back-end was checked and available the last time. Otherwise, this is equal to the property `last_status_check`. Formatted as a RFC 3339 date-time.
2863+
*/
2864+
last_successful_check: string;
2865+
/**
2866+
* Declares the back-end to be experimental.
2867+
*/
2868+
experimental: boolean;
2869+
/**
2870+
* Declares the back-end to be deprecated.
2871+
*/
2872+
deprecated: boolean;
2873+
};
28232874
/**
28242875
* An array, but enriched with additional details from an openEO API response.
28252876
*

src/capabilities.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,15 @@ class Capabilities {
192192
return Array.isArray(this.data.links) ? this.data.links : [];
193193
}
194194

195+
/**
196+
* Returns list of backends in the federation.
197+
*
198+
* @returns {Array.<FederationBackend>} Array of backends
199+
*/
200+
listFederation() {
201+
return Array.isArray(this.data.federation) ? this.data.federation : [];
202+
}
203+
195204
/**
196205
* Lists all supported features.
197206
*

src/typedefs.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
* @type {object}
4848
* @property {Array.<Collection>} collections
4949
* @property {Array.<Link>} links
50+
* @property {Array.<string>} ["federation:missing"] A list of backends from the federation that are missing in the response data.
5051
*/
5152

5253
/**
@@ -184,6 +185,7 @@
184185
* @property {Array.<Process>} processes
185186
* @property {Array.<Link>} links
186187
* @property {?Array.<string>} namespaces EXPERIMENTAL!
188+
* @property {Array.<string>} ["federation:missing"] A list of backends from the federation that are missing in the response data.
187189
*/
188190

189191
/**
@@ -193,6 +195,21 @@
193195
* @type {object.<string, *>}
194196
*/
195197

198+
/**
199+
* An array of backends in the federation.
200+
*
201+
* @typedef FederationBackend
202+
* @type {Object}
203+
* @property {string} url URL to the versioned API endpoint of the back-end.
204+
* @property {string} title Name of the back-end.
205+
* @property {string} description A description of the back-end and its specifics.
206+
* @property {string} status Current status of the back-ends (online or offline).
207+
* @property {string} last_status_check The time at which the status of the back-end was checked last, formatted as a RFC 3339 date-time.
208+
* @property {string} last_successful_check If the `status` is `offline`: The time at which the back-end was checked and available the last time. Otherwise, this is equal to the property `last_status_check`. Formatted as a RFC 3339 date-time.
209+
* @property {boolean} experimental Declares the back-end to be experimental.
210+
* @property {boolean} deprecated Declares the back-end to be deprecated.
211+
*/
212+
196213
/**
197214
* An array, but enriched with additional details from an openEO API response.
198215
*

0 commit comments

Comments
 (0)