UNPKG

netsuite-oauth-client

Version:

NetSuite OAuth 1.0 client library for Node.js with TypeScript support

69 lines 2.06 kB
export interface NetSuiteCredentials { accountid: string; consumerkey: string; consumersecret: string; tokenkey: string; tokensecret: string; apibaseurl: string; } export interface NetSuiteOAuthRequest { credentials: NetSuiteCredentials; url?: string; method?: string; } export interface OAuthParameters { realm: string; oauth_consumer_key: string; oauth_token: string; oauth_nonce: string; oauth_timestamp: string; oauth_signature_method: string; oauth_version: string; oauth_signature: string; } export interface RequestOptions { url: string; method?: string; headers?: Record<string, string>; body?: any; } export declare class OAuthError extends Error { code?: string | undefined; constructor(message: string, code?: string | undefined); } export declare class ValidationError extends OAuthError { constructor(message: string); } export declare class SignatureError extends OAuthError { constructor(message: string); } /** * Main function to generate NetSuite OAuth header */ declare function generateNetSuiteOAuthHeader(request: NetSuiteOAuthRequest): string; export declare class NetSuiteOAuthClient { private credentials; constructor(credentials: NetSuiteCredentials); /** * Generate OAuth authorization header for a request */ generateAuthHeader(url?: string, method?: string): string; /** * Create request options with OAuth header */ createRequestOptions(options: RequestOptions): RequestOptions & { headers: Record<string, string>; }; /** * Update credentials */ updateCredentials(newCredentials: Partial<NetSuiteCredentials>): void; /** * Get current credentials (without secrets) */ getCredentialsSummary(): Partial<NetSuiteCredentials>; } export declare function createNetSuiteOAuthClient(credentials: NetSuiteCredentials): NetSuiteOAuthClient; export { generateNetSuiteOAuthHeader }; export default NetSuiteOAuthClient; //# sourceMappingURL=client.d.ts.map