importRevasfrom'@revas/platform-api'// Simple client instance with token and organizationId configuredconstrevas=newRevas.Client({accessToken: 'JWT_TOKEN_FROM_AUTHENTICATION',organizationId: 'REVAS_ORGANIZATION_ID'})// Revas can be also configured with simple getter functionsconstrevas=newRevas.Client({accessToken: ()=>{return'JWT_TOKEN_FROM_AUTHENTICATION'},organizationId: ()=>{return'REVAS_ORGANIZATION_ID'}})constrequest= ...
constresponse=revas.Contact.GetContact(request)// The options are overrideable for each request but won't change client configconstresponse=revas.Contact.GetContact(request,{organizationId: 'REVAS_ORGANIZATION_ID'})
Public API
// The public calls require the client with the public keyconstrevas=newRevas.Client({publicKey: 'REVAS_PUBLIC_KEY'})revas.Content.GetPublicDirectory(request)revas.Content.ListPublicContents(request)revas.Content.GetPublicContent(request)
Error Management
try{constresponse=revas.Contact.GetContact(request,{organizationId: 'REVAS_ORGANIZATION_ID'})}catch(e: RevasError){// for everything more than 200}