rbtools.api.factory¶
Functions
|
Construct and return a resource object. |
- rbtools.api.factory.create_resource(transport: Transport, payload: dict, url: str, mime_type: Optional[str] = None, item_mime_type: Optional[str] = None, guess_token: bool = True) Resource[source]¶
Construct and return a resource object.
- Parameters:
transport (
rbtools.api.transport.Transport) – The API transport.payload (
dict) – The payload returned from the API endpoint.url (
str) – The URL of the API endpoint.mime_type (
str, optional) – The MIME type of the API response. This is used to find a resource specific class. If no resource specific class exists, one of the generic base classes (ResourceorResourceList) will be used.item_mime_type (
str, optional) – The MIME type to use when constructing individual items within a list resource.guess_token (
bool, optional) – Whether to guess the key for the API response body. IfFalse, we assume that the resource body is the body of the payload itself. This is important for constructing item resources from a resource list.
- Returns:
The resource instance.
- Return type: