Skip to main content
Version: v1

OdspDriverUrlResolverForShareLink Class

Resolver to resolve urls like the ones created by createOdspUrl which is driver inner url format and the ones which have things like driveId, siteId, itemId etc encoded in nav param. This resolver also handles share links and try to generate one for the use by the app.

export declare class OdspDriverUrlResolverForShareLink implements IUrlResolver

Implements: IUrlResolver

Constructors

Constructor Description
(constructor)(shareLinkFetcherProps, logger, appName, getContext) Creates url resolver instance

Static Methods

Method Alerts Return Type Description
createDocumentUrl(baseUrl, driverInfo) string Crafts a supported document/driver URL
createNavParam(locator) Deprecated string Crafts a supported data store nav param

Methods

Method Return Type Description
appendDataStorePath(requestUrl, pathToAppend) string | undefined Takes an already generated data store url (from requestUrl) and appends a path to the existing data store information.
getAbsoluteUrl(resolvedUrl, dataStorePath, packageInfoSource) Promise<string> Requests a driver + data store storage URL. Note that this method requires share link to be fetched and it will throw in case share link fetcher props were not specified when instance was created.
resolve(request) Promise<IOdspResolvedUrl> Resolves request URL into driver details

Constructor Details

(constructor)

Creates url resolver instance

Signature

constructor(shareLinkFetcherProps?: ShareLinkFetcherProps | undefined, logger?: ITelemetryBaseLogger, appName?: string | undefined, getContext?: ((resolvedUrl: IOdspResolvedUrl, dataStorePath: string) => Promise<string | undefined>) | undefined);

Parameters

Parameter Modifiers Type Description
shareLinkFetcherProps optional ShareLinkFetcherProps | undefined properties used when fetching share link. Can be set as 'undefined' for cases where share link is not needed. Currently, only getAbsoluteUrl() method requires share link.
logger optional ITelemetryBaseLogger logger object that is used as telemetry sink
appName optional string | undefined application name hint that is encoded with url produced by getAbsoluteUrl() method. This hint is used by link handling logic which determines which app to redirect to when user navigates directly to the link.
getContext optional ((resolvedUrl: IOdspResolvedUrl, dataStorePath: string) => Promise<string | undefined>) | undefined callback function which is used to get context for given resolved url. If context is returned then it will be embedded into url returned by getAbsoluteUrl() method.

Method Details

appendDataStorePath

Takes an already generated data store url (from requestUrl) and appends a path to the existing data store information.

Signature

appendDataStorePath(requestUrl: URL, pathToAppend: string): string | undefined;

Parameters

Parameter Type Description
requestUrl URL
pathToAppend string

Returns

Return type: string | undefined

createDocumentUrl

Crafts a supported document/driver URL

Signature

static createDocumentUrl(baseUrl: string, driverInfo: OdspFluidDataStoreLocator): string;

Parameters

Parameter Type Description
baseUrl string
driverInfo OdspFluidDataStoreLocator

Returns

Return type: string

createNavParam

Crafts a supported data store nav param

This API is deprecated and will be removed in a future release.

encodeOdspFluidDataStoreLocator should be used instead

Signature

static createNavParam(locator: OdspFluidDataStoreLocator): string;

Parameters

Parameter Type Description
locator OdspFluidDataStoreLocator

Returns

Return type: string

getAbsoluteUrl

Requests a driver + data store storage URL. Note that this method requires share link to be fetched and it will throw in case share link fetcher props were not specified when instance was created.

Signature

getAbsoluteUrl(resolvedUrl: IResolvedUrl, dataStorePath: string, packageInfoSource?: IContainerPackageInfo): Promise<string>;

Parameters

Parameter Modifiers Type Description
resolvedUrl IResolvedUrl The driver resolved URL
dataStorePath string The relative data store path URL. For requesting a driver URL, this value should always be '/'
packageInfoSource optional IContainerPackageInfo optional, represents container package information to be included in url.

Returns

Return type: Promise<string>

resolve

Resolves request URL into driver details

Signature

resolve(request: IRequest): Promise<IOdspResolvedUrl>;

Parameters

Parameter Type Description
request IRequest

Returns

Return type: Promise<IOdspResolvedUrl>