npm package: @ikonintegration/mod-organization-client
Description: Organization module API client
Author: Ikon Integration
Latest version: 3.0.8

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

Organization module nodejs API client

### Overall

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

### How to Use

```
import OrgAPI from '@ikonintegration/mod-organization-client';

const API = new OrgAPI({
  port: 9090, //isOptional
  endpoint: SharedModules_OrganizationEndpoint,
  //Must be specified when using service routes
  apiKey: config.examProvider.key, //API token on IDM.AppID format (generate from APIKey at https://runkit.com/gwdp/idm-appid-v1)
  //Must be specified when using admin or user routes
  authorizationToken: '', -- optional, IDM JWT for shared module admins and user routes -- Accepts a function to be called async and return the token
  //One or another should be specified depending on the API calls scope you want to
  tenantID: '',
  customerID: ''
});

//Create organization
const resp = await API.organization.createOrganization('myName');
if (!resp || resp.statusCode != 200) {
  return ERROR:
} return SUCCESS;

```

### Headers
The following header must be specified in every request!
- Authorization

### Available API methods

**Contact:**
- API.contact.createContact(contactObj)
- API.contact.deleteContact(contactID)
- API.contact.getAllContacts()
- API.contact.getContact(contactID)
- API.contact.searchContactsAutocomplete(values)
- API.contact.searchContactsByTerm(searchTerm, filters)
- API.contact.searchContactsByIDs(filters)
- API.contact.exportContactsSearch(searchTerm, filters)
- API.contact.updateContact(contactObj, contactID)

**Organization:**
- API.organization.createOrganization(orgObj)
- API.organization.updateOrganization(orgObj, orgID)
- API.organization.deleteOrganization(orgID, isSoft)
- API.organization.getOrganization(orgID)
- API.organization.getSearchOrganizationCitiesValues()
- API.organization.searchOrganizationsAutocomplete(value)
- API.organization.searchOrganizationsByTerm(searchTerm, filters)
- API.organization.searchOrganizationsByIDs(filters)
- API.organization.exportOrganizationsSearch(searchTerm, filters)
- API.organization.getOrganizationContacts(orgID)
- API.organization.getOrganizationLocations(orgID)
- API.organization.exportOrganizationContacts(orgID)
- API.organization.getOrganizationByHashedWSID(hashedWorksafeID, forcePlain)

**Organization App:**
- API.organizationApp.createOrganizationApp(optionalMetadata, isAffiliate, orgID, hashedWorksafeID)
- API.organizationApp.deleteOrganizationApp(orgID, isSoft)
- API.organizationApp.getOrganizationApp(orgID)
- API.organizationApp.getOrganizationAppByAffiliateID(affiliateID)
- API.organizationApp.getOrganizationAppsByIDs(IDs)
- API.organizationApp.getOrganizationAppsByMember(userID)
- API.organizationApp.getOrganizationAppsByOrgID(orgID)
- API.organizationApp.searchAllOrganizationsApps(filters)
- API.organizationApp.searchOrganizationAppsAutocomplete(value)
- API.organizationApp.searchOrganizationsAppsByTerm(searchTerm, filters)
- API.organizationApp.updateOrganizationApp(orgID, content)
- API.organizationApp.describeOrganizationAppsByOrgID(orgID)
- API.organizationApp.exportOrganizationManagersByOrgID(orgID)

**Organization App CU:**
- API.organizationCU.createOrganizationCU(orgID, cuID)
- API.organizationCU.getOrganizationCU(orgID, cuID)
- API.organizationCU.getOrganizationCUs(orgID)
- API.organizationCU.removeOrganizationCU(orgID, cuID)
- API.organizationCU.updateOrganizationCU(orgID, cuID)

