m_rsc_import (zotonic_core v1.0.0-rc.11)
Link to this section Summary
Functions
Fetch a sanitized version of the resource at the Url. Without edges, mapping of embedded ids etc. This is to be used as a simple and quick preview of the resource at the given Uri.
Fetch the import status of a resource.
Import a resource using default import options.
Import a resource. If the resource already exists then it must be non-authoritative and have a matching URI. The resource to be updated is looked up by matching either the URI or the unique name. If the unique name matches then the category of the existing resource must have an overlap with the category of the imported resource.
Import a non-authoritative resource from a remote URI using default import options.
Import a non-authoritative resource from a remote URI.
Recursive import of resources.
Recursive import of resources, async import of all referred ids.
Check if a resource has been succesfully imported.
Mark a resource as imported, set the import result.
Reimport a non-authoritative resource or placeholder using the saved import flags.
Reimport a non-authoritative resource or placeholder using new import options.
Reimport a non-authoritative resource or placeholder using the saved import flags.
Reimport a non-authoritative resource or placeholder using the saved import flags.
Reimport a non-authoritative resource or placeholder using the saved import flags, async reimport of all objects.
Modify the import options of the resource.
Link to this section Types
Link to this type
import_map/0
-type import_map() :: #{binary() => m_rsc:resource_id()}.
Link to this type
import_result/0
-type import_result() :: {ok, {m_rsc:resource_id(), import_map()}} | {error, term()}.
Link to this type
option/0
-type option() :: {props_forced, map()} | {props_default, map()} | {import_edges, non_neg_integer()} | is_import_deleted | {is_import_deleted, boolean()} | is_authoritative | {is_authoritative, boolean()} | {allow_category, [binary()]} | {allow_predicate, [binary()]} | {deny_category, [binary()]} | {deny_predicate, [binary()]} | {fetch_options, z_url_fetch:options()} | {uri_template, binary()}.
Link to this type
options/0
-type options() :: [option()].
Link to this section Functions
Link to this function
fetch_preview(Url, Context)
-spec fetch_preview(string() | binary(), z:context()) -> {ok, m_rsc:props()} | {error, term()}.
Link to this function
get_import_status(Rsc, Context)
-spec get_import_status(m_rsc:resource(), z:context()) -> {ok, map()} | {error, term()}.
Link to this function
import(JSON, Context)
-spec import(map(), z:context()) -> import_result().
Link to this function
import(JSON, Options, Context)
-spec import(map(), options(), z:context()) -> import_result().
Link to this function
import_referred_ids_task(RefIds, ImportedIds, Context)
-spec import_referred_ids_task(map(), map(), z:context()) -> ok.
Link to this function
import_uri(Uri, Context)
-spec import_uri(string() | binary(), z:context()) -> import_result().
Link to this function
import_uri(Uri, Options, Context)
-spec import_uri(string() | binary(), options(), z:context()) -> import_result().
Link to this function
import_uri_recursive(Uri, Options, Context)
-spec import_uri_recursive(string() | binary(), options(), z:context()) -> import_result().
Link to this function
import_uri_recursive_async(Uri, Options, Context)
-spec import_uri_recursive_async(string() | binary(), options(), z:context()) -> import_result().
Link to this function
install(Context)
-spec install(z:context()) -> ok.
Link to this function
is_imported(Rsc, Context)
-spec is_imported(m_rsc:resource(), z:context()) -> boolean().
Link to this function
m_get(Rest, _, Context)
-spec m_get(list(), zotonic_model:opt_msg(), z:context()) -> zotonic_model:return().
Link to this function
mark_imported(RscId, Status, Context)
-spec mark_imported(m_rsc:resource_id(), atom() | binary() | string(), z:context()) -> ok | {error, enoent}.
Link to this function
reimport(Id, Context)
-spec reimport(m_rsc:resource_id(), z:context()) -> import_result().
Link to this function
reimport(Id, RefIds, Options, Context)
-spec reimport(m_rsc:resource_id(), map(), options() | saved, z:context()) -> import_result().
Link to this function
reimport_recursive(Id, Context)
-spec reimport_recursive(m_rsc:resource_id(), z:context()) -> import_result().
Link to this function
reimport_recursive(Id, RefIds, Options, Context)
-spec reimport_recursive(m_rsc:resource_id(), map(), options() | saved, z:context()) -> import_result().
Link to this function
reimport_recursive_async(Id, Context)
-spec reimport_recursive_async(m_rsc:resource_id(), z:context()) -> import_result().
Link to this function
set_import_status(Rsc, Status, Context)
-spec set_import_status(m_rsc:resource(), map(), z:context()) -> {ok, m_rsc:resource_id()} | {error, term()}.
Link to this function
update_medium_uri(LocalId, Uri, Options, Context)
-spec update_medium_uri(m_rsc:resource_id(), string() | binary(), options(), z:context()) -> {ok, m_rsc:resource_id()}.