Module Expr Str ImportFrom alias ImportFrom alias TryExcept body Assign NameStore NameLoad handlers ExceptHandler type NameLoad body Assign NameStore NameLoad ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults AttributeLoad NameLoad attr kwarg body Expr Str Assign AttributeStore NameLoad attr Dict Str Dict Str Call NameLoad keyword NameLoad NameLoad Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return SubscriptLoad SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index Str Index Str Index Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return Call AttributeLoad NameLoad attr SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index Str Index Str NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad kwarg body Expr Str If Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str If BoolOpOr Call NameLoad NameLoad NameLoad Call NameLoad NameLoad NameLoad body Assign NameStore Call NameLoad keyword NameLoad NameLoad orelse Assign NameStore Call NameLoad keyword Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str NameLoad NameLoad NameLoad If AttributeLoad AttributeLoad NameLoad attr attr body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Dict If NameLoad body Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad attr NameLoad ListLoad If CompareNotIn NameLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad body Assign SubscriptStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index NameLoad NameLoad Return Assign NameStore Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad attr NameLoad If Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Return Assign SubscriptStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index NameLoad ListLoad NameLoad NameLoad decorator_list decorator_list
N/A N/A 
Creating HAL documents.
 dougrain drafts dougrain link N/A N/A N/A _ unicode N/A N/A N/A NameError N/A N/A unicode str Builder N/A object N/A N/A Simplify creation of HAL documents.

    ``Builder`` provides a lightweight chainable API for creating HAL
    documents.

    Unlike ``dougrain.Document``, ``Builder`` provides no facilities for
    interrogating or mutating existing documents. ``Builder`` also makes fewer
    sanity checks than ``dougrain.Document``, which makes it considerably
    faster, but more likely to produce invalid HAL documents.

     __init__ N/A N/A self href draft N/A N/A drafts LATEST kwargs N/A N/A ``Builder(href, draft=drafts.LATEST, **kwargs)``

        Make a builder for a document. The document starts with a ``self``
        link to ``href``.

        The version of the spec may be specified in the optional ``draft``
        argument, which defaults to the latest draft. For example, to build a
        document conforming to the older Draft 4 of the spec:

        ``
        dougrain.Document("/test", draft=dougrain.drafts.DRAFT_4)
        ``

        Additional properties for the self link may be supplied in other
        keyword arguments. For example:

        ``
        dougrain.Document("/test", profile="/profiles/")
        ``

         N/A N/A self o N/A _links N/A self N/A dict href href kwargs N/A N/A self draft N/A draft draft N/A url N/A N/A self N/A N/A N/A Returns the URL for the resource based on the ``self`` link.

        This method is used when embedding a ``Builder`` in a
        ``dougrain.Document``.
         N/A N/A N/A N/A N/A self o N/A _links N/A self N/A href N/A as_object N/A N/A self N/A N/A N/A Returns a dictionary representing the HAL JSON document. N/A N/A self o N/A as_link N/A N/A self N/A N/A N/A Returns a ``Link`` to the document.

        This method is used when adding a link to a ``Builder`` from a
        ``dougrain.Document``.
         N/A N/A N/A link Link N/A N/A N/A self o N/A _links N/A self None N/A add_curie N/A N/A self name href N/A N/A N/A Adds a CURIE definition.

        A CURIE link with the given ``name`` and ``href`` is added to the
        document.

        This method returns self, allowing it to be chained with additional
        method calls.
         N/A N/A N/A N/A self draft set_curie self name href N/A self N/A set_property N/A N/A self name value N/A N/A N/A Set a property on the document.

        If there is no property with the name in ``name``, a new property is
        created with the name from ``name`` and the value from ``value``. If
        the document already has a property with that name, it's value
        is replaced with the value in ``value``.

        This method returns self, allowing it to be chained with additional
        method calls.

        WARNING: ``name`` should not be one of the reserved property
        names (``'_links'`` or ``'_embedded'``). If ``name`` is ``'_links'`` or
        ``'_embedded'``, this method may silently corrupt the JSON object
        representation and cause undefined behaviour later.

         N/A N/A N/A self o N/A name value N/A self N/A add_link N/A N/A self rel target wrap N/A False kwargs N/A N/A Adds a link to the document.

        This method adds a link to the given ``target`` to the document with
        the given ``rel``. If one or more links are already present for that
        link relationship type, the new link will be added to the existing
        links for that link relationship type.

        Unlike ``dougrain.Document.add_link``, this method does not detect
        equivalence between relationship types with different representations.

        If ``target`` is a string, a link is added with ``target`` as its
        ``href`` property and other properties from the keyword arguments.

        If ``target`` is a ``dougrain.Document`` object, a link is added with
        ``target``'s URL as its ``href`` property and other property from the
        keyword arguments.

        If ``target`` is a ``Builder`` object, a link is added with
        ``target``'s URL as its ``href`` property and other property from the
        keyword arguments.

        This method returns self, allowing it to be chained with additional
        method calls.

        Arguments:

        - ``rel``: a string specifying the link relationship type of the link.
          It should be a well-known link relation name from the IANA registry
          (http://www.iana.org/assignments/link-relations/link-relations.xml),
          a full URI, or a CURIE.
        - ``target``: the destination of the link.
        - ``wrap``: Defaults to False, but if True, specifies that the link
          object should be initally wrapped in a JSON array even if it is the
          first link for the given ``rel``.

         N/A N/A isinstance target bytes N/A N/A target N/A N/A target decode utf-8 N/A N/A N/A isinstance target str N/A isinstance target unicode N/A N/A new_link N/A dict href target kwargs N/A N/A new_link N/A dict href N/A N/A target url kwargs N/A N/A N/A self _add_rel _links rel new_link wrap N/A self N/A embed N/A N/A self rel target wrap N/A False N/A N/A Embeds a document inside this document.

        This method embeds the given document in this document with the given
        ``rel``. If one or more documents have already been embedded for that
        ``rel``, the new document will be embedded in addition to those
        documents.

        This method returns self, allowing it to be chained with additional
        method calls.

        Arguments:

        - ``rel``: a string specifying the link relationship type of the
          embedded resource. ``rel`` should be a well-known link relation name
          from the IANA registry
          (http://www.iana.org/assignments/link-relations/link-relations.xml),
          a full URI, or a CURIE.
        - ``target``: a ``Builder`` instance or a ``dougrain.Document``
          instance that will be embedded in this document.
        - ``wrap``: Defaults to False, but if True, specifies that the embedded
          resource object should be initally wrapped in a JSON array even if it
          is the first embedded resource for the given ``rel``.

        Unlike ``dougrain.Document.embed``, this method does not detect
        equivalence between relationship types with different representations.

        WARNING: ``target`` should not be identical to ``self`` or any document
        that embeds ``self``.
         N/A new_embed N/A N/A target as_object N/A N/A N/A self _add_rel _embedded rel new_embed wrap N/A N/A N/A self draft automatic_link N/A N/A N/A N/A self add_link rel target wrap N/A self N/A _add_rel N/A N/A self key rel thing wrap N/A N/A N/A Adds ``thing`` to links or embedded resources.

        Calling code should not use this method directly and should use
        ``embed`` or ``add_link`` instead.

         N/A N/A N/A N/A self o setdefault key N/A N/A wrap N/A N/A N/A N/A N/A N/A self o N/A key setdefault rel N/A N/A N/A rel N/A N/A self o N/A key N/A N/A N/A N/A N/A self o N/A key N/A rel thing N/A N/A existing N/A N/A N/A N/A self o N/A key get rel N/A N/A isinstance existing list N/A N/A N/A N/A existing append thing N/A N/A N/A N/A N/A self o N/A key N/A rel N/A existing thing N/A N/A