UNPKG

@inrupt/solid-client

Version:

Make your web apps work with Solid Pods.

194 lines (193 loc) • 9.62 kB
import type { Literal, NamedNode, Quad_Object } from "@rdfjs/types"; import type { UrlString, Url, Thing, IriString } from "../interfaces"; import type { Time } from "../datatypes"; /** * Create a new Thing with a URL added for a Property. * * This preserves existing values for the given Property. To replace them, see [[setUrl]]. * * The original `thing` is not modified; this function returns a cloned Thing with updated values. * * @param thing Thing to add a URL value to. * @param property Property for which to add the given URL value. * @param url URL to add to `thing` for the given `property`. * @returns A new Thing equal to the input Thing with the given value added for the given Property. */ export declare const addUrl: AddOfType<Url | UrlString | Thing>; /** @hidden Alias for [[addUrl]] for those who prefer IRI terminology. */ export declare const addIri: AddOfType<string | Url | Readonly<{ type: "Subject"; url: import("../rdf.internal").BlankNodeId | import("../rdf.internal").LocalNodeIri | IriString; predicates: import("../rdf.internal").Predicates; }>>; /** * Create a new Thing with a boolean added for a Property. * * This preserves existing values for the given Property. To replace them, see [[setBoolean]]. * * The original `thing` is not modified; this function returns a cloned Thing with updated values. * * @param thing Thing to add a boolean value to. * @param property Property for which to add the given boolean value. * @param value Boolean to add to `thing` for the given `property`. * @returns A new Thing equal to the input Thing with the given value added for the given Property. */ export declare const addBoolean: AddOfType<boolean>; /** * Create a new Thing with a datetime added for a Property. * * This preserves existing values for the given Property. To replace them, see [[setDatetime]]. * * The original `thing` is not modified; this function returns a cloned Thing with updated values. * * @param thing Thing to add a datetime value to. * @param property Property for which to add the given datetime value. * @param value Datetime to add to `thing` for the given `property`. * @returns A new Thing equal to the input Thing with the given value added for the given Property. */ export declare const addDatetime: AddOfType<Date>; /** * Create a new Thing with a date added for a Property. * * This preserves existing values for the given Property. To replace them, see [[setDate]]. * * The original `thing` is not modified; this function returns a cloned Thing with updated values. * * @param thing Thing to add a date value to. * @param property Property for which to add the given date value. * @param value Date to add to `thing` for the given `property`. * @returns A new Thing equal to the input Thing with the given value added for the given Property. * @since 1.10.0 */ export declare const addDate: AddOfType<Date>; /** * Create a new Thing with a time added for a Property. * * This preserves existing values for the given Property. To replace them, see [[setDatetime]]. * * The original `thing` is not modified; this function returns a cloned Thing with updated values. * * @param thing Thing to add a datetime value to. * @param property Property for which to add the given datetime value. * @param value time to add to `thing` for the given `property`. * @returns A new Thing equal to the input Thing with the given value added for the given Property. * @since 1.10.0 */ export declare const addTime: AddOfType<Time>; /** * Create a new Thing with a decimal added for a Property. * * This preserves existing values for the given Property. To replace them, see [[setDecimal]]. * * The original `thing` is not modified; this function returns a cloned Thing with updated values. * * @param thing Thing to add a decimal value to. * @param property Property for which to add the given decimal value. * @param value Decimal to add to `thing` for the given `property`. * @returns A new Thing equal to the input Thing with the given value added for the given Property. */ export declare const addDecimal: AddOfType<number>; /** * Create a new Thing with an integer added for a Property. * * This preserves existing values for the given Property. To replace them, see [[setInteger]]. * * The original `thing` is not modified; this function returns a cloned Thing with updated values. * * @param thing Thing to add an integer value to. * @param property Property for which to add the given integer value. * @param value Integer to add to `thing` for the given `property`. * @returns A new Thing equal to the input Thing with the given value added for the given Property. */ export declare const addInteger: AddOfType<number>; /** * Create a new Thing with an English string added for a Property. * * This preserves existing values for the given Property. To replace them, see [[setStringEnglish]]. * * The original `thing` is not modified; this function returns a cloned Thing with updated values. * * @param thing Thing to add a localised string value to. * @param property Property for which to add the given string value. * @param value String to add to `thing` for the given `property`. * @returns A new Thing equal to the input Thing with the given value added for the given Property. * @since 1.13.0 */ export declare function addStringEnglish<T extends Thing>(thing: T, property: Url | UrlString, value: string): T; /** * Create a new Thing with a localised string added for a Property. * * This preserves existing values for the given Property. To replace them, see [[setStringWithLocale]]. * * The original `thing` is not modified; this function returns a cloned Thing with updated values. * * @param thing Thing to add a localised string value to. * @param property Property for which to add the given string value. * @param value String to add to `thing` for the given `property`. * @param locale Locale of the added string. * @returns A new Thing equal to the input Thing with the given value added for the given Property. */ export declare function addStringWithLocale<T extends Thing>(thing: T, property: Url | UrlString, value: string, locale: string): T; /** * Create a new Thing with an unlocalised string added for a Property. * * This preserves existing values for the given Property. To replace them, see [[setStringNoLocale]]. * * The original `thing` is not modified; this function returns a cloned Thing with updated values. * * @param thing Thing to add an unlocalised string value to. * @param property Property for which to add the given string value. * @param value String to add to `thing` for the given `property`. * @returns A new Thing equal to the input Thing with the given value added for the given Property. */ export declare const addStringNoLocale: AddOfType<string>; /** * Create a new Thing with a Named Node added for a Property. * * This preserves existing values for the given Property. To replace them, see [[setNamedNode]]. * * The original `thing` is not modified; this function returns a cloned Thing with updated values. * * @ignore This should not be needed due to the other add*() functions. If you do find yourself needing it, please file a feature request for your use case. * @param thing The [[Thing]] to add a Named Node to. * @param property Property for which to add a value. * @param value The Named Node to add. * @returns A new Thing equal to the input Thing with the given value added for the given Property. */ export declare function addNamedNode<T extends Thing>(thing: T, property: Url | UrlString, value: NamedNode): T; /** * Create a new Thing with a Literal added for a Property. * * This preserves existing values for the given Property. To replace them, see [[setLiteral]]. * * The original `thing` is not modified; this function returns a cloned Thing with updated values. * * @ignore This should not be needed due to the other add*() functions. If you do find yourself needing it, please file a feature request for your use case. * @param thing The [[Thing]] to add a Literal to. * @param property Property for which to add a value. * @param value The Literal to add. * @returns A new Thing equal to the input Thing with the given value added for the given Property. */ export declare function addLiteral<T extends Thing>(thing: T, property: Url | UrlString, value: Literal): T; /** * Creates a new Thing with a Term added for a Property. * * This preserves existing values for the given Property. To replace them, see [[setTerm]]. * * The original `thing` is not modified; this function returns a cloned Thing with updated values. * * @ignore This should not be needed due to the other add*() functions. If you do find yourself needing it, please file a feature request for your use case. * @param thing The [[Thing]] to add a Term to. * @param property Property for which to add a value. * @param value The Term to add. * @returns A new Thing equal to the input Thing with the given value added for the given Property. * @since 0.3.0 */ export declare function addTerm<T extends Thing>(thing: T, property: Url | UrlString, value: Quad_Object): T; /** * @param thing Thing to add a value to. * @param property Property on which to add the given value. * @param value Value to add to `thing` for the given `property`. * @returns A new Thing equal to the input Thing with the given value removed for the given Property. */ export type AddOfType<Type> = <T extends Thing>(thing: T, property: Url | UrlString, value: Type) => T;