npm package: @ikonintegration/mod-config-client
Description: LMS Module Config API client
Author: Ikon Integration
Latest version: 0.4.12

# module-config-client ![Node.js Package](https://github.com/ikon-integration/module-config-client/workflows/Node.js%20Package/badge.svg)

Config Module Client (LMS exclusive)

### Overall

- ![npm](https://img.shields.io/npm/dy/@ikonintegration/mod-config-client) ![npm](https://img.shields.io/npm/v/@ikonintegration/mod-config-client) ![npm (tag)](https://img.shields.io/npm/v/@ikonintegration/mod-config-client/latest) ![Libraries.io dependency status for latest release, scoped npm package](https://img.shields.io/librariesio/release/npm/@ikonintegration/mod-config-client)
- ![GitHub commit activity](http://sprice.redirectme.net:8555/github/commit-activity/m/ikon-integration/module-config-client)
- ![GitHub last commit](http://sprice.redirectme.net:8555/github/last-commit/ikon-integration/module-config-client)

### How to Use

This client has 2 main functionalities, bridging calls to the API via HTTP protocol and bridging retrieval calls from the cache of the config (redis).
You should decide what mode your instance will be using before initializing it. If both modes are required for your integration, 2 instance of the config client is recommeded.

```
import SMConfig from '@ikonintegration/mod-config-client';

const config = new SMConfig({
  //Cache layer
  username: 'default', endpoint: 'domain.example.com', password: 'ABC@123',
  //API Layer
  endpoint: 'domain.example.com', port: 90, customerID: 'xx', tenantID: 'yy'
});

//Get tenant by cache
const resp = await API.getTenantByID(ID);
if (!resp) { return ERROR; } 
return SUCCESS;

```

### Available API methods

**Course Provider:**
- API.courseProvider.createCourseProvider(providerObj)
- API.courseProvider.updateCourseProvider(providerObj)
- API.courseProvider.deleteCourseProvider(providerID)
- API.courseProvider.getCourseProvider(providerID)
- API.courseProvider.getAllProviders()

**CertEquivalency:**
- API.certEquivalency.createCertEquivalency(certificationID, equivalencyObj, type)
- API.certEquivalency.updateCertEquivalency(certificationID, equivalencyObj, type)
- API.certEquivalency.deleteCertEquivalency(certificationID, equivalencyID, type)
- API.certEquivalency.getCertEquivalency(certificationID, equivalencyID, type)
- API.certEquivalency.getCertEquivalences(certificationID)

**Certification:**
- API.certification.createCertification(certificationObj)
- API.certification.updateCertification(certificationObj)
- API.certification.deleteCertification(certificationID)
- API.certification.getCertification(certificationID)
- API.certification.getAllCertifications(optTenantID)

**CertRequirement:**
- API.certRequirement.createCertRequirement(certificationID, requirementObj, type)
- API.certRequirement.updateCertRequirement(certificationID, requirementObj, type)
- API.certRequirement.deleteCertRequirement(certificationID, requirementID, type)
- API.certRequirement.getCertRequirement(certificationID, requirementID, type)
- API.certRequirement.getAllCertRequirements(certificationID)

**Course:**
- API.course.createCourse(certificationID, courseObj)
- API.course.updateCourse(certificationID, courseObj)
- API.course.deleteCourse(certificationID, courseID)
- API.course.getCourse(certificationID, courseID)
- API.course.getCourses(certificationID)

**Customer:**
- API.customer.createCustomer(customerObj)
- API.customer.updateCustomer(customerObj)
- API.customer.deleteCustomer(customerID)
- API.customer.getCustomer(customerID)
- API.customer.getAllCustomers()

**Equivalency:**
- API.equivalency.createEquivalency(providerObj)
- API.equivalency.updateEquivalency(providerObj)
- API.equivalency.deleteEquivalency(providerID)
- API.equivalency.getEquivalency(providerID)
- API.equivalency.getAllEquivalencies()

**Requirement:**
- API.requirement.createRequirement(providerObj)
- API.requirement.updateRequirement(providerObj)
- API.requirement.deleteRequirement(providerID)
- API.requirement.getRequirement(providerID)
- API.requirement.getAllRequirements()

**Tenant:**
- API.tenant.createTenant(tenantObj)
- API.tenant.updateTenant(tenantObj)
- API.tenant.deleteTenant(tenantID)
- API.tenant.getTenant(tenantID)
- API.tenant.getAllTenants(customerID)

**Training Provider:**
- API.trainingProvider.createTrainingProvider(providerObj)
- API.trainingProvider.updateTrainingProvider(providerObj)
- API.trainingProvider.deleteTrainingProvider(providerID)
- API.trainingProvider.getTrainingProvider(providerID)
- API.trainingProvider.getAllProviders()

### Available Cache methods

**Customer:**
- API.getAllCustomers()
- API.getCustomerByID(customerID)

**Customer Course Provider:**
- API.getCourseProviderByIDs(courseProviderID, customerID)

**Tenant:**
- API.getAllTenants()
- API.getTenantByID(tenantID)

**Certification & Courses:**
- API.getCertificationByID(certID, tenantID)
- API.getCourseByID(courseID, tenantID)
- API.getAllCourses()
- API.getAllCoursesByCustomerID(customerID)
- API.getAllCoursesByTenantID(tenantID)