@verdocs/js-sdk
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -1,5 +0,51 @@ | ||
export declare const getApiKeys: (organizationId: string) => Promise<any>; | ||
export declare const createApiKey: (organizationId: string, params: any) => Promise<any>; | ||
export declare const rotateApiKey: (organizationId: string, clientId: string) => Promise<any>; | ||
export declare const updateApiKey: (organizationId: string, clientId: string, params: any) => Promise<any>; | ||
export declare const deleteApiKey: (organizationId: string, clientId: string, params: any) => Promise<any>; | ||
import { IApiKey, IApiKeyWithSecret, ICreateApiKeyRequest, IUpdateApiKeyRequest } from './Types'; | ||
/** | ||
* Get a list of keys for a given organization. The caller must have admin access to the organization. | ||
* | ||
* ```typescript | ||
* import {ApiKeys} from '@verdocs/js-sdk/Organizations'; | ||
* | ||
* const keys = await ApiKeys.getKeys(ORGID); | ||
* ``` | ||
*/ | ||
export declare const getKeys: (organizationId: string) => Promise<IApiKey[]>; | ||
/** | ||
* Create an API key. | ||
* | ||
* ```typescript | ||
* import {ApiKeys} from '@verdocs/js-sdk/Organizations'; | ||
* | ||
* await ApiKeys.createKey(ORGID, {name: NEWNAME}); | ||
* ``` | ||
*/ | ||
export declare const createKey: (organizationId: string, params: ICreateApiKeyRequest) => Promise<IApiKeyWithSecret>; | ||
/** | ||
* Rotate the secret for an API key. The caller must have admin access to the organization. | ||
* | ||
* ```typescript | ||
* import {ApiKeys} from '@verdocs/js-sdk/Organizations'; | ||
* | ||
* const {client_secret: newSecret} = await ApiKeys.rotateKey(ORGID, CLIENTID); | ||
* ``` | ||
*/ | ||
export declare const rotateKey: (organizationId: string, clientId: string) => Promise<IApiKeyWithSecret>; | ||
/** | ||
* Update an API key to change its assigned Profile ID or Name. | ||
* | ||
* ```typescript | ||
* import {ApiKeys} from '@verdocs/js-sdk/Organizations'; | ||
* | ||
* await ApiKeys.updateKey(ORGID, CLIENTID, {name: NEWNAME}); | ||
* ``` | ||
*/ | ||
export declare const updateKey: (organizationId: string, clientId: string, params: IUpdateApiKeyRequest) => Promise<IApiKey>; | ||
/** | ||
* Delete an API key. | ||
* | ||
* ```typescript | ||
* import {ApiKeys} from '@verdocs/js-sdk/Organizations'; | ||
* | ||
* await ApiKeys.deleteKey(ORGID, CLIENTID); | ||
* ``` | ||
*/ | ||
export declare const deleteKey: (organizationId: string, clientId: string) => Promise<any>; |
import { Endpoint } from '../HTTP/Transport'; | ||
export var getApiKeys = function (organizationId) { | ||
/** | ||
* Get a list of keys for a given organization. The caller must have admin access to the organization. | ||
* | ||
* ```typescript | ||
* import {ApiKeys} from '@verdocs/js-sdk/Organizations'; | ||
* | ||
* const keys = await ApiKeys.getKeys(ORGID); | ||
* ``` | ||
*/ | ||
export var getKeys = function (organizationId) { | ||
return Endpoint.get("/organizations/" + organizationId + "/api_key").then(function (r) { return r.data; }); | ||
}; | ||
export var createApiKey = function (organizationId, params) { | ||
/** | ||
* Create an API key. | ||
* | ||
* ```typescript | ||
* import {ApiKeys} from '@verdocs/js-sdk/Organizations'; | ||
* | ||
* await ApiKeys.createKey(ORGID, {name: NEWNAME}); | ||
* ``` | ||
*/ | ||
export var createKey = function (organizationId, params) { | ||
return Endpoint.post("/organizations/" + organizationId + "/api_key", params).then(function (r) { return r.data; }); | ||
}; | ||
export var rotateApiKey = function (organizationId, clientId) { | ||
/** | ||
* Rotate the secret for an API key. The caller must have admin access to the organization. | ||
* | ||
* ```typescript | ||
* import {ApiKeys} from '@verdocs/js-sdk/Organizations'; | ||
* | ||
* const {client_secret: newSecret} = await ApiKeys.rotateKey(ORGID, CLIENTID); | ||
* ``` | ||
*/ | ||
export var rotateKey = function (organizationId, clientId) { | ||
return Endpoint.put("/organizations/" + organizationId + "/api_key/" + clientId + "/rotate").then(function (r) { return r.data; }); | ||
}; | ||
export var updateApiKey = function (organizationId, clientId, params) { | ||
/** | ||
* Update an API key to change its assigned Profile ID or Name. | ||
* | ||
* ```typescript | ||
* import {ApiKeys} from '@verdocs/js-sdk/Organizations'; | ||
* | ||
* await ApiKeys.updateKey(ORGID, CLIENTID, {name: NEWNAME}); | ||
* ``` | ||
*/ | ||
export var updateKey = function (organizationId, clientId, params) { | ||
return Endpoint.patch("/organizations/" + organizationId + "/api_key/" + clientId, params).then(function (r) { return r.data; }); | ||
}; | ||
export var deleteApiKey = function (organizationId, clientId, params) { | ||
return Endpoint.delete("/organizations/" + organizationId + "/api_key/" + clientId, params).then(function (r) { return r.data; }); | ||
/** | ||
* Delete an API key. | ||
* | ||
* ```typescript | ||
* import {ApiKeys} from '@verdocs/js-sdk/Organizations'; | ||
* | ||
* await ApiKeys.deleteKey(ORGID, CLIENTID); | ||
* ``` | ||
*/ | ||
export var deleteKey = function (organizationId, clientId) { | ||
return Endpoint.delete("/organizations/" + organizationId + "/api_key/" + clientId).then(function (r) { return r.data; }); | ||
}; |
@@ -17,1 +17,22 @@ export interface IOrganization { | ||
} | ||
export interface ICreateApiKeyRequest { | ||
name: string; | ||
profile_id: string; | ||
} | ||
export interface IUpdateApiKeyRequest { | ||
name?: string; | ||
profile_id?: string; | ||
} | ||
export interface IApiKey { | ||
client_id: string; | ||
name: string; | ||
profile_id: string; | ||
organization_id: string; | ||
} | ||
export interface IApiKeyWithSecret extends IApiKey { | ||
client_id: string; | ||
client_secret: string; | ||
name: string; | ||
profile_id: string; | ||
organization_id: string; | ||
} |
{ | ||
"name": "@verdocs/js-sdk", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "Verdocs JS SDK", |
83165
1878