@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
48 lines (45 loc) • 2.76 kB
TypeScript
import type Accessor from "../core/Accessor.js";
import type PortalItem from "./PortalItem.js";
import type { PortalItemResourceAddOrUpdateOptions, PortalItemResourceWithPath } from "./types.js";
import type { RequestOptions } from "../request/types.js";
export interface PortalItemResourceProperties extends Partial<Pick<PortalItemResource, "path" | "portalItem">> {}
/**
* A reference to a portal item resource.
*
* @since 4.16
* @see [PortalItem.fetchResources()](https://developers.arcgis.com/javascript/latest/references/core/portal/PortalItem/#fetchResources)
* @see [ArcGIS REST API - Item Resource](https://developers.arcgis.com/rest/users-groups-and-items/item-resource.htm)
*/
export default class PortalItemResource extends Accessor {
constructor(properties?: PortalItemResourceProperties);
/**
* Path of the resource relative to `{ITEM}/resources/`. Resource paths may include subfolders, but are always specified
* relative to the item resources endpoint.
*
* @see [ArcGIS REST API - Item Resources](https://developers.arcgis.com/rest/users-groups-and-items/item-resources.htm)
*/
accessor path: string | null | undefined;
/** The [portal item](https://developers.arcgis.com/javascript/latest/references/core/portal/PortalItem/) that owns the resource. */
accessor portalItem: PortalItem;
/** The absolute url to the item resource. This is computed from the [portal item](https://developers.arcgis.com/javascript/latest/references/core/portal/PortalItem/) and the [resource path](https://developers.arcgis.com/javascript/latest/references/core/portal/PortalItemResource/#path). */
get url(): string | null | undefined;
/**
* Requests the PortalItemResource data in the format specified for the `responseType`.
*
* @param responseType - The format of the response.
* @param options - An object wih the following properties.
* @returns When resolved, returns the requested data.
* @see [ArcGIS REST API - Item Data](https://developers.arcgis.com/rest/users-groups-and-items/item-data.htm)
*/
fetch<T = unknown>(responseType?: RequestOptions["responseType"], options?: PortalItemResourceFetchOptions | null | undefined): Promise<T>;
/**
* Updates an existing resource with new content.
*
* @param content - The resource content.
* @param options - An object wih the following properties.
* @returns When resolved, returns the `PortalItemResource`.
* @see [ArcGIS REST API - Update Item](https://developers.arcgis.com/rest/users-groups-and-items/update-item.htm)
*/
update(content: Blob, options?: PortalItemResourceAddOrUpdateOptions): Promise<PortalItemResourceWithPath>;
}
export type PortalItemResourceFetchOptions = Pick<RequestOptions, "cacheBust" | "signal">;