Module m_rsc_import

Importing non-authoritative things exported by m_rsc_export into the system.

Copyright © 2010-2021 Arjan Scherpenisse, Marc Worrell

Behaviours: zotonic_model.

Authors: Arjan Scherpenisse (arjan@scherpenisse.net).

Description

Importing non-authoritative things exported by m_rsc_export into the system.

Data Types

import_map()

import_map() = #{binary() => m_rsc:resource_id()}

import_result()

import_result() = {ok, {m_rsc:resource_id(), import_map()}} | {error, term()}

option()

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()}

options()

options() = [option()]

Function Index

fetch_preview/2Fetch a sanitized version of the resource at the Url.
get_import_status/2Fetch the import status of a resource.
import/2Import a resource using default import options.
import/3Import a resource.
import_referred_ids_task/3
import_uri/2Import a non-authoritative resource from a remote URI using default import options.
import_uri/3Import a non-authoritative resource from a remote URI.
import_uri_recursive/3Recursive import of resources.
import_uri_recursive_async/3Recursive import of resources, async import of all referred ids.
install/1
is_imported/2Check if a resource has been succesfully imported.
m_get/3
mark_imported/3Mark a resource as imported, set the import result.
reimport/2Reimport a non-authoritative resource or placeholder using the saved import flags.
reimport/4Reimport a non-authoritative resource or placeholder using new import options.
reimport_recursive/2Reimport a non-authoritative resource or placeholder using the saved import flags.
reimport_recursive/4Reimport a non-authoritative resource or placeholder using the saved import flags.
reimport_recursive_async/2Reimport a non-authoritative resource or placeholder using the saved import flags, async reimport of all objects.
set_import_status/3Modify the import options of the resource.
update_medium_uri/4

Function Details

fetch_preview/2

fetch_preview(Url::string() | binary(), Context::z:context()) -> {ok, m_rsc:props()} | {error, term()}

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.

get_import_status/2

get_import_status(Rsc::m_rsc:resource(), Context::z:context()) -> {ok, map()} | {error, term()}

Fetch the import status of a resource.

import/2

import(JSON::map(), Context::z:context()) -> import_result()

Import a resource using default import options.

import/3

import(JSON::map(), Options::options(), Context::z:context()) -> import_result()

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_referred_ids_task/3

import_referred_ids_task(RefIds::map(), ImportedIds::map(), Context::z:context()) -> ok

import_uri/2

import_uri(Uri::string() | binary(), Context::z:context()) -> import_result()

Import a non-authoritative resource from a remote URI using default import options.

import_uri/3

import_uri(Uri::string() | binary(), Options::options(), Context::z:context()) -> import_result()

Import a non-authoritative resource from a remote URI.

import_uri_recursive/3

import_uri_recursive(Uri::string() | binary(), Options::options(), Context::z:context()) -> import_result()

Recursive import of resources.

import_uri_recursive_async/3

import_uri_recursive_async(Uri::string() | binary(), Options::options(), Context::z:context()) -> import_result()

Recursive import of resources, async import of all referred ids.

install/1

install(Context::z:context()) -> ok

is_imported/2

is_imported(Rsc::m_rsc:resource(), Context::z:context()) -> boolean()

Check if a resource has been succesfully imported.

m_get/3

m_get(Rest::list(), X2::zotonic_model:opt_msg(), Context::z:context()) -> zotonic_model:return()

mark_imported/3

mark_imported(RscId::m_rsc:resource_id(), Status::atom() | binary() | string(), Context::z:context()) -> ok | {error, enoent}

Mark a resource as imported, set the import result.

reimport/2

reimport(Id::m_rsc:resource_id(), Context::z:context()) -> import_result()

Reimport a non-authoritative resource or placeholder using the saved import flags.

reimport/4

reimport(Id::m_rsc:resource_id(), RefIds::map(), Options::options() | saved, Context::z:context()) -> import_result()

Reimport a non-authoritative resource or placeholder using new import options.

reimport_recursive/2

reimport_recursive(Id::m_rsc:resource_id(), Context::z:context()) -> import_result()

Reimport a non-authoritative resource or placeholder using the saved import flags.

reimport_recursive/4

reimport_recursive(Id::m_rsc:resource_id(), RefIds::map(), Options::options() | saved, Context::z:context()) -> import_result()

Reimport a non-authoritative resource or placeholder using the saved import flags.

reimport_recursive_async/2

reimport_recursive_async(Id::m_rsc:resource_id(), Context::z:context()) -> import_result()

Reimport a non-authoritative resource or placeholder using the saved import flags, async reimport of all objects.

set_import_status/3

set_import_status(Rsc::m_rsc:resource(), Status::map(), Context::z:context()) -> {ok, m_rsc:resource_id()} | {error, term()}

Modify the import options of the resource.

update_medium_uri/4

update_medium_uri(LocalId::m_rsc:resource_id(), Uri::string() | binary(), Options::options(), Context::z:context()) -> {ok, m_rsc:resource_id()}


Generated by EDoc