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-minified

v1.0.0

Published

Halo SDK for Backend

Downloads

21

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-minified

haloSDK = require('halo-sdk-minified')

| 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. If environmental variables are set, it is not needed to provide the config.

haloSDK.init( config )

| 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
    • modifyModuleById

Components


Available versions: 'v1'

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.

General content

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. There is also the option to provide additional queryFields, to make the list even more specific. If provided: createdBy, withTotals and withFields are all required.

haloSDK.generalContent( version ).getModuleList( queryFields ).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 | | queryFields | Object | No | Returns all modules if not set | | createdBy | String | Yes | Related user created the module | | withTotals | Boolean | Yes | Number of instances per module | | withFields | Boolean | Yes | Get all the fields information |

queryFields = { createdBy : 'string', withTotals : 'boolean', withFields : 'boolean' }

Example:

haloSDK.generalContent( 'v1' ).getModuleList({ createdBy : 'Aegon Admin', withTotals: true, withFields : true }).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).

getModuleInstancesList

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 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 ).getModuleInstancesList( queryFields ).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 | | queryFields | Object | No | Returns all instances if not set | | createdBy | String | Yes | The related user name create instance | | moduleId | String | Yes | The related module id |

queryFields = { createdBy : 'string', moduleID : 'string' }

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

Example:

haloSDK.generalContent( 'v1' ).getModuleInstancesList({ createdBy : 'Aegon Admin', moduleId : '57fb64afec8b021000486282' }).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).

modifyModuleById

NOT IN USE. Sadly, we removed the modify sync part, not useful for backend.

Synchronize multiple instances belonging to a module given a moduleId. It is also possible to specify an array of ids to synchronize multiple modules. If both moduleId and moduleIds are present, the moduleIds param is ignored. Even though both options are optional, it is mandatory to provide at least one of them.

haloSDK.generalContent( version ).modifyModuleById( moduleId ).in([ moduleIds ]).exec(function(data, error){})

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

| Attribute | Type | Required | Details | | --------------| ------ | ---------|--------------------------------------------| | version | String | No | Uses latest if not set | | moduleId | String | No | Id of module | | moduleIds | Array | No | If moduleId set, moduleIds will be ignored |

Example:

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

Returns a list of synchronize multiples instances belonging to a module given a module id. Access the result by handle a callback, and put the arguments on it: function(data, err).

Response class for modifyModuleById (Status 200):

{
  'syncTimestamp': 0,
  'created': [
    {
      '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'
    }
  ],
  'updated': [
    {
      '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'
    }
  ],
  'deleted': [
    {
      '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'
    }
  ]
}