npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

halo-sdk

v1.1.0

Published

Halo SDK for Backend

Downloads

3

Readme

Halo SDK Backend

Supports Node.js v4.0.0 and higher.

Halo SDK backend is an npm package, that makes it easy to require and use HALO backend services in your project.

Getting started

Step 1

Require the HALO backend SDK.

npm install halo-sdk

haloSDK = require('halo-sdk')

| Dependencies | Type | Required | | ------------------| ----------- | ---------| | request | npm package | Yes |

Step 2

If environment variables are not set, it is mandatory to provide HALO configuration with client_id and client_secret in order to get the SDK running. Set the url to desired environment (for example https://halo.mobgen.com/api).

Environment variables:

HaloClientId
HaloClientSecret
HaloUrl

Configuration:

config = {
	client_id : 'string',
    client_secret : 'string',
    url : 'string'
}

Step 3

Init the HALO SDK backend inside your application once.

haloSDK.init( config )

If environmental variables are set, it is not needed to provide the config.

haloSDK.init()

| Attribute | Type | Required | | --------------| ------ | ---------| | config | Object | No |

This will start the HALO SDK backend services and the configuration will be persist in memory. It automatically saves the client credentials to your project and if the credentials expires it will request new credentials.

Step 4

Start using the HALO SDK backend services.

  • init
  • generalContent
    • getModuleByName
    • getModuleById
    • getModuleInstancesByModuleId
    • getModuleInstancesByModuleName
    • getModuleList
    • getModuleInstancesList
    • getModuleInstancesListSearch

Other services:

  • getHaloUrl
  • getHaloUrl
  • getHaloVersion

Components


Available versions: 'v1'

General content

haloSDK.service( version ).resource( options ).attribute( value ).attribute( value ).exec( function(data, error){} )

This is the basic structure of the query, specify what service to use, and then what resource and lastly the optional attributes.

getModuleByName

This returns a general content module by providing the name of the module.

haloSDK.generalContent( version ).getModuleByName( name ).exec(function(data, error){})

| Method | | --------| | GET |

| Attribute | Type | Required | Details | | --------------| ------ | ---------|----------------------------------------| | version | String | No | Uses latest if not set | | name | String | Yes | Name of module |

Example:

haloSDK.generalContent( 'v1' ).getModuleByName( 'FAQs' ).exec( function(){} )

Returns the general content module FAQs. Access the result by handle a callback, and put the arguments on it: function(data, err).

Example of Response (Status 200):

{ externalId: 150,
  name: 'FAQs',
  isSingle: false,
  customerId: 32,
  deletedAt: null,
  createdBy: 'Test Admin',
  tags: [],
  pushTemplates: [],
  updatedBy: 'Test Manager',
  deletedBy: null,
  createdAt: 1468224230843,
  updatedAt: 1468224628517,
  defaultLanguage: null,
  id: '578352e65a42e930005ecaf3' }

getModuleById

This returns a general content module by providing the id of the module.

haloSDK.generalContent( version ).getModuleById( id ).exec(function(data, error){})

| Method | | --------| | GET |

| Attribute | Type | Required | Details | | --------------| ------ | ---------|----------------------------------------| | version | String | No | Uses latest if not set | | id | String | Yes | Id of module |

Example:

haloSDK.generalContent( 'v1' ).getModuleById( '578352e65a42e930005ecaf3' ).exec( function(){} )

Returns the general content module FAQs. Access the result by handle a callback, and put the arguments on it: function(data, err).

Example of Response (Status 200):

{ externalId: 150,
  name: 'FAQs',
  isSingle: false,
  customerId: 32,
  deletedAt: null,
  createdBy: 'Test Admin',
  tags: [],
  pushTemplates: [],
  updatedBy: 'Test Manager',
  deletedBy: null,
  createdAt: 1468224230843,
  updatedAt: 1468224628517,
  defaultLanguage: null,
  id: '578352e65a42e930005ecaf3' }

getModuleInstancesByModuleId

This returns a list of general content module instances by providing the id of the module.

haloSDK.generalContent( version ).getModuleInstancesByModuleId( id ).exec(function(data, error){})

| Method | | --------| | GET |

| Attribute | Type | Required | Details | | --------------| ------ | ---------|------------------------------------| | version | String | No | Uses latest if not set | | id | String | Yes | Id of module |

Example:

haloSDK.generalContent( 'v1' ).getModuleInstancesByModuleId( '578352e65a42e930005ecaf3' ).exec( function(){} )

Returns the general content instances of module FAQs. Access the result by handle a callback, and put the arguments on it: function(data, err).

getModuleInstancesByModuleName

This returns a list of general content module instances by providing the name of the module.

haloSDK.generalContent( version ).getModuleInstancesByModuleName( name ).exec(function(data, error){})

| Method | | ----------| | GET |

| Attribute | Type | Required | Details | | --------------| ------ | ---------|------------------------------------| | version | String | No | Uses latest if not set | | id | String | Yes | Name of module |

Example:

haloSDK.generalContent( 'v1' ).getModuleInstancesByModuleName( 'Translations' ).exec( function(){} )

Returns the general content instances of module Translations. Access the result by handle a callback, and put the arguments on it: function(data, err).

getModuleList

Returns the list of all general content modules.

haloSDK.generalContent( version ).getModuleList().exec(function(data, error){})

| Method | | --------| | GET |

| Attribute | Type | Required | Details | | --------------| ------ | ---------|----------------------------------------| | version | String | No | Uses latest if not set |

Example:

haloSDK.generalContent( 'v1' ).getModuleList().exec( function(){} )

Returns a list of general content modules. Access the result by handle a callback, and put the arguments on it: function(data, err).

Response class for all of the above queries (Status 200):

[
  {
    'id': 'string',
    'name': 'string',
    'isSingle': true,
    'customerId': 0,
    'tags': [
      {
        'id': 'string',
        'name': 'string',
        'value': 'string'
      }
    ],
    'pushTemplates': [
      'string'
    ],
    'defaultLanguage': 'string',
    'createdAt': 0,
    'createdBy': 'string',
    'updatedAt': 0,
    'updatedBy': 'string',
    'deletedAt': 0,
    'deletedBy': 'string',
    'fields': [
      {
        'id': 0,
        'name': 'string',
        'title': 'string',
        'format': {
          'values': [
            'string'
          ],
          'default': 'string'
        },
        'description': 'string',
        'fieldType': {
          'id': 'string',
          'name': 'string',
          'rules': [
            {
              'rule': 'string',
              'params': [
                'string'
              ],
              'error': 'string'
            }
          ],
          'createdAt': 0,
          'updatedAt': 0
        },
        'module': 'string',
        'order': 0,
        'createdAt': 0,
        'updatedAt': 0
      }
    ]
  }
]

getModuleList with optional queryFields

This returns a list of general content modules, where it is possible to specify the amount of pages retrieved as well as the number of modules per page.

haloSDK.generalContent( version ).getModuleList().page( pageNumber ).limit( setAmount ).exec(function(data, error){})

| Method | | --------| | GET |

| Attribute | Type | Required | Details | | -------------| ---------| ---------|----------------------------------------| | version | String | No | Uses latest if not set | | pageNumber | Number | Yes | Returns all pages if not set | | setAmount | Number | Yes | Returns 10 modules per page if not set |

Example:

haloSDK.generalContent( 'v1' ).getModuleList().page( 1 ).limit( 2 ).exec( function(){} )

Returns a list of two general content modules on one page. Access the result by handle a callback, and put the arguments on it: function(data, err).

getModuleInstancesList

Will be deprecated in the next version (replaced by getModuleInstancesListSearch)

Returns the list of instances. By default the number of instances returned is 10 as an object with the pagination data and the items array.

haloSDK.generalContent( version ).getModuleInstancesList().exec(function(data, error){})

| Method | | ----------| | GET |

| Attribute | Type | Required | Details | | ------------| --------| ---------|------------------------------------| | version | String | No | Uses latest if not set |

Example:

haloSDK.generalContent( 'v1' ).getModuleInstancesList().exec( function(){} )

Returns a list of instances. Access the result by handle a callback, and put the arguments on it: function(data, err).

Response class for all of the above queries (Status 200):

[
  {
    "id": "string",
    "name": "string",
    "customerId": 0,
    "values": {},
    "module": "string",
    "pushSchedule": "string",
    "tags": [
      {
        "id": "string",
        "name": "string",
        "value": "string"
      }
    ],
    "createdAt": 0,
    "updatedAt": 0,
    "publishedAt": 0,
    "archivedAt": 0,
    "removedAt": 0,
    "deletedAt": 0,
    "createdBy": "string",
    "updatedBy": "string",
    "publishedBy": "string",
    "archivedBy": "string",
    "removedBy": "string",
    "deletedBy": "string"
  }
]

getModuleInstancesList with page and limit amount

Will be deprecated in the next version (replaced by getModuleInstancesListSearch)

This returns a list of instances, where it is possible to specify the amount of pages retrieved as well as the number of instances per page.

haloSDK.generalContent( version ).getModuleInstancesList().page( pageNumber ).limit( setAmount ).exec(function(data, error){})

| Method | | --------| | GET |

| Attribute | Type | Required | Details | | ------------- | ---------| ---------|-------------------------------------------| | version | String | No | Uses latest if not set | | pageNumber | Number | Yes | Returns all pages if not set | | setAmount | Number | Yes | Returns 10 instances per page if not set |

If provided, it is required to include at least one of the two options, createdBy or moduleId.

Example:

haloSDK.generalContent( 'v1' ).getModuleInstancesList().page( 1 ).limit( 2 ).exec( function(){} )

Returns a list of two general content module instances on one page. Access the result by handle a callback, and put the arguments on it: function(data, err).

getModuleInstancesListSearch

Returns the list of instances. By default the number of instances returned is 10 as an object with the pagination data and the items array.

haloSDK.generalContent( version ).getModuleInstancesListSearch().exec(function(data, error){})

| Method | | ----------| | POST |

| Attribute | Type | Required | Details | | ------------| ---------| ---------|-------------------------------| | version | String | No | Uses latest if not set |

Example:

haloSDK.generalContent( 'v1' ).getModuleInstancesListSearch().exec( function(){} )

Returns a list of instances. Access the result by handle a callback, and put the arguments on it: function(data, err).

Response class for all of the above queries (Status 200):

[
  {
    "id": "string",
    "name": "string",
    "customerId": 0,
    "values": {},
    "module": "string",
    "pushSchedule": "string",
    "tags": [
      {
        "id": "string",
        "name": "string",
        "value": "string"
      }
    ],
    "createdAt": 0,
    "updatedAt": 0,
    "publishedAt": 0,
    "archivedAt": 0,
    "removedAt": 0,
    "deletedAt": 0,
    "createdBy": "string",
    "updatedBy": "string",
    "publishedBy": "string",
    "archivedBy": "string",
    "removedBy": "string",
    "deletedBy": "string"
  }
]

getModuleInstancesListSearch with optional queryFields

This returns a list of instances, where it is possible to specify the amount of pages retrieved as well as the number of instances per page. There is also the option to provide additional queryFields, to make the list even more specific.

haloSDK.generalContent( version ).getModuleInstancesListSearch( queryFields ).page( pageNumber ).limit( setAmount ).exec(function(data, error){})

| Method | | --------| | POST |

| Attribute | Type | Required | Details | | ------------| ---------| ----------|-------------------------------------------| | version | String | No | Uses latest if not set | | pageNumber | Number | Yes | Returns all pages if not set | | setAmount | Number | Yes | Returns 10 instances per page if not set | | queryFields | Object | No | Returns all instances if not set | | createdBy | String | Yes | The related username create instance | | name | String | Yes | The related module name | | createdAt | String | Yes | Date |

queryFields = { name : 'string', createdBy : 'string', createdAt : 'string' }

If provided, it is required to include at least one of the two options, createdBy or moduleId.

Example:

haloSDK.generalContent( 'v1' ).getModuleInstancesList({ name: 'ExampleModule', createdBy : 'Aegon Admin', createdAt : '145287348' }).page( 1 ).limit( 2 ).exec( function(){} )

Returns a list of two general content modules on one page with created by Aegon Admin. Access the result by handle a callback, and put the arguments on it: function(data, err).

searchModuleInstancesByModuleId

This returns a list of general content module instances by providing the id of the module.

haloSDK.generalContent( version ).searchModuleInstancesByModuleId( id ).exec(function(data, error){})

| Method | | --------| | POST |

| Attribute | Type | Required | Details | | --------------| ------ | ---------|------------------------------------| | version | String | No | Uses latest if not set | | id | String | Yes | Id of module |

Example:

haloSDK.generalContent( 'v1' ).searchModuleInstancesByModuleId( '578352e65a42e930005ecaf3' ).exec( function(){} )

Returns the general content instances of module FAQs. Access the result by handle a callback, and put the arguments on it: function(data, err).

Other services

getHaloUrl

Returns the halo url set for the SDK.

haloSDK.getHaloUrl()

getEnvironment

Returns the environment of the SDK.

haloSDK.getEnvironment()

getHaloVersion

Returns the version of HALO used by the SDK. You can access the results by handle a callback, put the arguments on it: function(data, err)

haloSDK.getHaloVersion(function(){})