Developer Interface

This documentation covers the public interfaces fpdc_client provides.

Note

Documented interfaces follow Semantic Versioning 2.0.0. Any interface not documented here may change at any time without warning.

API entry point

This module is where client code can import objects.

fpdc_client.FPDC[source]

the FPDC server class to instanciate first.

fpdc_client.Release[source]

the release REST endpoint.

Base classes

This module contains the base classes that will be built upon to access API endpoints.

class fpdc_client.base.FPDC(url='https://fpdc.fedoraproject.org/')[source]

Main class handling the connection to an FPDC server.

app_id

str – The OpenID Connect application name. You may change it by subclassing or right after instanciation. It needs to be a valid linux filename, without slashes.

Parameters:url (str, optional) – The URL of the FPDC server.
connect()[source]

Connect to the FPDC server and retrieve the REST schema.

This method must be called before any other operation is possible.

class fpdc_client.base.APIObject(data, server=None)[source]

Base class for REST endpoints.

This class behaves like a dictionary: the endpoint’s attributes are available as items. One exception though, if you modify an attribute, you have to call the save() method to commit those changes to the server.

api_endpoint

str – the name of the REST API endpoint (e.g.: “release”). It must be implemented by sub-classes.

api_id

str – the endpoint’s property to use as the unique identifier (e.g.: “release_id”). It must be implemented by sub-classes.

Parameters:
  • data (dict) – data provided by the REST server.
  • server (FPDC, optional) – FPDC server, defaults to the last FPDC server that was connected to.
Raises:

NotImplementedError – raised if api_endpoint or api_id have not been implemented and are still None.

classmethod all(server=None)[source]

Retrieve all instances of this endpoint from the server.

Parameters:server (FPDC, optional) – FPDC server, defaults to the last FPDC server that was connected to.
Yields:APIObject – the next instance of this endpoint available on the server.
classmethod create(data, server=None)[source]

Create an instance of this endpoint on the server.

Parameters:
  • data (dict) – The instance’s attributes.
  • server (FPDC, optional) – FPDC server, defaults to the last FPDC server that was connected to.
Returns:

The newly created instance.

Return type:

APIObject

delete()[source]

Delete the instance on the server.

classmethod read(params, server=None)[source]

Retrieve a single instance of this endpoint from the server.

Parameters:
  • params (dict) – Query elements to select the desired instance.
  • server (FPDC, optional) – FPDC server, defaults to the last FPDC server that was connected to.
Returns:

The corresponding instance from the server.

Return type:

APIObject

save()[source]

Save the modifications on the server.

APIObject instances can be modified like a dictionary, but the changes are only committed to the server when the save() method is called.

REST endpoints

This module contains the REST API endpoint-specific classes.

class fpdc_client.endpoints.Release(data, server=None)[source]

API endpoint for releases.