@verdocs/js-sdk
Advanced tools
Comparing version 1.0.17 to 1.0.18
@@ -139,2 +139,2 @@ export declare type IDocumentStatus = 'complete' | 'pending' | 'progress'; | ||
*/ | ||
export declare const search: (params: any) => Promise<IDocumentsSearchResult>; | ||
export declare const searchDocuments: (params: any) => Promise<IDocumentsSearchResult>; |
@@ -63,3 +63,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
*/ | ||
export var search = function (params) { return __awaiter(void 0, void 0, void 0, function () { | ||
export var searchDocuments = function (params) { return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
@@ -66,0 +66,0 @@ return [2 /*return*/, getEndpoint() |
export * as Documents from './Documents'; | ||
export * as Stars from './Stars'; | ||
export * as Signatures from './Signatures'; | ||
export * as Templates from './Templates'; | ||
export * as Types from './Types'; |
export * as Documents from './Documents'; | ||
export * as Stars from './Stars'; | ||
export * as Signatures from './Signatures'; | ||
export * as Templates from './Templates'; | ||
export * as Types from './Types'; |
@@ -0,1 +1,7 @@ | ||
/** | ||
* The Transport Endpoint is a global singleton used to call Verdocs APIs. There can only be one Endpoint per application, and | ||
* its configuration settings are shared for all callers. | ||
* | ||
* @module | ||
*/ | ||
import { AxiosInstance } from 'axios'; | ||
@@ -23,4 +29,4 @@ /** | ||
/** | ||
* Set the base URL for API calls. Typically this is https://api.verdocs.com/ and is the default. Change this only after consultation | ||
* with Verdocs Developer Support. | ||
* Set the base URL for API calls. This defaults to https://api.verdocs.com/ and should only be changed after consultation with | ||
* Verdocs Developer Support (e.g. to access a private API endpoint). | ||
* | ||
@@ -30,3 +36,3 @@ * ```typescript | ||
* | ||
* Transport.setBaseUrl('https://api.verdiocs.com'); | ||
* Transport.setBaseUrl('https://my-private-api.verdocs.com'); | ||
* ``` | ||
@@ -45,2 +51,3 @@ */ | ||
export declare const setTimeout: (timeout: number) => void; | ||
export declare const logRequests: (enable: boolean) => void; | ||
/** | ||
@@ -47,0 +54,0 @@ * Helper to get the endpoint for direct access to HTTP functions. |
@@ -0,7 +1,9 @@ | ||
/** | ||
* The Transport Endpoint is a global singleton used to call Verdocs APIs. There can only be one Endpoint per application, and | ||
* its configuration settings are shared for all callers. | ||
* | ||
* @module | ||
*/ | ||
import axios from 'axios'; | ||
import globalThis from './globalThis'; | ||
// @credit https://derickbailey.com/2016/03/09/creating-a-true-singleton-in-node-js-with-es6-symbols/ | ||
// Also see globalThis for comments about why we're doing this in the first place. | ||
var TRACE_ID = Math.floor(Math.random() * 100000); | ||
var ENDPOINT_KEY = Symbol.for('verdocs-api-endpoint'); | ||
var DEFAULTS = { | ||
@@ -12,20 +14,14 @@ baseURL: 'https://api.verdocs.com/', | ||
}; | ||
// @credit https://derickbailey.com/2016/03/09/creating-a-true-singleton-in-node-js-with-es6-symbols/ | ||
// Also see globalThis for comments about why we're doing this in the first place. | ||
var ENDPOINT_KEY = Symbol.for('verdocs-api-endpoint'); | ||
if (!globalThis[ENDPOINT_KEY]) { | ||
// tslint:disable-next-line | ||
console.log('[JS-SDK] Creating endpoint', TRACE_ID, ENDPOINT_KEY); | ||
globalThis[ENDPOINT_KEY] = axios.create(DEFAULTS); | ||
} | ||
else { | ||
// tslint:disable-next-line | ||
console.log('[JS-SDK] Using existing endpoint', TRACE_ID, ENDPOINT_KEY); | ||
} | ||
var endpoint = globalThis[ENDPOINT_KEY]; | ||
// TODO: Remove these once done debugging | ||
// tslint:disable-next-line | ||
console.log('[JS-SDK] Created API Endpoint', TRACE_ID, ENDPOINT_KEY); | ||
endpoint.interceptors.request.use(function (r) { | ||
var requestLogger = function (r) { | ||
// tslint:disable-next-line | ||
console.log("[JS-SDK] " + TRACE_ID + " :: " + r.method.toUpperCase() + " " + r.url, JSON.stringify(r.data), JSON.stringify(r.headers)); | ||
console.log("[JS-SDK] " + r.method.toUpperCase() + " " + r.baseURL + r.url, r.data ? JSON.stringify(r.data) : ''); | ||
return r; | ||
}); | ||
}; | ||
/** | ||
@@ -61,4 +57,4 @@ * Set the auth token that will be used for Verdocs API calls. | ||
/** | ||
* Set the base URL for API calls. Typically this is https://api.verdocs.com/ and is the default. Change this only after consultation | ||
* with Verdocs Developer Support. | ||
* Set the base URL for API calls. This defaults to https://api.verdocs.com/ and should only be changed after consultation with | ||
* Verdocs Developer Support (e.g. to access a private API endpoint). | ||
* | ||
@@ -68,3 +64,3 @@ * ```typescript | ||
* | ||
* Transport.setBaseUrl('https://api.verdiocs.com'); | ||
* Transport.setBaseUrl('https://my-private-api.verdocs.com'); | ||
* ``` | ||
@@ -88,2 +84,20 @@ */ | ||
/** | ||
* Enable or disable request logging. This may expose sensitive data in the console log, so it should only be used for debugging. | ||
* | ||
* ```typescript | ||
* import {Transport} from '@verdocs/js-sdk/HTTP'; | ||
* | ||
* Transport.logRequests(true); | ||
* ``` | ||
*/ | ||
var requestLoggerId = null; | ||
export var logRequests = function (enable) { | ||
if (enable && requestLoggerId === null) { | ||
requestLoggerId = endpoint.interceptors.request.use(requestLogger); | ||
} | ||
else if (!enable && requestLoggerId !== null) { | ||
endpoint.interceptors.request.eject(requestLoggerId); | ||
} | ||
}; | ||
/** | ||
* Helper to get the endpoint for direct access to HTTP functions. | ||
@@ -90,0 +104,0 @@ * |
@@ -0,1 +1,6 @@ | ||
/** | ||
* An invitation represents an opportunity for a Member to join an Organization. | ||
* | ||
* @module | ||
*/ | ||
export declare const getInvitations: (organizationId: string) => Promise<any>; | ||
@@ -2,0 +7,0 @@ export declare const createInvitation: (organizationId: string, params: any) => Promise<any>; |
@@ -0,1 +1,6 @@ | ||
/** | ||
* An invitation represents an opportunity for a Member to join an Organization. | ||
* | ||
* @module | ||
*/ | ||
import { getEndpoint } from '../HTTP/Transport'; | ||
@@ -2,0 +7,0 @@ export var getInvitations = function (organizationId) { |
@@ -0,1 +1,6 @@ | ||
/** | ||
* An Organization Member (aka Profile) is an individual user with access to an organization. | ||
* | ||
* @module | ||
*/ | ||
export declare const getMembers: (organizationId: string) => Promise<any>; | ||
@@ -2,0 +7,0 @@ export declare const deleteMember: (organizationId: string, profileId: string) => Promise<any>; |
@@ -0,1 +1,6 @@ | ||
/** | ||
* An Organization Member (aka Profile) is an individual user with access to an organization. | ||
* | ||
* @module | ||
*/ | ||
import { getEndpoint } from '../HTTP/Transport'; | ||
@@ -2,0 +7,0 @@ export var getMembers = function (organizationId) { |
@@ -0,1 +1,6 @@ | ||
/** | ||
* An Organization is the top level object for ownership for Members, Documents, and Templates. | ||
* | ||
* @module | ||
*/ | ||
import { IOrganization } from './Types'; | ||
@@ -2,0 +7,0 @@ export declare const getOrganizations: () => Promise<IOrganization[]>; |
@@ -0,1 +1,6 @@ | ||
/** | ||
* An Organization is the top level object for ownership for Members, Documents, and Templates. | ||
* | ||
* @module | ||
*/ | ||
import { getEndpoint } from '../HTTP/Transport'; | ||
@@ -2,0 +7,0 @@ export var getOrganizations = function () { |
@@ -1,2 +0,30 @@ | ||
export declare const createWhitelabel: () => Promise<any>; | ||
/** | ||
* White-labeling allows applications to store visual-styling configuration data on the Verdocs servers. This data is not used by | ||
* Verdocs itself, but may be retrieved later by the application to support changing styles in user interfaces. | ||
* | ||
* The advantage to this approach is white-label data is stored at an organization-wide level. If you are building just one | ||
* application, you may not need this feature. But if you are building an application that may have many different "looks" | ||
* depending on who the user is (what organization the user is in) this endpoint can be very helpful. | ||
* | ||
* @module | ||
*/ | ||
/** | ||
* Create or update white-label data. The caller's organization ID will be used as the key for the operation. | ||
* | ||
* ```typescript | ||
* import {Whitelabel} from '@verdocs/js-sdk/Organizations'; | ||
* | ||
* await Whitelabel.setWhitelabel({ logo: '/path/to/logo.png' }); | ||
* ``` | ||
*/ | ||
export declare const setWhitelabel: () => Promise<any>; | ||
/** | ||
* Retrieve white-label data. | ||
* | ||
* ```typescript | ||
* import {Whitelabel} from '@verdocs/js-sdk/Organizations'; | ||
* | ||
* const {logo} = await Whitelabel.getWhitelabel(); | ||
* ``` | ||
*/ | ||
export declare const getWhitelabel: () => Promise<any>; |
@@ -0,3 +1,22 @@ | ||
/** | ||
* White-labeling allows applications to store visual-styling configuration data on the Verdocs servers. This data is not used by | ||
* Verdocs itself, but may be retrieved later by the application to support changing styles in user interfaces. | ||
* | ||
* The advantage to this approach is white-label data is stored at an organization-wide level. If you are building just one | ||
* application, you may not need this feature. But if you are building an application that may have many different "looks" | ||
* depending on who the user is (what organization the user is in) this endpoint can be very helpful. | ||
* | ||
* @module | ||
*/ | ||
import { getEndpoint } from '../HTTP/Transport'; | ||
export var createWhitelabel = function () { | ||
/** | ||
* Create or update white-label data. The caller's organization ID will be used as the key for the operation. | ||
* | ||
* ```typescript | ||
* import {Whitelabel} from '@verdocs/js-sdk/Organizations'; | ||
* | ||
* await Whitelabel.setWhitelabel({ logo: '/path/to/logo.png' }); | ||
* ``` | ||
*/ | ||
export var setWhitelabel = function () { | ||
return getEndpoint() | ||
@@ -7,2 +26,11 @@ .post('/whitelabel') | ||
}; | ||
/** | ||
* Retrieve white-label data. | ||
* | ||
* ```typescript | ||
* import {Whitelabel} from '@verdocs/js-sdk/Organizations'; | ||
* | ||
* const {logo} = await Whitelabel.getWhitelabel(); | ||
* ``` | ||
*/ | ||
export var getWhitelabel = function () { | ||
@@ -9,0 +37,0 @@ return getEndpoint() |
{ | ||
"name": "@verdocs/js-sdk", | ||
"version": "1.0.17", | ||
"version": "1.0.18", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/Verdocs/js-sdk", |
@@ -0,1 +1,8 @@ | ||
/** | ||
* Verdocs provides a range of search functions to help find and retrieve content. This module provides generic functions intended | ||
* to locate items across all content types. More specific retrievals may be performed using the various "list" endpoints within | ||
* each collection (e.g. {@link Documents.Documents.searchDocuments} or {@link Templates.Templates.searchTemplates}). | ||
* | ||
* @module | ||
*/ | ||
import { ISavedSearch, ISearchHistory, ISearchParams, ISearchResult } from './Types'; | ||
@@ -2,0 +9,0 @@ /** |
@@ -0,1 +1,8 @@ | ||
/** | ||
* Verdocs provides a range of search functions to help find and retrieve content. This module provides generic functions intended | ||
* to locate items across all content types. More specific retrievals may be performed using the various "list" endpoints within | ||
* each collection (e.g. {@link Documents.Documents.searchDocuments} or {@link Templates.Templates.searchTemplates}). | ||
* | ||
* @module | ||
*/ | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -2,0 +9,0 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } |
@@ -15,3 +15,3 @@ import { ITemplate, ITemplatesSearchResult, ITemplatesSummary } from './Types'; | ||
*/ | ||
export declare const searchTemplate: (params: any) => Promise<ITemplatesSearchResult>; | ||
export declare const searchTemplates: (params: any) => Promise<ITemplatesSearchResult>; | ||
export declare const getSummary: (page: number) => Promise<ITemplatesSummary>; |
@@ -67,3 +67,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
*/ | ||
export var searchTemplate = function (params) { return __awaiter(void 0, void 0, void 0, function () { | ||
export var searchTemplates = function (params) { return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
@@ -70,0 +70,0 @@ return [2 /*return*/, getEndpoint() |
106611
2629
85