Sunbird Client Services

In order to facilitate Adopters to connect with Sunbird System. Typescript based library to connect with APIs. It can facilitate the adopters with readily available data models.

Criteria
Value

Current Release Branch

release-4.5.0

NPM Published version (Latest)

4.5.1

NPM Package Name

@project-sunbird/client-services

Works

Across All JavaScript Based Projects

Overview

The library is grouped into Modules and SubModules as shown below -

@project-sunbird/client-services
β”œβ”€β”€ /core
β”‚   └── /http-service
β”‚       └── /utilities
β”‚           └── /interceptors
β”œβ”€β”€ /models
β”‚   β”œβ”€β”€ /channel
β”‚   β”œβ”€β”€ /content
β”‚   β”œβ”€β”€ /course
β”‚   β”œβ”€β”€ /device
β”‚   β”œβ”€β”€ /faq
β”‚   β”œβ”€β”€ /form
β”‚   β”œβ”€β”€ /group
β”‚   β”œβ”€β”€ /organisation
β”‚   β”œβ”€β”€ /page
β”‚   └── /user
└── /services
    β”œβ”€β”€ /content
    β”‚   └── /utilities
    β”‚       └── /content-group-generator
    └── /group

The public facing API is prefixed with 'Cs' namespace, as in -

  • CsModule

  • CsConfig

  • CsGroupService

  • ...

For instance,

  • CsModule is part of the root module

  • CsContentsGroupGenerator is a utlility within content service

Their respective imports would be -

Installation

To install the package

The package requires the consumer to have rxjs@6.x.x installed as the only peerDependency

Getting Started

To use the library CsModule, it needs to be initialised with basic configuration. CsModule is a singleton and it would be best to check if it has already been initialised before attempting to initialise -

Adapters

If the client for the library is a cordova project, use the 'HttpClientCordovaAdapter' adapter or use 'HttpClientBrowserAdapter'. 'HttpClientBrowserAdapter' is the default if not specified.

Update Configuration

The configuration can be dynamically reset after initialisation

Accessing a service

The CsModule being a singleton, every service within would also be a singleton, To access any service -

Services

Every service by default will utilise the optional configuration declared during init() or updateConfig()

Additionally, methods of the service may have an optional argument that can override the global configuration explicitly just for that method call

CsGroupService

This service deals with user group management and has the following interface -

CsFrameworkService

CsLocationService

CsLocationService

Last updated

Was this helpful?