Socket
Socket
Sign inDemoInstall

@telia-ace/knowledge-serviceclient

Package Overview
Dependencies
9
Maintainers
9
Versions
99
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @telia-ace/knowledge-serviceclient

Service client for communication with classical ACE Knowledge projections.


Version published
Weekly downloads
313
decreased by-52.79%
Maintainers
9
Created
Weekly downloads
 

Readme

Source

@telia-ace/knowledge-serviceclient

The Service Client provides an API for interacting with classic Humany projections. A projection is a URL representing a subset of content (guides, categories, contact methods etc) in a Humany application.

Projection URL Format

The standard format of a Projection URL consists of the root application url followed by the projection name.

https://[application].humany.net/[projection-name]

Create an instance of Service Client

Create an instance by passing the Projection URL as the first constructor argument.

import { ServiceClient } from '@telia-ace/knowledge-serviceclient';

const projection = '[projection-url]';
const serviceClient = new ServiceClient(projection);

Passing additional options

The second constructor argument can be used to pass additional ServiceClientOptions.

ServiceClientOptions
ArgumentDescriptionType
funnelFunnel to report statistics on.string
clientUnique ID for the clientstring
siteSite (URI) to report statistics on.string
pagingDefault paging optionsobject

Comments

  • Funnel, Client and Site can be overriden by using the options parameter on specific API calls.

Match

Match guides based on a search phrase.

match(phrase, success, [error])

ArgumentDescriptionType
phraseThe phrase to match.string
successCallback returning the result.function
errorCallback returning a description of the error.function

match(phrase, options, success, [error])

ArgumentDescriptionType
phraseThe phrase to match.string
optionsAdditional matching optionsMatchingOptions
successCallback returning the result.function
errorCallback returning a description of the error.function
MatchingOptions
ArgumentDescriptionType
statisticsDisabledWhether statistics should be reported for the request.boolean (default: false)
categoryId Limit the matching to the specified categorynumber

Example

serviceClient.match('hello world', (matchResult) => {
  console.log('matched guides:', matchResult.Matches);
});

Get categories

getCategories(success, [error])

ArgumentDescriptionType
successCallback returning the result.function
errorCallback returning a description of the error.function

getCategories(options, success, [error])

ArgumentDescriptionType
optionsAdditional matching optionsCategoriesOptions
successCallback returning the result.function
errorCallback returning a description of the error.function
CategoriesOptions
ArgumentDescriptionType
phrase Get categories containging guides matching a phrasestring
categoryId Limit the matching to the specified categorynumber
expandPossible values: 'none', 'children', 'descendants'string

Example

serviceClient.getCategories((categoryResult) => {
  console.log('all categories:', categoryResult.Children);
});

Get guide

getGuide(id, success, [error])

ArgumentDescriptionType
idGuide ID.number
successCallback returning the result.function
errorCallback returning a description of the error.function

getGuide(id, options, success, [error])

ArgumentDescriptionType
idGuide ID.number
optionsAdditional guide options.GuideOptions
successCallback returning the result.function
errorCallback returning a description of the error.function

getGuide(id, connectionKey, success, [error])

ArgumentDescriptionType
idGuide ID.number
connectionKeyA connection key (part of dialog) to get.string
successCallback returning the result.function
errorCallback returning a description of the error.function

getGuide(id, connectionKey, options, success, [error])

ArgumentDescriptionType
idGuide ID.number
connectionKeyA connection key (part of dialog) to get.string
optionsAdditional guide options.GuideOptions
successCallback returning the result.function
errorCallback returning a description of the error.function
GuideOptions
ArgumentDescriptionType
statisticsDisabledWhether statistics should be reported for the request.boolean (default: false)

Comments

  • If the Guide is not intended to be displayed as a result of a previous match statistics should be disabled.

Give feedback on guide

giveFeedback(id, connectionKey, feedbackType, [success, error])

ArgumentDescriptionType
idGuide ID.number
connectionKeyA connection key (part of dialog) to give feedback on.string
feedbackTypeType of feedback to give (Positive or Negative).string

Accessing the Service Client from a plugin

For implementations running version 4 you can author a plugin and access the current Service Client through the container under the key 'matchingClient'. The value must be resolved asynchronously as in the example below.

import { Plugin } from '@telia-ace/knowledge-widget-core';

class MyPlugin extends Plugin {
  initialize() {
    this.container.getAsync('matchingClient').then((matchingClient) => {
      // use 'matchingClient' here
    });  
  }
}

Keywords

FAQs

Last updated on 25 Sep 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc