Hub

Class

Hub class can be used as an entry point to managing content, teams, sites, projects etc, in an organization's Hub.

import {Hub} from '@esri/hub-common';
// create a Hub instance, authenticating as a specific user
// working against arcgis online
const myHub = await Hub.create({authOptions: {username: "casey", password: "jones"}});

myHub.context.currentUser //=> {username: "casey", ...} as IUser

const pavingProject = await myHub.projects.create({name: "12th Street Paving"});
pavingProject.summary = "This is the 2024 planned paving of 12th Street, between 8th and 11th Ave";
await myHub.projects.update(pavingProject);

This is a convenience class. Hub Managers can be created directly, or the underlying functions can be imported an used as need for scenarios where these class structures introduce unwanted complexity

Accessors

Accessor Type Notes
context IArcGISContext

Get the context

projects HubProjectManager

HubProjectManager for the current Hub

sites HubSiteManager

HubSiteManager for the current Hub

Methods

Method Returns Notes
Promise<Hub>

Factory function to construct a new Hub instance.

create

Static Static Class Method

Factory function to construct a new Hub instance.

Parameters

Parameter Type Default Notes
options Required IHubOptions

Returns

Promise<Hub>

Class defined in common/src/Hub.ts:39