@verdocs/js-sdk
Advanced tools
Comparing version 1.3.1 to 1.3.3
{ | ||
"name": "@verdocs/js-sdk", | ||
"version": "1.3.1", | ||
"version": "1.3.3", | ||
"private": false, | ||
@@ -62,6 +62,6 @@ "homepage": "https://github.com/Verdocs/js-sdk", | ||
"tslint-config-prettier": "^1.18.0", | ||
"typedoc": "^0.23.5", | ||
"typedoc-plugin-markdown": "^3.13.3", | ||
"typedoc": "^0.23.9", | ||
"typedoc-plugin-markdown": "^3.13.4", | ||
"typescript": "^4.7.4" | ||
} | ||
} |
@@ -1,2 +0,1 @@ | ||
export * as Documents from './Documents'; | ||
export * as Fields from './Fields'; | ||
@@ -9,3 +8,4 @@ export * as Pages from './Pages'; | ||
export * as Templates from './Templates'; | ||
export * as TemplateDocuments from './TemplateDocuments'; | ||
export * as Types from './Types'; | ||
export * as Validators from './Validators'; |
@@ -1,2 +0,1 @@ | ||
export * as Documents from './Documents'; | ||
export * as Fields from './Fields'; | ||
@@ -9,3 +8,4 @@ export * as Pages from './Pages'; | ||
export * as Templates from './Templates'; | ||
export * as TemplateDocuments from './TemplateDocuments'; | ||
export * as Types from './Types'; | ||
export * as Validators from './Validators'; |
@@ -1,7 +0,32 @@ | ||
import { ITag, ITags } from './Types'; | ||
export declare const addTemplateTag: (templateId: string, params: any) => Promise<ITag>; | ||
export declare const getTemplateTags: (templateId: string) => Promise<ITag[]>; | ||
/** | ||
* A Tag is a user-specified label applied to a template. Tags help users organize and find Templates. | ||
* recipients. Every Organization has a set of tags "owned" by that Organization and only visible inside it. | ||
* Verdocs also provides a set of system-wide "featured" tags available to all Organizations. | ||
* | ||
* @module | ||
*/ | ||
import { ITemplateTag, ITag } from './Types'; | ||
/** | ||
* Apply a tag to a template. | ||
*/ | ||
export declare const addTemplateTag: (templateId: string, params: ITag) => Promise<ITemplateTag>; | ||
/** | ||
* Get all tags for a template. | ||
*/ | ||
export declare const getTemplateTags: (templateId: string) => Promise<ITemplateTag[]>; | ||
/** | ||
* Remove a tag from a template. | ||
*/ | ||
export declare const deleteTemplateTag: (templateId: string, tagName: string) => Promise<any>; | ||
export declare const createTag: (params: ITags) => Promise<ITags>; | ||
export declare const getTag: (tagName: string) => Promise<ITags>; | ||
export declare const getAllTags: (params: any) => Promise<ITags[]>; | ||
/** | ||
* Create an Organization-wide tag. | ||
*/ | ||
export declare const createTag: (name: string) => Promise<ITag>; | ||
/** | ||
* Get an Organization-wide tag. | ||
*/ | ||
export declare const getTag: (name: string) => Promise<ITag>; | ||
/** | ||
* Get all tags available for use by an Organization. | ||
*/ | ||
export declare const getAllTags: () => Promise<ITag[]>; |
@@ -0,2 +1,12 @@ | ||
/** | ||
* A Tag is a user-specified label applied to a template. Tags help users organize and find Templates. | ||
* recipients. Every Organization has a set of tags "owned" by that Organization and only visible inside it. | ||
* Verdocs also provides a set of system-wide "featured" tags available to all Organizations. | ||
* | ||
* @module | ||
*/ | ||
import { getEndpoint } from '../HTTP/Transport'; | ||
/** | ||
* Apply a tag to a template. | ||
*/ | ||
export var addTemplateTag = function (templateId, params) { | ||
@@ -7,2 +17,5 @@ return getEndpoint() | ||
}; | ||
/** | ||
* Get all tags for a template. | ||
*/ | ||
export var getTemplateTags = function (templateId) { | ||
@@ -13,2 +26,5 @@ return getEndpoint() | ||
}; | ||
/** | ||
* Remove a tag from a template. | ||
*/ | ||
export var deleteTemplateTag = function (templateId, tagName) { | ||
@@ -19,16 +35,25 @@ return getEndpoint() | ||
}; | ||
export var createTag = function (params) { | ||
/** | ||
* Create an Organization-wide tag. | ||
*/ | ||
export var createTag = function (name) { | ||
return getEndpoint() | ||
.api.post('/tags', params) | ||
.api.post('/tags', { tag_name: name }) | ||
.then(function (r) { return r.data; }); | ||
}; | ||
export var getTag = function (tagName) { | ||
/** | ||
* Get an Organization-wide tag. | ||
*/ | ||
export var getTag = function (name) { | ||
return getEndpoint() | ||
.api.get("/tags/".concat(tagName)) | ||
.api.get("/tags/".concat(name)) | ||
.then(function (r) { return r.data; }); | ||
}; | ||
export var getAllTags = function (params) { | ||
/** | ||
* Get all tags available for use by an Organization. | ||
*/ | ||
export var getAllTags = function () { | ||
return getEndpoint() | ||
.api.get('/tags', params) | ||
.api.get('/tags') | ||
.then(function (r) { return r.data; }); | ||
}; |
@@ -0,1 +1,7 @@ | ||
/** | ||
* A Template defines how a Verdocs signing flow will be performed, including attachments, signing fields, and | ||
* recipients. | ||
* | ||
* @module | ||
*/ | ||
import { ITemplate, ITemplatesSearchResult, ITemplatesSummary } from './Types'; | ||
@@ -7,7 +13,46 @@ export interface IGetTemplatesParams { | ||
} | ||
/** | ||
* Get all templates accessible by the caller, with optional filters. | ||
* | ||
* ```typescript | ||
* import {Templates} from '@verdocs/js-sdk/Templates'; | ||
* | ||
* await Templates.getTemplates(); | ||
* await Templates.getTemplates({ is_starred: true }); | ||
* await Templates.getTemplates({ is_creator: true }); | ||
* await Templates.getTemplates({ is_organization: true }); | ||
* ``` | ||
*/ | ||
export declare const getTemplates: (params?: IGetTemplatesParams) => Promise<any[]>; | ||
/** | ||
* Get one template by its ID. | ||
* | ||
* ```typescript | ||
* import {Templates} from '@verdocs/js-sdk/Templates'; | ||
* | ||
* const template = await Templates.getTemplate('83da3d70-7857-4392-b876-c4592a304bc9'); | ||
* ``` | ||
*/ | ||
export declare const getTemplate: (templateId: string) => Promise<any>; | ||
/** | ||
* Create a template. | ||
* | ||
* ```typescript | ||
* import {Templates} from '@verdocs/js-sdk/Templates'; | ||
* | ||
* const newTemplate = await Templates.createTemplate({...}); | ||
* ``` | ||
*/ | ||
export declare const createTemplate: (params: any) => Promise<ITemplate>; | ||
export declare const editTemplate: (templateId: string, params: any) => Promise<ITemplate>; | ||
/** | ||
* Update a template. | ||
* | ||
* ```typescript | ||
* import {Templates} from '@verdocs/js-sdk/Templates'; | ||
* | ||
* const updatedTemplate = await Templates.updateTemplate('83da3d70-7857-4392-b876-c4592a304bc9', { name: 'New Name' }); | ||
* ``` | ||
*/ | ||
export declare const updateTemplate: (templateId: string, params: any) => Promise<ITemplate>; | ||
/** | ||
* Search for templates matching various criteria. | ||
@@ -22,2 +67,11 @@ * | ||
export declare const searchTemplates: (params: any) => Promise<ITemplatesSearchResult>; | ||
/** | ||
* Get a summary of template data, typically used to populate admin panel dashboard pages. | ||
* | ||
* ```typescript | ||
* import {Templates} from '@verdocs/js-sdk/Templates'; | ||
* | ||
* const summary = await Templates.getSummary(0); | ||
* ``` | ||
*/ | ||
export declare const getSummary: (page: number) => Promise<ITemplatesSummary>; |
@@ -0,1 +1,7 @@ | ||
/** | ||
* A Template defines how a Verdocs signing flow will be performed, including attachments, signing fields, and | ||
* recipients. | ||
* | ||
* @module | ||
*/ | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -38,2 +44,14 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
import { getEndpoint } from '../HTTP/Transport'; | ||
/** | ||
* Get all templates accessible by the caller, with optional filters. | ||
* | ||
* ```typescript | ||
* import {Templates} from '@verdocs/js-sdk/Templates'; | ||
* | ||
* await Templates.getTemplates(); | ||
* await Templates.getTemplates({ is_starred: true }); | ||
* await Templates.getTemplates({ is_creator: true }); | ||
* await Templates.getTemplates({ is_organization: true }); | ||
* ``` | ||
*/ | ||
export var getTemplates = function (params) { | ||
@@ -44,2 +62,11 @@ return getEndpoint() | ||
}; | ||
/** | ||
* Get one template by its ID. | ||
* | ||
* ```typescript | ||
* import {Templates} from '@verdocs/js-sdk/Templates'; | ||
* | ||
* const template = await Templates.getTemplate('83da3d70-7857-4392-b876-c4592a304bc9'); | ||
* ``` | ||
*/ | ||
export var getTemplate = function (templateId) { | ||
@@ -50,2 +77,11 @@ return getEndpoint() | ||
}; | ||
/** | ||
* Create a template. | ||
* | ||
* ```typescript | ||
* import {Templates} from '@verdocs/js-sdk/Templates'; | ||
* | ||
* const newTemplate = await Templates.createTemplate({...}); | ||
* ``` | ||
*/ | ||
export var createTemplate = function (params) { | ||
@@ -56,3 +92,12 @@ return getEndpoint() | ||
}; | ||
export var editTemplate = function (templateId, params) { | ||
/** | ||
* Update a template. | ||
* | ||
* ```typescript | ||
* import {Templates} from '@verdocs/js-sdk/Templates'; | ||
* | ||
* const updatedTemplate = await Templates.updateTemplate('83da3d70-7857-4392-b876-c4592a304bc9', { name: 'New Name' }); | ||
* ``` | ||
*/ | ||
export var updateTemplate = function (templateId, params) { | ||
return getEndpoint() | ||
@@ -78,2 +123,11 @@ .api.put("/templates/".concat(templateId), params) | ||
}); }; | ||
/** | ||
* Get a summary of template data, typically used to populate admin panel dashboard pages. | ||
* | ||
* ```typescript | ||
* import {Templates} from '@verdocs/js-sdk/Templates'; | ||
* | ||
* const summary = await Templates.getSummary(0); | ||
* ``` | ||
*/ | ||
export var getSummary = function (page) { return __awaiter(void 0, void 0, void 0, function () { | ||
@@ -80,0 +134,0 @@ return __generator(this, function (_a) { |
import { IOrganization } from '../Organizations/Types'; | ||
export interface ITemplate { | ||
template_document?: ITemplateAsset; | ||
template_document?: ITemplateDocument; | ||
pages?: IPage[]; | ||
@@ -113,9 +113,10 @@ roles?: IRole[]; | ||
} | ||
export interface ITag { | ||
export interface ITemplateTag { | ||
tag_name: string; | ||
template_id: string; | ||
} | ||
export interface ITags { | ||
export interface ITag { | ||
name: string; | ||
featured?: boolean; | ||
organization_id?: string; | ||
created_at?: string; | ||
@@ -140,3 +141,3 @@ } | ||
} | ||
export interface ITemplateAsset { | ||
export interface ITemplateDocument { | ||
url: string; | ||
@@ -185,3 +186,3 @@ name: string; | ||
document_id: string; | ||
template_document?: ITemplateAsset; | ||
template_document?: ITemplateDocument; | ||
sequence: number; | ||
@@ -188,0 +189,0 @@ page_number: number; |
@@ -6,2 +6,11 @@ import { IRole, ITag } from './Types'; | ||
} | ||
/** | ||
* Get all defined validators | ||
* | ||
* ```typescript | ||
* import {Documents} from '@verdocs/js-sdk/Templates'; | ||
* | ||
* await Documents.getDocuments(templateID); | ||
* ``` | ||
*/ | ||
export declare const getValidators: () => Promise<IValidator[]>; | ||
@@ -8,0 +17,0 @@ export declare const getValidator: (validatorName: string) => Promise<IValidator>; |
import { simpleE164Validator } from '../Utils/Locales'; | ||
import { getEndpoint } from '../HTTP/Transport'; | ||
/** | ||
* Get all defined validators | ||
* | ||
* ```typescript | ||
* import {Documents} from '@verdocs/js-sdk/Templates'; | ||
* | ||
* await Documents.getDocuments(templateID); | ||
* ``` | ||
*/ | ||
export var getValidators = function () { | ||
@@ -19,3 +28,3 @@ return getEndpoint() | ||
export var isValidTag = function (value, tags) { | ||
return TagRegEx.test(value) || tags.findIndex(function (tag) { return tag.tag_name === value; }) !== -1; | ||
return TagRegEx.test(value) || tags.findIndex(function (tag) { return tag.name === value; }) !== -1; | ||
}; |
177316
5138