text: /**
   * The MIT License (MIT)
   *
   * Copyright (c) 2020 Losant IoT, Inc.
   *
   * Permission is hereby granted, free of charge, to any person obtaining a copy
   * of this software and associated documentation files (the "Software"), to deal
   * in the Software without restriction, including without limitation the rights
   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   * copies of the Software, and to permit persons to whom the Software is
   * furnished to do so, subject to the following conditions:
   *
   * The above copyright notice and this permission notice shall be included in all
   * copies or substantial portions of the Software.
   *
   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   * SOFTWARE.
   */
  
  var uriTemplate = require('uri-template');
  
  module.exports = function (options, client) {
    var internals = {};
  
    /**
     * Deletes an instance member
     *
     * Authentication:
     * The client must be configured with a valid api
     * access token to call this action. The token
     * must include at least one of the following scopes:
     * all.Instance, all.User, instanceMember.*, or instanceMember.delete.
     *
     * Parameters:
     *  {string} instanceId - ID associated with the instance
     *  {string} userId - ID associated with the instance member
     *  {string} losantdomain - Domain scope of request (rarely needed)
     *  {boolean} _actions - Return resource actions in response
     *  {boolean} _links - Return resource link in response
     *  {boolean} _embedded - Return embedded resources in response
     *
     * Responses:
     *  200 - If member was successfully deleted (https://api.losant.com/#/definitions/success)
     *
     * Errors:
     *  400 - Error if malformed request (https://api.losant.com/#/definitions/error)
     *  404 - Error if instance or member was not found (https://api.losant.com/#/definitions/error)
     */
    internals.delete = function (params, opts, cb) {
      if ('function' === typeof params) {
        cb = params;
        params = {};
        opts = {};
      } else if ('function' === typeof opts) {
        cb = opts;
        opts = {};
      } else if (!opts) {
        opts = {};
      }
      params = params || {};
      var tpl = uriTemplate.parse('/instances/{instanceId}/members/{userId}');
      var pathParams = {};
      var req = {
        method: 'DELETE',
        data: {},
        headers: {},
        params: { _actions: false, _links: true, _embedded: true }
      };
      if ('undefined' !== typeof params.instanceId) { pathParams.instanceId = params.instanceId; }
      if ('undefined' !== typeof params.userId) { pathParams.userId = params.userId; }
      if ('undefined' !== typeof params.losantdomain) { req.headers.losantdomain = params.losantdomain; }
      if ('undefined' !== typeof params._actions) { req.params._actions = params._actions; }
      if ('undefined' !== typeof params._links) { req.params._links = params._links; }
      if ('undefined' !== typeof params._embedded) { req.params._embedded = params._embedded; }
      req.url = tpl.expand(pathParams);
      return client.request(req, opts, cb);
    };
  
    /**
     * Returns an instance member
     *
     * Authentication:
     * The client must be configured with a valid api
     * access token to call this action. The token
     * must include at least one of the following scopes:
     * all.Instance, all.Instance.read, all.User, all.User.read, instanceMember.*, or instanceMember.get.
     *
     * Parameters:
     *  {string} instanceId - ID associated with the instance
     *  {string} userId - ID associated with the instance member
     *  {string} losantdomain - Domain scope of request (rarely needed)
     *  {boolean} _actions - Return resource actions in response
     *  {boolean} _links - Return resource link in response
     *  {boolean} _embedded - Return embedded resources in response
     *
     * Responses:
     *  200 - A single instance member (https://api.losant.com/#/definitions/instanceMember)
     *
     * Errors:
     *  400 - Error if malformed request (https://api.losant.com/#/definitions/error)
     *  404 - Error if instance or member was not found (https://api.losant.com/#/definitions/error)
     */
    internals.get = function (params, opts, cb) {
      if ('function' === typeof params) {
        cb = params;
        params = {};
        opts = {};
      } else if ('function' === typeof opts) {
        cb = opts;
        opts = {};
      } else if (!opts) {
        opts = {};
      }
      params = params || {};
      var tpl = uriTemplate.parse('/instances/{instanceId}/members/{userId}');
      var pathParams = {};
      var req = {
        method: 'GET',
        headers: {},
        params: { _actions: false, _links: true, _embedded: true }
      };
      if ('undefined' !== typeof params.instanceId) { pathParams.instanceId = params.instanceId; }
      if ('undefined' !== typeof params.userId) { pathParams.userId = params.userId; }
      if ('undefined' !== typeof params.losantdomain) { req.headers.losantdomain = params.losantdomain; }
      if ('undefined' !== typeof params._actions) { req.params._actions = params._actions; }
      if ('undefined' !== typeof params._links) { req.params._links = params._links; }
      if ('undefined' !== typeof params._embedded) { req.params._embedded = params._embedded; }
      req.url = tpl.expand(pathParams);
      return client.request(req, opts, cb);
    };
  
    /**
     * Modifies the role of an instance member
     *
     * Authentication:
     * The client must be configured with a valid api
     * access token to call this action. The token
     * must include at least one of the following scopes:
     * all.Instance, all.User, instanceMember.*, or instanceMember.patch.
     *
     * Parameters:
     *  {string} instanceId - ID associated with the instance
     *  {string} userId - ID associated with the instance member
     *  {hash} member - Object containing new member info (https://api.losant.com/#/definitions/instanceMemberPatch)
     *  {string} losantdomain - Domain scope of request (rarely needed)
     *  {boolean} _actions - Return resource actions in response
     *  {boolean} _links - Return resource link in response
     *  {boolean} _embedded - Return embedded resources in response
     *
     * Responses:
     *  200 - The modified instance member (https://api.losant.com/#/definitions/instanceMemberPatch)
     *
     * Errors:
     *  400 - Error if malformed request (https://api.losant.com/#/definitions/error)
     *  404 - Error if instance or member was not found (https://api.losant.com/#/definitions/error)
     */
    internals.patch = function (params, opts, cb) {
      if ('function' === typeof params) {
        cb = params;
        params = {};
        opts = {};
      } else if ('function' === typeof opts) {
        cb = opts;
        opts = {};
      } else if (!opts) {
        opts = {};
      }
      params = params || {};
      var tpl = uriTemplate.parse('/instances/{instanceId}/members/{userId}');
      var pathParams = {};
      var req = {
        method: 'PATCH',
        data: {},
        headers: {},
        params: { _actions: false, _links: true, _embedded: true }
      };
      if ('undefined' !== typeof params.instanceId) { pathParams.instanceId = params.instanceId; }
      if ('undefined' !== typeof params.userId) { pathParams.userId = params.userId; }
      if ('undefined' !== typeof params.member) { req.data = params.member; }
      if ('undefined' !== typeof params.losantdomain) { req.headers.losantdomain = params.losantdomain; }
      if ('undefined' !== typeof params._actions) { req.params._actions = params._actions; }
      if ('undefined' !== typeof params._links) { req.params._links = params._links; }
      if ('undefined' !== typeof params._embedded) { req.params._embedded = params._embedded; }
      req.url = tpl.expand(pathParams);
      return client.request(req, opts, cb);
    };
  
    return internals;
  };
  