**Organization App Contact:**
- API.organizationAppContact.createOrganizationAppContact(orgID, contactID)
- API.organizationAppContact.getOrganizationAppContact(orgID, contactID)
- API.organizationAppContact.removeOrganizationAppContact(orgID, contactID)
- API.organizationAppContact.getAllOrganizationAppContacts(orgID)
- API.organizationAppContact.getAllOrganizationContacts(orgID)
- API.organizationAppContact.getAllContactOrganizationApps(orgID)

**Organization App CU:**
- API.organizationAppCU.createOrganizationAppCU(orgID, cuID)
- API.organizationAppCU.getOrganizationAppCU(orgID, cuID)
- API.organizationAppCU.getOrganizationAppCUs(orgID)
- API.organizationAppCU.removeOrganizationAppCU(orgID, cuID)
- API.organizationAppCU.updateOrganizationAppCU(orgID, cuID)

**Organization App Invitation:**
- API.organizationAppInvitation.approveOrganizationAppInvitation(orgID, invitationID)
- API.organizationAppInvitation.createOrganizationAppBulkInvitation(orgID, invitationObj)
- API.organizationAppInvitation.createOrganizationAppInvitation(orgID, invitationObj)
- API.organizationAppInvitation.deleteOrganizationAppInvitation(orgID, invitationID)
- API.organizationAppInvitation.getMyOrganizationAppInvitation(invitationID)
- API.organizationAppInvitation.getOrganizationAppInvitationByOrgID(orgID)
- API.organizationAppInvitation.rejectOrganizationAppInvitation(orgID, invitationID)
- API.organizationAppInvitation.resendOrganizationAppInvitation(orgID, invitationObj, invitationObj)

**Organization App Invitation History:**
- API.organizationAppInvitationHistory.getOrgAppInvitationHistory(orgID, reverseOrder)
- API.organizationAppInvitationHistory.getOrgAppInvitationHistoryByStatus(orgID, status)

**Organization App Location:**
- API.organizationAppLocation.createOrganizationAppLocation(orgID, locationID, locationObj)
- API.organizationAppLocation.getOrganizationAppLocation(orgID, locationID)
- API.organizationAppLocation.getOrganizationAppLocations(orgID)
- API.organizationAppLocation.removeOrganizationAppLocation(orgID, locationID)
- API.organizationAppLocation.updateOrganizationAppLocation(orgID, locationID, locationObj)

**Organization App Member:**
- API.organizationAppMember.getOrganizationAppMember(orgID, memberID)
- API.organizationAppMember.getOrganizationAppMembers(orgID)
- API.organizationAppMember.removeOrganizationAppMember(orgID, memberID)
- API.organizationAppMember.searchOrganizationsAppMembersByTerm(searchTerm, filters)
- API.organizationAppMember.updateOrganizationAppMember(orgID, memberID, updateObj)

**Employee:**
- API.employee.upsertEmployee(orgID, employeeID, employeeObj)
- API.employee.deleteEmployee(employeeID)
- API.employee.getEmployee(orgID, employeeID)
- API.employee.getEmployeeByEmployeeID(employeeID)
- API.employee.getEmployeesByOrgID(orgID)
- API.employee.searchOrganizationsEmployeesByTerm(searchTerm, filters)
- API.employee.searchEmployeesAutocomplete(value, orgID)
- API.employee.describeEmployeeMembershipsByEmployeeID
- API.employee.validateWorksafeID(orgID, worksafeID)
- API.employee.exportEmployeesSearch(searchTerm, filters)

**Organization Import Job:**
- API.organizationsImportJob.createJob(jobObj)
- API.organizationsImportJob.deleteJob(jobID)
- API.organizationsImportJob.getJob(jobID)
- API.organizationsImportJob.getJobs()
- API.organizationsImportJob.startValidation(jobID)
- API.organizationsImportJob.startImport(jobID)
- API.organizationsImportJob.getLogs(jobID, logLevel, isJSON)

**Organization Import Job File:**
- API.organizationsImportJobFile.uploadAndCreateJob(file, description, jobType)
- API.organizationsImportJobFile.download(fileID)