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​

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

Static Methods​

MethodAlertsReturn TypeDescription
createDocumentUrl(baseUrl, driverInfo)stringCrafts a supported document/driver URL
createNavParam(locator)DeprecatedstringCrafts a supported data store nav param

Methods​

MethodReturn TypeDescription
appendDataStorePath(requestUrl, pathToAppend)string | undefinedTakes 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​

ParameterModifiersTypeDescription
shareLinkFetcherPropsoptionalShareLinkFetcherProps | undefinedproperties 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.
loggeroptionalITelemetryBaseLoggerlogger object that is used as telemetry sink
appNameoptionalstring | undefinedapplication 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.
getContextoptional((resolvedUrl: IOdspResolvedUrl, dataStorePath: string) => Promise<string | undefined>) | undefinedcallback 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​

ParameterTypeDescription
requestUrlURL
pathToAppendstring

Returns​

Return type: string | undefined

createDocumentUrl​

Crafts a supported document/driver URL

Signature​

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

Parameters​

ParameterTypeDescription
baseUrlstring
driverInfoOdspFluidDataStoreLocator

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​

ParameterTypeDescription
locatorOdspFluidDataStoreLocator

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​

ParameterModifiersTypeDescription
resolvedUrlIResolvedUrlThe driver resolved URL
dataStorePathstringThe relative data store path URL. For requesting a driver URL, this value should always be '/'
packageInfoSourceoptionalIContainerPackageInfooptional, 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​

ParameterTypeDescription
requestIRequest

Returns​

Return type: Promise<IOdspResolvedUrl>