Endpoints

BaseEndpoint

class hyperadmin.endpoints.BaseEndpoint(**kwargs)

Represents an API Endpoint

form_class = None

The default form class for links created by this endpoint

item_form_class = None

The form class representing items from this endpoint. The form created is used for serialization of item.

state_class

alias of EndpointState

resource_item_class

alias of Item

app_name = None

The slug that identifies the application of this endpoint. Typically set by the site object.

base_url_name_suffix = None

The suffix to apply to the base url name when concating the base name from the parent

base_url_name = None

Set the base url name instead of getting it from the parent

name_suffix = None

The suffix to add to the generated url name. This also used by the parent endpoint to reference child endpoints

url_name = None

Set the url name of the endpoint instead of generating one

global_state = None

Dictionary for overiding particular values in the state

endpoint_class = None

A slug identifying the primary role of the endpoint

endpoint_classes = []

A list of slugs identifying the various roles or functions of the endpoint

api_request = None

The api request responsible for the endpoint. Generated automatically.

post_register()
get_logger()
get_site()
set_site(site)
site
get_parent()
set_parent(parent)
parent
get_endpoint_kwargs(**kwargs)

Consult for creating child endpoints

get_common_state()
common_state
get_state()
set_state(state)
state

The state responsible for the endpoint. Generated automatically.

get_meta()
Return type:dict
get_endpoint_classes()

Returns a list of functional identifiers

Return type:list of strings
get_state_data()
Return type:dict
get_state_kwargs()
Return type:dict
get_state_class()
initialize_state(**data)
reverse(*args, **kwargs)

URL Reverse the given arguments

Return type:string
get_base_url_name_suffix()
get_base_url_name_prefix()
get_base_url_name()

Returns the base url name to be used by our name and the name of our children endpoints Return self.base_url_name if set otherwise return the concat of self.get_base_url_name_prefix() and self.get_base_url_name_suffix()

get_name_suffix()
get_url_name()

Returns the url name that will address this endpoint Return self.url_name is set otherwise return the result of concatting self.get_base_url_name() and self.get_name_suffx()

get_url(**kwargs)
get_url_suffix()

Returns an instantiated LinkCollection object

Return type:LinkCollection

return a list of tuples containing link prototype class and kwargs

Instantiates the link prototypes from get_link_prototypes

Return type:list of link prototypes
Return type:dict
fork(**kwargs)
Return type:endpoint
fork_state(**kwargs)
Return type:endpoint
get_resource_item_class()
get_resource_item(instance, **kwargs)

Wraps an object in a resource item

Return type:resource item
get_instances()

Returns the list of active objects available for this request

Return type:list of objects
get_resource_items()

Returns a list of resource items available for this request. Calls get_instances for the objects the items represent.

Return type:list of resource items
get_form_class()
get_form_kwargs(**kwargs)
get_item_form_class()
get_item_form_kwargs(item=None, **kwargs)
Return type:dict
get_namespaces()
Return type:dictionary of namespaces
get_item_namespaces(item)
Parameters:item – resource item
Return type:dictionary of namespaces
get_item_url(item)
get_item_prompt(item)

Returns a string representing the resource item

get_prompt()

Returns a string representing this endpoint

api_permission_check(api_request, endpoint)
generate_response(link)
generate_options_response(links)
create_internal_apirequest(**kwargs)
create_apirequest(**kwargs)
expand_template_names(suffixes)
get_context_data(**kwargs)
generate_api_response(api_request)
Return type:Link or HttpResponse
emit_event(event, item_list=None)

Fires of the endpoint_event signal

get_datatap(instream=None, **kwargs)

Returns a datatap that can serialize hypermedia items and deserialize to native instances

Parameters:instream – A list of resource items or a primitive datatap
get_native_datatap_instream_from_items(items)

Makes an instream of item forms

get_native_datatap(instream=None, **kwargs)

Returns a datatap that can serialize the forms belonging to hypermedia items.

VirtualEndpoint

class hyperadmin.endpoints.VirtualEndpoint(**kwargs)

A type of endpoint that does not define any active endpoints itself but references other endpoints.

name_suffix = 'virtual'
get_children_endpoints()
get_urls()
get_extra_urls()
urls
dynamic_urls()
urlpatterns
get_url_object()

Inludes the link prototypes created by the children endpoints

get_index_endpoint()
get_url(**kwargs)
generate_api_response(api_request)

Calls the index endpoint and returns it’s api response :rtype: Link or HttpResponse

RootEndpoint

class hyperadmin.endpoints.RootEndpoint(**kwargs)

Bases: hyperadmin.endpoints.APIRequestBuilder, hyperadmin.endpoints.VirtualEndpoint

The top endpoint of a hypermedia aware site

Child endpoints bind to this and this endpoint is used to mount in urls.py

namespace = None

The namespace of this endpoint, will be autogenerated if none is supplied

media_types = None

Dictionary of supported media types

template_paths = None

List of template paths to use for template name resolution

base_url_name = ''
name_suffix = 'virtualroot'
parent
get_logger()
post_register()
get_site()
site
fork(**kwargs)
urls
reverse(name, *args, **kwargs)
get_resolver()
call_endpoint(url, **request_params)

Looks up the endpoint as an internal api request :rtype: Bound Endpoint

register_media_type(media_type, media_type_handler)
record_endpoint(endpoint, url_name=None)
get_endpoint_from_urlname(urlname)
api_permission_check(api_request, endpoint)

Return a link describing the authentication failure or return None if the request has sufficient permissions

get_template_paths()
expand_template_names(suffixes)

Maps a list of template names to the template paths belonging to the site :param suffixes: List of strings :rtype: List of strings

get_context_data(**kwargs)

Endpoint

class hyperadmin.endpoints.Endpoint(**kwargs)

Bases: hyperadmin.endpoints.GlobalSiteMixin, hyperadmin.views.EndpointViewMixin, hyperadmin.endpoints.BaseEndpoint

Endpoint class that contains link prototypes and maps HTTP requests to those links.

url_suffix = None
base_url_name_suffix = ''
prototype_method_map = {}
get_available_methods()

Return the link prototype representing the action for the method Consults prototype_method_map for the link name and returns the prototype from link_prototypes

Returns a dictionary mapping available HTTP methods to a link

get_url_suffix()
get_view_kwargs(**kwargs)
Return type:dict
get_view(**kwargs)
Return type:view callable
get_url_object()

Project Versions

Table Of Contents

Previous topic

Wizard Resources

Next topic

API Requests

This Page