text:
'use strict';

/* jshint ignore:start */
/**
 * This code was generated by
 * \ / _    _  _|   _  _
 *  | (_)\/(_)(_|\/| |(/_  v1.0.0
 *       /       /
 */
/* jshint ignore:end */

var Holodeck = require('../../../holodeck');  /* jshint ignore:line */
var Request = require(
    '../../../../../lib/http/request');  /* jshint ignore:line */
var Response = require(
    '../../../../../lib/http/response');  /* jshint ignore:line */
var RestException = require(
    '../../../../../lib/base/RestException');  /* jshint ignore:line */
var Twilio = require('../../../../../lib');  /* jshint ignore:line */

var client;
var holodeck;

describe('Service', function() {
  beforeEach(function() {
    holodeck = new Holodeck();
    client = new Twilio('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'AUTHTOKEN', {
      httpClient: holodeck
    });
  });
  it('should generate valid create request',
    function(done) {
      holodeck.mock(new Response(500, {}));

      var opts = {'friendlyName': 'friendly_name'};
      var promise = client.verify.v2.services.create(opts);
      promise.then(function() {
        throw new Error('failed');
      }, function(error) {
        expect(error.constructor).toBe(RestException.prototype.constructor);
        done();
      }).done();

      var url = 'https://verify.twilio.com/v2/Services';

      var values = {'FriendlyName': 'friendly_name', };
      holodeck.assertHasRequest(new Request({
          method: 'POST',
          url: url,
          data: values
      }));
    }
  );
  it('should generate valid create_record response',
    function(done) {
      var body = {
          'sid': 'VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'friendly_name': 'name',
          'code_length': 4,
          'lookup_enabled': false,
          'psd2_enabled': false,
          'skip_sms_to_landlines': false,
          'dtmf_input_required': false,
          'tts_name': 'name',
          'mailer_sid': 'MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'do_not_share_warning_enabled': false,
          'custom_code_enabled': true,
          'push': {
              'include_date': false,
              'apn_credential_sid': 'CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
              'fcm_credential_sid': null
          },
          'totp': {
              'issuer': 'test-issuer',
              'time_step': 30,
              'code_length': 3,
              'skew': 2
          },
          'default_template_sid': 'HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'date_created': '2015-07-30T20:00:00Z',
          'date_updated': '2015-07-30T20:00:00Z',
          'url': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'links': {
              'verification_checks': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck',
              'verifications': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications',
              'rate_limits': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits',
              'messaging_configurations': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations',
              'entities': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities',
              'webhooks': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks',
              'access_tokens': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens'
          }
      };

      holodeck.mock(new Response(201, body));

      var opts = {'friendlyName': 'friendly_name'};
      var promise = client.verify.v2.services.create(opts);
      promise.then(function(response) {
        expect(response).toBeDefined();
        done();
      }, function() {
        throw new Error('failed');
      }).done();
    }
  );
  it('should generate valid fetch request',
    function(done) {
      holodeck.mock(new Response(500, {}));

      var promise = client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch();
      promise.then(function() {
        throw new Error('failed');
      }, function(error) {
        expect(error.constructor).toBe(RestException.prototype.constructor);
        done();
      }).done();

      var sid = 'VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
      var url = `https://verify.twilio.com/v2/Services/${sid}`;

      holodeck.assertHasRequest(new Request({
        method: 'GET',
        url: url
      }));
    }
  );
  it('should generate valid fetch_record response',
    function(done) {
      var body = {
          'sid': 'VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'friendly_name': 'name',
          'code_length': 4,
          'lookup_enabled': false,
          'psd2_enabled': false,
          'skip_sms_to_landlines': false,
          'dtmf_input_required': false,
          'tts_name': 'name',
          'mailer_sid': 'MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'do_not_share_warning_enabled': false,
          'custom_code_enabled': true,
          'push': {
              'include_date': false,
              'apn_credential_sid': null,
              'fcm_credential_sid': null
          },
          'totp': {
              'issuer': null,
              'time_step': null,
              'code_length': null,
              'skew': null
          },
          'default_template_sid': 'HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'date_created': '2015-07-30T20:00:00Z',
          'date_updated': '2015-07-30T20:00:00Z',
          'url': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'links': {
              'verification_checks': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck',
              'verifications': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications',
              'rate_limits': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits',
              'messaging_configurations': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations',
              'entities': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities',
              'webhooks': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks',
              'access_tokens': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens'
          }
      };

      holodeck.mock(new Response(200, body));

      var promise = client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch();
      promise.then(function(response) {
        expect(response).toBeDefined();
        done();
      }, function() {
        throw new Error('failed');
      }).done();
    }
  );
  it('should generate valid remove request',
    function(done) {
      holodeck.mock(new Response(500, {}));

      var promise = client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').remove();
      promise.then(function() {
        throw new Error('failed');
      }, function(error) {
        expect(error.constructor).toBe(RestException.prototype.constructor);
        done();
      }).done();

      var sid = 'VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
      var url = `https://verify.twilio.com/v2/Services/${sid}`;

      holodeck.assertHasRequest(new Request({
        method: 'DELETE',
        url: url
      }));
    }
  );
  it('should generate valid delete response',
    function(done) {
      var body = null;

      holodeck.mock(new Response(204, body));

      var promise = client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').remove();
      promise.then(function(response) {
        expect(response).toBe(true);
        done();
      }, function() {
        throw new Error('failed');
      }).done();
    }
  );
  it('should treat the first each arg as a callback',
    function(done) {
      var body = {
          'meta': {
              'page': 0,
              'page_size': 50,
              'first_page_url': 'https://verify.twilio.com/v2/Services?PageSize=50&Page=0',
              'previous_page_url': null,
              'next_page_url': null,
              'key': 'services',
              'url': 'https://verify.twilio.com/v2/Services?PageSize=50&Page=0'
          },
          'services': [
              {
                  'sid': 'VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'friendly_name': 'name',
                  'code_length': 4,
                  'lookup_enabled': false,
                  'psd2_enabled': false,
                  'skip_sms_to_landlines': false,
                  'dtmf_input_required': false,
                  'tts_name': 'name',
                  'mailer_sid': 'MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'do_not_share_warning_enabled': false,
                  'custom_code_enabled': true,
                  'push': {
                      'include_date': false,
                      'apn_credential_sid': null,
                      'fcm_credential_sid': null
                  },
                  'totp': {
                      'issuer': null,
                      'time_step': null,
                      'code_length': null,
                      'skew': null
                  },
                  'default_template_sid': 'HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'date_created': '2015-07-30T20:00:00Z',
                  'date_updated': '2015-07-30T20:00:00Z',
                  'url': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'links': {
                      'verification_checks': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck',
                      'verifications': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications',
                      'rate_limits': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits',
                      'messaging_configurations': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations',
                      'entities': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities',
                      'webhooks': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks',
                      'access_tokens': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens'
                  }
              }
          ]
      };
      holodeck.mock(new Response(200, body));
      client.verify.v2.services.each(() => done());
    }
  );
  it('should treat the second arg as a callback',
    function(done) {
      var body = {
          'meta': {
              'page': 0,
              'page_size': 50,
              'first_page_url': 'https://verify.twilio.com/v2/Services?PageSize=50&Page=0',
              'previous_page_url': null,
              'next_page_url': null,
              'key': 'services',
              'url': 'https://verify.twilio.com/v2/Services?PageSize=50&Page=0'
          },
          'services': [
              {
                  'sid': 'VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'friendly_name': 'name',
                  'code_length': 4,
                  'lookup_enabled': false,
                  'psd2_enabled': false,
                  'skip_sms_to_landlines': false,
                  'dtmf_input_required': false,
                  'tts_name': 'name',
                  'mailer_sid': 'MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'do_not_share_warning_enabled': false,
                  'custom_code_enabled': true,
                  'push': {
                      'include_date': false,
                      'apn_credential_sid': null,
                      'fcm_credential_sid': null
                  },
                  'totp': {
                      'issuer': null,
                      'time_step': null,
                      'code_length': null,
                      'skew': null
                  },
                  'default_template_sid': 'HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'date_created': '2015-07-30T20:00:00Z',
                  'date_updated': '2015-07-30T20:00:00Z',
                  'url': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'links': {
                      'verification_checks': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck',
                      'verifications': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications',
                      'rate_limits': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits',
                      'messaging_configurations': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations',
                      'entities': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities',
                      'webhooks': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks',
                      'access_tokens': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens'
                  }
              }
          ]
      };
      holodeck.mock(new Response(200, body));
      client.verify.v2.services.each({pageSize: 20}, () => done());
      holodeck.assertHasRequest(new Request({
          method: 'GET',
          url: 'https://verify.twilio.com/v2/Services',
          params: {PageSize: 20},
      }));
    }
  );
  it('should find the callback in the opts object',
    function(done) {
      var body = {
          'meta': {
              'page': 0,
              'page_size': 50,
              'first_page_url': 'https://verify.twilio.com/v2/Services?PageSize=50&Page=0',
              'previous_page_url': null,
              'next_page_url': null,
              'key': 'services',
              'url': 'https://verify.twilio.com/v2/Services?PageSize=50&Page=0'
          },
          'services': [
              {
                  'sid': 'VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'friendly_name': 'name',
                  'code_length': 4,
                  'lookup_enabled': false,
                  'psd2_enabled': false,
                  'skip_sms_to_landlines': false,
                  'dtmf_input_required': false,
                  'tts_name': 'name',
                  'mailer_sid': 'MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'do_not_share_warning_enabled': false,
                  'custom_code_enabled': true,
                  'push': {
                      'include_date': false,
                      'apn_credential_sid': null,
                      'fcm_credential_sid': null
                  },
                  'totp': {
                      'issuer': null,
                      'time_step': null,
                      'code_length': null,
                      'skew': null
                  },
                  'default_template_sid': 'HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'date_created': '2015-07-30T20:00:00Z',
                  'date_updated': '2015-07-30T20:00:00Z',
                  'url': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'links': {
                      'verification_checks': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck',
                      'verifications': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications',
                      'rate_limits': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits',
                      'messaging_configurations': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations',
                      'entities': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities',
                      'webhooks': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks',
                      'access_tokens': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens'
                  }
              }
          ]
      };
      holodeck.mock(new Response(200, body));
      client.verify.v2.services.each({callback: () => done()}, () => fail('wrong callback!'));
    }
  );
  it('should generate valid list request',
    function(done) {
      holodeck.mock(new Response(500, {}));

      var promise = client.verify.v2.services.list();
      promise.then(function() {
        throw new Error('failed');
      }, function(error) {
        expect(error.constructor).toBe(RestException.prototype.constructor);
        done();
      }).done();

      var url = 'https://verify.twilio.com/v2/Services';

      holodeck.assertHasRequest(new Request({
        method: 'GET',
        url: url
      }));
    }
  );
  it('should generate valid read_all response',
    function(done) {
      var body = {
          'meta': {
              'page': 0,
              'page_size': 50,
              'first_page_url': 'https://verify.twilio.com/v2/Services?PageSize=50&Page=0',
              'previous_page_url': null,
              'next_page_url': null,
              'key': 'services',
              'url': 'https://verify.twilio.com/v2/Services?PageSize=50&Page=0'
          },
          'services': [
              {
                  'sid': 'VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'friendly_name': 'name',
                  'code_length': 4,
                  'lookup_enabled': false,
                  'psd2_enabled': false,
                  'skip_sms_to_landlines': false,
                  'dtmf_input_required': false,
                  'tts_name': 'name',
                  'mailer_sid': 'MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'do_not_share_warning_enabled': false,
                  'custom_code_enabled': true,
                  'push': {
                      'include_date': false,
                      'apn_credential_sid': null,
                      'fcm_credential_sid': null
                  },
                  'totp': {
                      'issuer': null,
                      'time_step': null,
                      'code_length': null,
                      'skew': null
                  },
                  'default_template_sid': 'HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'date_created': '2015-07-30T20:00:00Z',
                  'date_updated': '2015-07-30T20:00:00Z',
                  'url': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'links': {
                      'verification_checks': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck',
                      'verifications': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications',
                      'rate_limits': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits',
                      'messaging_configurations': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations',
                      'entities': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities',
                      'webhooks': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks',
                      'access_tokens': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens'
                  }
              }
          ]
      };

      holodeck.mock(new Response(200, body));

      var promise = client.verify.v2.services.list();
      promise.then(function(response) {
        expect(response).toBeDefined();
        done();
      }, function() {
        throw new Error('failed');
      }).done();
    }
  );
  it('should generate valid update request',
    function(done) {
      holodeck.mock(new Response(500, {}));

      var promise = client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update();
      promise.then(function() {
        throw new Error('failed');
      }, function(error) {
        expect(error.constructor).toBe(RestException.prototype.constructor);
        done();
      }).done();

      var sid = 'VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
      var url = `https://verify.twilio.com/v2/Services/${sid}`;

      holodeck.assertHasRequest(new Request({
        method: 'POST',
        url: url
      }));
    }
  );
  it('should generate valid update_record response',
    function(done) {
      var body = {
          'sid': 'VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'friendly_name': 'name',
          'code_length': 4,
          'lookup_enabled': false,
          'psd2_enabled': false,
          'skip_sms_to_landlines': false,
          'dtmf_input_required': false,
          'tts_name': 'name',
          'mailer_sid': 'MDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'do_not_share_warning_enabled': false,
          'custom_code_enabled': true,
          'push': {
              'include_date': false,
              'apn_credential_sid': null,
              'fcm_credential_sid': 'CRbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'
          },
          'totp': {
              'issuer': 'test-issuer',
              'time_step': 30,
              'code_length': 3,
              'skew': 2
          },
          'default_template_sid': 'HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'date_created': '2015-07-30T20:00:00Z',
          'date_updated': '2015-07-30T20:00:00Z',
          'url': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'links': {
              'verification_checks': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/VerificationCheck',
              'verifications': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Verifications',
              'rate_limits': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RateLimits',
              'messaging_configurations': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/MessagingConfigurations',
              'entities': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities',
              'webhooks': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks',
              'access_tokens': 'https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AccessTokens'
          }
      };

      holodeck.mock(new Response(200, body));

      var promise = client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update();
      promise.then(function(response) {
        expect(response).toBeDefined();
        done();
      }, function() {
        throw new Error('failed');
      }).done();
    }
  );
});


text:
Ensembl.Panel.ActivitySummary = Ensembl.Panel.ContentTools.extend({

  constructor: function () {
    this.base.apply(this, arguments);

    Ensembl.EventManager.register('toolsRefreshActivitySummary', this, this.refresh);
    Ensembl.EventManager.register('toolsToggleEmptyTable', this, this.toggleEmptyTable);

    this.POLL_INTERVAL  = 10; //seconds
    this.MAX_POLLS      = -1; // no maximum
    this.pollCounter    = 0;
  },

  init: function () {

    var panel = this;

    this.base();

    this.refreshURL         = this.el.find('input[name=_refresh_url]').remove().val();
    this.ticketsDataHash    = this.el.find('input[name=_tickets_data_hash]').remove().val();

    // 'No jobs' message div
    this.elLk.noJobsMessage = this.el.find('div._no_jobs');

    // Refresh button
    this.elLk.refreshButton = this.el.find('a._tickets_refresh').on('click', function(e) {
      e.preventDefault();
      panel.clearTimer();
      panel.refresh(false, false, true);
    });

    this.elLk.refreshButtonReload = this.elLk.refreshButton.children().eq(0);
    this.elLk.refreshButtonTimer  = this.elLk.refreshButton.children().eq(1);
    this.elLk.refreshButtonText   = this.elLk.refreshButton.children().eq(2);

    // Edit icons
    this.el.find('._ticket_edit').on('click', function() {
      var ticketName = (this.href.match(/tl=([a-z0-9_-]+)/i) || []).pop();
      Ensembl.EventManager.trigger('toolsHideTicket');
      return !!ticketName && !Ensembl.EventManager.trigger('toolsEditTicket', ticketName);
    });

    // View ticket link
    this.el.find('._ticket_view').on('click', function() {
      var ticketName = (this.href.match(/tl=([a-z0-9_-]+)/i) || []).pop();
      Ensembl.EventManager.trigger('toolsToggleForm', false);
      return !!ticketName && !Ensembl.EventManager.trigger('toolsViewTicket', ticketName);
    });

    // Ticket share icon
    this.el.find('._ticket_share').each(function() {
      var share_url = $(this).find('.ticket-share-input').val();
      share_url = $('', {'href': share_url}).prop('href');
      // Create an href from  and get a valid url
      $(this).find('.ticket-share-input').attr('value', share_url);

      $(this).helptip({
        content: $(this).html(),
        close: function(e, ui, flag) {
          if (flag) {
            $(this).helptip('option', 'content', $(this).html()).helptip('close');
          }
        },
        open: function(e, ui) {
          ui.tooltip.find('input[type=checkbox]').on('change', { icon: $(this) }, function(e) {
            var form = $(this).parents('form').on('submit', function() { return false; });
            $.ajax({
              'url'       : form.prop('action'),
              'type'      : 'get',
              'data'      : form.serialize(),
              'dataType'  : 'json',
              'context'   : { tooltip: ui.tooltip, icon: e.data.icon },
              'success'   : function(json) {
                this.tooltip.find('._ticket_share_url').toggle(!!json.shared);
                this.icon.find('._ticket_share_url').toggle(!!json.shared).end().find('input[type=checkbox]')[json.shared ? 'attr' : 'removeAttr']('checked', 'checked'); // $.prop doesn't work as it doesn't change the raw html
              }
            });
          });
        }
      });
    });

    this.toggleEmptyTable();
    this.updateTicketList(false, !!this.el.find('input[name=_auto_refresh]').remove().val());
  },

  refresh: function (forceRefresh, resetPollCount, ignorePollCounter) {
  /*
   * Does a query to the backend to refresh the Activity Summary table
   * This get called by frontend and backend
   */
    var panel = this;

    this.pollCounter = !resetPollCount ? ignorePollCounter ? this.pollCounter : this.pollCounter + 1 : 0;

    this.toggleLoadingMessage(true);
    this.updateRefreshButton('refreshing');
    this.ajax({
      'url'     :  this.refreshURL,
      'data'    : { 'tickets': forceRefresh ? '' : this.ticketsDataHash }, // if forceRefresh flag is on, don't send the ticket data to the backend. This forces the backend to respond with current ticket data again.
      'cache'   : false,
      'spinner' : true,
      'success' : function(json, previous) {
        if (previous != 'method_applied') {
          this.updateRefreshButton('cleartimer');
          this.clearTimer();
        }
      },
      'error'   : function() {
        this.updateRefreshButton('cleartimer');
        this.clearTimer();
      },
      'complete': function() {
        this.toggleLoadingMessage(false);
      }
    });
  },

  updateRefreshButton: function(status) {
  /*
   * Updates the 'Refresh' link
   */
    var panel = this;

    this.elLk.refreshButtonReload.toggle(status === 'cleartimer');
    this.elLk.refreshButtonText.html(status === 'refreshing' ? 'Refreshing now…' : 'Refresh');

    if (status === 'refreshing') {
      this.elLk.refreshButtonTimer.hide();
    } else {
      this.elLk.refreshButtonTimer.toggle(status !== 'cleartimer');
      if (status === 'inittimer') {
        panel.elLk.refreshButtonTimer.text(this.POLL_INTERVAL);
        Ensembl.Panel.ActivitySummary.counter = setInterval(function() {
          panel.elLk.refreshButtonTimer.text(parseInt(panel.elLk.refreshButtonTimer.text()) - 1);
        }, 1000);
      }
    }
  },

  updateTicketList: function(ticketsDataHash, autoRefresh) {
  /*
   * Updates the Activity Summary table according to the request recieved from the backend
   * ticketsDataHash: only provided if changed
   */
    var panel = this;

    this.clearTimer();

    if (!!ticketsDataHash) {

      var memcacheProofURL  = this.params.updateURL;
          memcacheProofURL  = memcacheProofURL.replace(/\;?mcache\=[0-9]+/, '');
          memcacheProofURL += ';mcache=' + (new Date()).getTime();

      this.getContent(memcacheProofURL);

      Ensembl.EventManager.trigger('toolsRefreshTicket', false); // getContent for the displayed ticket details if any
    }
    this.autoRefresh = !!autoRefresh;

    if (this.autoRefresh && (this.MAX_POLLS < 0 || this.pollCounter < this.MAX_POLLS)) {
      Ensembl.Panel.ActivitySummary.poll = setTimeout(function () {
        panel.refresh(false, false, false);
      }, this.POLL_INTERVAL * 1000);

      this.updateRefreshButton('inittimer');

    } else {
      this.updateRefreshButton('cleartimer');
    }
  },

  toggleEmptyTable: function() {
  /*
   * Toggles the table according to whether it has any records in it or not
   */
    var tableWrapper  = this.el.find('div._ticket_table');
    var showTable     = !tableWrapper.find('.dataTables_empty').length;

    tableWrapper.toggle(showTable);
    this.elLk.noJobsMessage.toggle(!showTable);
    if (!showTable) {
      Ensembl.EventManager.trigger('toolsToggleForm', true, false);
    }
  },

  toggleLoadingMessage: function(flag) {
  /*
   * Toggles a message to the user when the jobs are refreshing (only when user has no existing jobs)
   */
    if (this.elLk.noJobsMessage.find('p').length === 1) {
      this.elLk.noJobsMessage.append($('
Loading...
').hide());
    }
    this.elLk.noJobsMessage.find('p').each(function(i) { $(this).toggle(i === 0 ? !flag : flag); }); // Loading message is in the second

  },

  clearTimer: function() {
  /*
   * Clears the timers for polling ticket update and showing timer
   */
    clearTimeout(Ensembl.Panel.ActivitySummary.poll);
    clearInterval(Ensembl.Panel.ActivitySummary.counter);
  },

  destructor: function() {
  /*
   * Clears the timers before destroying the object
   */
    this.clearTimer();
    this.base.apply(this, arguments);
  }
});

redpajama_set_name: RedPajamaGithub


text:
import styled from 'styled-components';

const H1 = styled.h1`
  text-align: center;
  font-weight: 700;
`;

export default H1;


text:
<?php

/**
 * The AccessEntitiesDataSourceDoctrine communicates with the database and
 * loads and saves the access entities.
 *
 * @package Zepi\Core\AccessControl
 * @subpackage DataSource
 * @author Matthias Zobrist <matthias.zobrist@zepi.net>
 * @copyright Copyright (c) 2015 zepi
 */

namespace Zepi\Core\AccessControl\DataSource;

use \Zepi\Core\AccessControl\Exception;
use \Zepi\Turbo\FrameworkInterface\DataSourceInterface;
use \Zepi\DataSource\Doctrine\Manager\EntityManager;
use \Zepi\Core\AccessControl\Entity\AccessEntity;
use \Zepi\DataSource\Core\Entity\DataRequest;

/**
 * The AccessEntitiesDataSourceDoctrine communicates with the database and
 * loads and saves the access entities.
 *
 * @author Matthias Zobrist <matthias.zobrist@zepi.net>
 * @copyright Copyright (c) 2015 zepi
 */
class AccessEntitiesDataSourceDoctrine implements DataSourceInterface, AccessEntitiesDataSourceInterface
{
    /**
     * @access protected
     * @var \Zepi\DataSource\Doctrine\Manager\EntityManager
     */
    protected $entityManager;

    /**
     * @access protected
     * @var \Zepi\Core\AccessControl\DataSource\PermissionsDataSourceInterface
     */
    protected $permissionsDataSource;

    /**
     * Constructs the object
     *
     * @access public
     * @param \Zepi\DataSource\Doctrine\Manager\EntityManager $entityManager
     * @param \Zepi\Core\AccessControl\DataSource\PermissionsDataSourceInterface $permissionsDataSource
     */
    public function __construct(EntityManager $entityManager, PermissionsDataSourceInterface $permissionsDataSource)
    {
        $this->entityManager = $entityManager;
        $this->permissionsDataSource = $permissionsDataSource;
    }

    /**
     * Executes the setup for the data source. Returns true if everything
     * worked as expected or fals if any error occoured.
     *
     * @access public
     * @return boolean
     */
    public function setup()
    {
        return true;
    }

    /**
     * Returns an array with all found access entities for the given DataRequest
     * object.
     *
     * @param string $class
     * @param \Zepi\Core\Utils\DataRequest $dataRequest
     * @return array
     *
     * @throws \Zepi\Core\AccessControl\Exception Cannot load the access entities for the given data request.
     */
    public function find($class, DataRequest $dataRequest)
    {
        try {
            $dataRequest->setSelectedFields(array('*'));

            $queryBuilder = $this->entityManager->getQueryBuilder();
            $this->entityManager->buildDataRequestQuery($dataRequest, $queryBuilder, $class, 'a');

            $accessEntities = $queryBuilder->getQuery()->getResult();
            if ($accessEntities == null) {
                return array();
            }

            foreach ($accessEntities as $accessEntity) {
                $this->loadPermissions($accessEntity);
            }

            return $accessEntities;
        } catch (\Exception $e) {
            throw new Exception('Cannot load the access entities for the given data request from the database.', 0, $e);
        }
    }

    /**
     * Returns the number of all found access entities for the given DataRequest
     * object.
     *
     * @param string $class
     * @param \Zepi\Core\Utils\DataRequest $dataRequest
     * @return integer
     *
     * @throws \Zepi\Core\AccessControl\Exception Cannot count the access entities for the given data request.
     */
    public function count($class, DataRequest $dataRequest)
    {
        try {
            $request = clone $dataRequest;

            $request->setPage(0);
            $request->setNumberOfEntries(0);

            $queryBuilder = $this->entityManager->getQueryBuilder();
            $this->entityManager->buildDataRequestQuery($request, $queryBuilder, $class, 'a');

            // Count
            $queryBuilder->select($queryBuilder->expr()->count('a.id'));

            $data = $queryBuilder->getQuery();
            if ($data === false) {
                return 0;
            }

            return $data->getSingleScalarResult();
        } catch (\Exception $e) {
            throw new Exception('Cannot count the access entities for the given data request.', 0, $e);
        }
    }

    /**
     * Returns true if the given entity id exists
     *
     * @param string $class
     * @param integer $entityId
     * @return boolean
     *
     * @throws \Zepi\Core\AccessControl\Exception Cannot check if there is an access entitiy for the given class "{class}" and id "{entityId}".
     */
    public function has($class, $entityId)
    {
        try {
            $em = $this->entityManager->getDoctrineEntityManager();
            $data = $em->getRepository($class)->findOneBy(array(
                'id' => $entityId,
            ));

            if ($data !== null) {
                return true;
            }

            return false;
        } catch (\Exception $e) {
            throw new Exception('Cannot check if there is an access entitiy for the given class "' . $class . '" and id "' . $entityId . '".', 0, $e);
        }
    }

    /**
     * Returns the entity for the given id. Returns false if
     * there is no entity for the given id.
     *
     * @param string $class
     * @param integer $entityId
     * @return false|mixed
     *
     * @throws \Zepi\Core\AccessControl\Exception Cannot load the access entitiy for the given class "{class}" and id "{entityId}".
     */
    public function get($class, $entityId)
    {
        try {
            $em = $this->entityManager->getDoctrineEntityManager();
            $accessEntity = $em->getRepository($class)->findOneBy(array(
                'id' => $entityId,
            ));

            if ($accessEntity !== null) {
                $this->loadPermissions($accessEntity);

                return $accessEntity;
            }

            return false;
        } catch (\Exception $e) {
            throw new Exception('Cannot load the access entitiy for the given class "' . $class . '" and id "' . $entityId . '".', 0, $e);
        }
    }

    /**
     * Returns true if there is a access entity for the given uuid
     *
     * @access public
     * @param string $class
     * @param string $uuid
     * @return boolean
     *
     * @throws \Zepi\Core\AccessControl\Exception Cannot check if there is an access entitiy for the given uuid "{uuid}".
     */
    public function hasAccessEntityForUuid($class, $uuid)
    {
        try {
             $em = $this->entityManager->getDoctrineEntityManager();
             $data = $em->getRepository($class)->findOneBy(array(
                 'uuid' => $uuid,
             ));

             if ($data !== null) {
                 return true;
             }

             return false;
        } catch (\Exception $e) {
            throw new Exception('Cannot check if there is an access entitiy for the given uuid "' . $uuid . '".', 0, $e);
        }
    }

    /**
     * Returns true if there is a access entity for the given type and name
     *
     * @access public
     * @param string $class
     * @param string $name
     * @return boolean
     *
     * @throws \Zepi\Core\AccessControl\Exception Cannot check if there is an access entitiy for the given type "{type}" and name "{name}".
     */
    public function hasAccessEntityForName($class, $name)
    {
        try {
            $em = $this->entityManager->getDoctrineEntityManager();
            $data = $em->getRepository($class)->findOneBy(array(
                'name' => $name,
            ));

            if ($data !== null) {
                return true;
            }

            return false;
        } catch (\Exception $e) {
            throw new Exception('Cannot check if there is an access entitiy for the given type "' . $class . '" and name "' . $name . '".', 0, $e);
        }
    }

    /**
     * Returns the access entity object for the given uuid
     *
     * @access public
     * @param string $class
     * @param string $uuid
     * @return false|\Zepi\Core\AccessControl\Entity\AccessEntity
     *
     * @throws \Zepi\Core\AccessControl\Exception Cannot load the access entitiy from the database for the given uuid "{uuid}".
     */
    public function getAccessEntityForUuid($class, $uuid)
    {
        try {
            $em = $this->entityManager->getDoctrineEntityManager();
            $accessEntity = $em->getRepository($class)->findOneBy(array(
                'uuid' => $uuid,
            ));

            if ($accessEntity !== null) {
                $this->loadPermissions($accessEntity);

                return $accessEntity;
            }

            return false;
        } catch (\Exception $e) {
            throw new Exception('Cannot load the access entitiy from the database for the given uuid "' . $uuid . '".', 0, $e);
        }
    }

    /**
     * Returns the access entity object for the given type and name
     *
     * @access public
     * @param string $class
     * @param string $name
     * @return false|\Zepi\Core\AccessControl\Entity\AccessEntity
     *
     * @throws \Zepi\Core\AccessControl\Exception Cannot load access entitiy from the database for the given class "{class}" and name "{name}".
     */
    public function getAccessEntityForName($class, $name)
    {
        try {
            $em = $this->entityManager->getDoctrineEntityManager();
            $accessEntity = $em->getRepository($class)->findOneBy(array(
                'name' => $name,
            ));

            if ($accessEntity !== null) {
                $this->loadPermissions($accessEntity);

                return $accessEntity;
            }

            return false;
        } catch (\Exception $e) {
            throw new Exception('Cannot load the access entitiy for the given class "' . $class . '" and name "' . $name . '".', 0, $e);
        }
    }

    /**
     * Adds an access entity. Returns the uuid of the access entity
     * or false, if the access entity can not inserted.
     *
     * @access public
     * @param \Zepi\Core\AccessControl\Entity\AccessEntity $accessEntity
     * @return string|false
     *
     * @throws \Zepi\Core\AccessControl\Exception Cannot add the new access entity "{name}".
     */
    public function addAccessEntity(AccessEntity $accessEntity)
    {
        try {
            $em = $this->entityManager->getDoctrineEntityManager();
            $em->persist($accessEntity);
            $em->flush();

            return $accessEntity->getUuid();
        } catch (\Exception $e) {
            throw new Exception('Cannot add the new access entitiy "' . $accessEntity->getName() . '".', 0, $e);
        }
    }

    /**
     * Updates the access entity. Returns true if everything worked as excepted or
     * false if the update didn't worked.
     *
     * @access public
     * @param \Zepi\Core\AccessControl\Entity\AccessEntity $accessEntity
     * @return boolean
     *
     * @throws \Zepi\Core\AccessControl\Exception Cannot update the access entity "{name}".
     */
    public function updateAccessEntity(AccessEntity $accessEntity)
    {
        try {
            $em = $this->entityManager->getDoctrineEntityManager();
            $em->flush();

            return true;
        } catch (\Exception $e) {
            throw new Exception('Cannot update the access entitiy "' . $accessEntity->getUuid() . '".', 0, $e);
        }
    }

    /**
     * Deletes the given access entity in the database.
     *
     * @access public
     * @param \Zepi\Core\AccessControl\Entity\AccessEntity $accessEntity
     * @return boolean
     */
    public function deleteAccessEntity(AccessEntity $accessEntity)
    {
        try {
            $em = $this->entityManager->getDoctrineEntityManager();
            $em->remove($accessEntity);
            $em->flush();

            return true;
        } catch (\Exception $e) {
            throw new Exception('Cannot delete the access entitiy "' . $uuid . '".', 0, $e);
        }
    }

    /**
     * Loads the permissions for the given access entity object
     *
     * @param \Zepi\Core\AccessControl\Entity\AccessEntity $accessEntity
     */
    protected function loadPermissions(AccessEntity $accessEntity)
    {
        $permissions = $this->permissionsDataSource->getPermissionsForUuid($accessEntity->getUuid());

        if ($permissions === false) {
            return;
        }

        $accessEntity->setPermissions($permissions);
    }
}


text:
using System.Collections.Generic;

namespace AdysTech.InfluxDB.Client.Net
{
    /// <summary>
    /// Represents the results returned by Query end point of the InfluxDB engine
    /// </summary>
    public interface IInfluxSeries
    {
        /// <summary>
        /// Read only List of ExpandoObjects (in the form of dynamic) representing the entries in the query result
        /// The objects will have columns as Properties with their current values
        /// </summary>
        IReadOnlyList<dynamic> Entries { get; }

        /// <summary>
        /// Indicates whether this Series has any entries or not
        /// </summary>
        bool HasEntries { get; }

        /// <summary>
        /// Name of the series. Usually its MeasurementName in case of select queries
        /// </summary>
        string SeriesName { get; }

        /// <summary>
        /// Dictionary of tags, and their respective values.
        /// </summary>
        IReadOnlyDictionary<string, string> Tags { get; }

        /// <summary>
        /// True if the influx query was answered with a partial response due to e.g. exceeding a configured
        /// max-row-limit in the InfluxDB. As we don't know which series was truncated by InfluxDB, all series
        /// of the response will be flagged with Partial=true.
        /// </summary>
        bool Partial { get; set; }
    }

    /// <summary>
    /// Represents the results returned by Query end point of the InfluxDB engine, supporting strong typing
    /// </summary>
    public interface IInfluxSeries<T>
    {
        /// <summary>
        /// Read only List of T representing the entries in the query result
        /// The objects will have been deserialized from the results
        /// </summary>
        IReadOnlyList<T> Entries { get; }

        /// <summary>
        /// Indicates whether this Series has any entries or not
        /// </summary>
        bool HasEntries { get; }

        /// <summary>
        /// Name of the series. Usually its MeasurementName in case of select queries
        /// </summary>
        string SeriesName { get; }

        /// <summary>
        /// Dictionary of tags, and their respective values.
        /// </summary>
        IReadOnlyDictionary<string, string> Tags { get; }

        /// <summary>
        /// True if the influx query was answered with a partial response due to e.g. exceeding a configured
        /// max-row-limit in the InfluxDB. As we don't know which series was truncated by InfluxDB, all series
        /// of the response will be flagged with Partial=true.
        /// </summary>
        bool Partial { get; set; }
    }
}


text:
**************
Proftpd Notify
**************

Proftpd notify modulet integrere ftp serveren proftpd med selvbetjening.

Der antages at proftpd bruger sql som back-end for dens brugere.

Bestemte bruger grupper i selvbetjening bliver synkroniseret med
grupper i proftpd, således at ændringer i de tilknyttede brugere i
selvbetjening bliver reflekteret i proftpd.

En selvbetjening gruppe kan derfor være tilknyttet en, og kun en,
gruppe i proftpd. Eftersom proftpd gruppe navnet er dens primære
nøgle så synkroniseres deres navne ikke imellem de to.

Slettes selvbetjening gruppen bliver der ikke ændret noget ved
proftpd gruppen.


text:
#include "../../StroikaPreComp.h"

#include <set>

#include "../SortedKeyedCollection.h"

#ifndef _Stroika_Foundation_Containers_Concrete_SortedKeyedCollection_stdset_h_
#define _Stroika_Foundation_Containers_Concrete_SortedKeyedCollection_stdset_h_

/**
 *  \file
 *
 *  \version    Beta
 *
 */
namespace Stroika::Foundation::Containers::Concrete {

    /**
     *  \brief   SortedKeyedCollection_stdset<KEY_TYPE,MAPPED_VALUE_TYPE> is an std::map-based concrete implementation of the SortedKeyedCollection<KEY_TYPE,MAPPED_VALUE_TYPE> container pattern.
     *
     * \note Performance Notes:
     *      Very good low overhead implementation
     *
     *      o   size () is constant complexity
     *      o   Uses Memory::BlockAllocatorOrStdAllocatorAsAppropriate
     *
     *  \note   \em Thread-Safety   C++-Standard-Thread-Safety
     */
    template <typename T, typename KEY_TYPE, typename TRAITS = KeyedCollection_DefaultTraits<T, KEY_TYPE>>
    class SortedKeyedCollection_stdset : public SortedKeyedCollection<T, KEY_TYPE, TRAITS> {
    private:
        using inherited = SortedKeyedCollection<T, KEY_TYPE, TRAITS>;

    public:
        template <typename POTENTIALLY_ADDABLE_T>
        static constexpr bool IsAddable_v = inherited::template IsAddable_v<POTENTIALLY_ADDABLE_T>;
        using TraitsType                  = typename inherited::TraitsType;
        using KeyExtractorType            = typename inherited::KeyExtractorType;
        using KeyEqualityComparerType     = typename inherited::KeyEqualityComparerType;
        using KeyInOrderKeyComparerType   = typename inherited::KeyInOrderKeyComparerType;
        using KeyType                     = typename inherited::KeyType;
        using key_type                    = typename inherited::key_type;
        using value_type                  = typename inherited::value_type;

    public:
        /**
         *  \brief SetInOrderComparer is the COMPARER passed to the STL set. It intrinsically uses the provided extractor and key comparer
         */
        template <typename KEY_EXTRACTOR, typename KEY_INORDER_COMPARER = less<key_type>>
        struct SetInOrderComparer {
            static_assert (not is_reference_v<KEY_EXTRACTOR>);
            static_assert (not is_reference_v<KEY_INORDER_COMPARER>);
            SetInOrderComparer () = delete;
            SetInOrderComparer (const KEY_EXTRACTOR& keyExtractor, const KEY_INORDER_COMPARER& inorderComparer)
                : fKeyExtractor_{keyExtractor}
                , fKeyComparer_{inorderComparer}
            {
            }
            int operator() (const value_type& lhs, const KEY_TYPE& rhs) const
            {
                return fKeyComparer_ (fKeyExtractor_ (lhs), rhs);
            };
            int operator() (const KEY_TYPE& lhs, const value_type& rhs) const
            {
                return fKeyComparer_ (lhs, fKeyExtractor_ (rhs));
            };
            int operator() (const value_type& lhs, const value_type& rhs) const
            {
                return fKeyComparer_ (fKeyExtractor_ (lhs), fKeyExtractor_ (rhs));
            };
            [[NO_UNIQUE_ADDRESS_ATTR]] const KEY_EXTRACTOR        fKeyExtractor_;
            [[NO_UNIQUE_ADDRESS_ATTR]] const KEY_INORDER_COMPARER fKeyComparer_;
            using is_transparent = int; // see https://en.cppreference.com/w/cpp/container/set/find - allows overloads to lookup by key
        };

    public:
        /**
         *  \brief STDSET is std::set<> that can be used inside KeyedCollection_stdset
         */
        template <typename KEY_EXTRACTOR, typename KEY_INORDER_COMPARER = less<key_type>>
        using STDSET = set<value_type, SetInOrderComparer<KEY_EXTRACTOR, KEY_INORDER_COMPARER>, Memory::BlockAllocatorOrStdAllocatorAsAppropriate<value_type, sizeof (value_type) <= 1024>>;

    public:
        template <typename KEY_INORDER_COMPARER = less<KEY_TYPE>,
                  typename KEY_EXTRACTOR        = typename TraitsType::DefaultKeyExtractor,
                  enable_if_t<
                      Common::IsStrictInOrderComparer<KEY_INORDER_COMPARER, KEY_TYPE> () and KeyedCollection_IsKeyExctractor<T, KEY_TYPE, KEY_EXTRACTOR> ()>* = nullptr>
        SortedKeyedCollection_stdset (KEY_INORDER_COMPARER&& keyComparer = KEY_INORDER_COMPARER{});
        SortedKeyedCollection_stdset (SortedKeyedCollection_stdset&& src) noexcept      = default;
        SortedKeyedCollection_stdset (const SortedKeyedCollection_stdset& src) noexcept = default;
        template <typename KEY_EXTRACTOR,
                  typename KEY_INORDER_COMPARER = less<KEY_TYPE>,
                  enable_if_t<
                      Common::IsStrictInOrderComparer<KEY_INORDER_COMPARER, KEY_TYPE> () and KeyedCollection_IsKeyExctractor<T, KEY_TYPE, KEY_EXTRACTOR> ()>* = nullptr>
        SortedKeyedCollection_stdset (KEY_EXTRACTOR&& keyExtractor, KEY_INORDER_COMPARER&& keyComparer = KEY_INORDER_COMPARER{});
        template <typename ITERABLE_OF_ADDABLE,
                  typename KEY_EXTRACTOR        = typename TraitsType::DefaultKeyExtractor,
                  typename KEY_INORDER_COMPARER = equal_to<KEY_TYPE>,
                  enable_if_t<
                      Configuration::IsIterable_v<ITERABLE_OF_ADDABLE> and not is_base_of_v<SortedKeyedCollection_stdset<T, KEY_TYPE, TRAITS>, decay_t<ITERABLE_OF_ADDABLE>> and Common::IsStrictInOrderComparer<KEY_INORDER_COMPARER, KEY_TYPE> () and KeyedCollection_IsKeyExctractor<T, KEY_TYPE, KEY_EXTRACTOR> ()>* = nullptr>
        SortedKeyedCollection_stdset (ITERABLE_OF_ADDABLE&& src);
        template <typename ITERABLE_OF_ADDABLE,
                  typename KEY_EXTRACTOR        = typename TraitsType::DefaultKeyExtractor,
                  typename KEY_INORDER_COMPARER = less<KEY_TYPE>,
                  enable_if_t<
                      Configuration::IsIterable_v<ITERABLE_OF_ADDABLE> and not is_base_of_v<SortedKeyedCollection_stdset<T, KEY_TYPE, TRAITS>, decay_t<ITERABLE_OF_ADDABLE>> and Common::IsStrictInOrderComparer<KEY_INORDER_COMPARER, KEY_TYPE> () and KeyedCollection_IsKeyExctractor<T, KEY_TYPE, KEY_EXTRACTOR> ()>* = nullptr>
        SortedKeyedCollection_stdset (KEY_INORDER_COMPARER&& keyComparer, ITERABLE_OF_ADDABLE&& src);
        template <typename KEY_EXTRACTOR, typename KEY_INORDER_COMPARER, typename ITERABLE_OF_ADDABLE,
                  enable_if_t<
                      KeyedCollection_IsKeyExctractor<T, KEY_TYPE, KEY_EXTRACTOR> () and Common::IsStrictInOrderComparer<KEY_INORDER_COMPARER, KEY_TYPE> () and Configuration::IsIterable_v<ITERABLE_OF_ADDABLE>>* = nullptr>
        SortedKeyedCollection_stdset (KEY_EXTRACTOR&& keyExtractor, KEY_INORDER_COMPARER&& keyComparer, ITERABLE_OF_ADDABLE&& src);
        template <typename ITERATOR_OF_ADDABLE,
                  typename KEY_EXTRACTOR        = typename TraitsType::DefaultKeyExtractor,
                  typename KEY_INORDER_COMPARER = less<KEY_TYPE>,
                  enable_if_t<
                      Configuration::IsIterator_v<ITERATOR_OF_ADDABLE> and KeyedCollection_IsKeyExctractor<T, KEY_TYPE, KEY_EXTRACTOR> () and Common::IsStrictInOrderComparer<KEY_INORDER_COMPARER, KEY_TYPE> ()>* = nullptr>
        SortedKeyedCollection_stdset (ITERATOR_OF_ADDABLE&& start, ITERATOR_OF_ADDABLE&& end);
        template <typename ITERATOR_OF_ADDABLE,
                  typename KEY_EXTRACTOR        = typename TraitsType::DefaultKeyExtractor,
                  typename KEY_INORDER_COMPARER = less<KEY_TYPE>,
                  enable_if_t<
                      Configuration::IsIterator_v<ITERATOR_OF_ADDABLE> and KeyedCollection_IsKeyExctractor<T, KEY_TYPE, KEY_EXTRACTOR> () and Common::IsStrictInOrderComparer<KEY_INORDER_COMPARER, KEY_TYPE> ()>* = nullptr>
        SortedKeyedCollection_stdset (KEY_INORDER_COMPARER&& keyComparer, ITERATOR_OF_ADDABLE&& start, ITERATOR_OF_ADDABLE&& end);
        template <typename KEY_EXTRACTOR, typename KEY_INORDER_COMPARER, typename ITERATOR_OF_ADDABLE,
                  enable_if_t<
                      KeyedCollection_IsKeyExctractor<T, KEY_TYPE, KEY_EXTRACTOR> () and Common::IsStrictInOrderComparer<KEY_INORDER_COMPARER, KEY_TYPE> () and Configuration::IsIterator_v<ITERATOR_OF_ADDABLE>>* = nullptr>
        SortedKeyedCollection_stdset (KEY_EXTRACTOR&& keyExtractor, KEY_INORDER_COMPARER&& keyComparer, ITERATOR_OF_ADDABLE&& start, ITERATOR_OF_ADDABLE&& end);

    public:
        /**
         */
        nonvirtual SortedKeyedCollection_stdset& operator= (SortedKeyedCollection_stdset&& rhs) noexcept = default;
        nonvirtual SortedKeyedCollection_stdset& operator= (const SortedKeyedCollection_stdset& rhs)     = default;

    protected:
        using _IterableRepSharedPtr        = typename inherited::_IterableRepSharedPtr;
        using _KeyedCollectionRepSharedPtr = typename KeyedCollection<T, KEY_TYPE, TRAITS>::_IRepSharedPtr;

    private:
        class IImplRepBase_;
        template <typename KEY_EXTRACTOR, typename KEY_INORDER_COMPARER>
        class Rep_;

    private:
        nonvirtual void AssertRepValidType_ () const;
    };

}

/*
 ********************************************************************************
 ******************************* Implementation Details *************************
 ********************************************************************************
 */
#include "SortedKeyedCollection_stdset.inl"

#endif /*_Stroika_Foundation_Containers_Concrete_SortedKeyedCollection_stdset_h_ */


text:
// Copyright (c) Dapplo and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace Dapplo.HttpExtensions.OAuth;

/// <summary>
///     This factory can be used to create a IHttpBehaviour which handles OAuth 2 requests
/// </summary>
public static class OAuth2HttpBehaviourFactory
{
    /// <summary>
    ///     Create a specify OAuth2 IHttpBehaviour
    /// </summary>
    /// <param name="oAuth2Settings">OAuth2Settings</param>
    /// <param name="fromHttpBehaviour">IHttpBehaviour to clone, null if a new needs to be generated</param>
    /// <returns>IChangeableHttpBehaviour</returns>
    public static IChangeableHttpBehaviour Create(OAuth2Settings oAuth2Settings, IHttpBehaviour fromHttpBehaviour = null)
    {
        // Get a clone of a IHttpBehaviour (passed or current)
        var oauthHttpBehaviour = (fromHttpBehaviour ?? HttpBehaviour.Current).ShallowClone();
        // Add a wrapper (delegate handler) which wraps all new HttpMessageHandlers
        oauthHttpBehaviour.ChainOnHttpMessageHandlerCreated(httpMessageHandler => new OAuth2HttpMessageHandler(oAuth2Settings, oauthHttpBehaviour, httpMessageHandler));
        return oauthHttpBehaviour;
    }
}


text:
<?php

namespace AppBundle\Tests\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class ObservationControllerTest extends WebTestCase
{
    public function testSaveobservation()
    {
        $client = static::createClient();

        $crawler = $client->request('GET', '/saveObservation');
    }

}


text:
package org.locationtech.geogig.data.retrieve;

import java.util.HashMap;
import java.util.Map;

import org.eclipse.jdt.annotation.Nullable;
import org.geotools.factory.Hints;
import org.locationtech.geogig.data.FeatureBuilder;
import org.locationtech.geogig.model.ObjectId;
import org.locationtech.geogig.model.RevFeature;
import org.locationtech.geogig.model.RevFeatureType;
import org.locationtech.geogig.storage.ObjectInfo;
import org.locationtech.geogig.storage.ObjectStore;
import org.opengis.feature.simple.SimpleFeature;

import com.google.common.base.Function;
import com.vividsolutions.jts.geom.GeometryFactory;

class MultiFeatureTypeBuilder implements Function<ObjectInfo<RevFeature>, SimpleFeature> {

    Map<ObjectId, FeatureBuilder> cache = new HashMap<ObjectId, FeatureBuilder>();

    ObjectStore odb;

    public MultiFeatureTypeBuilder(ObjectStore odb) {
        this.odb = odb;
    }

    public synchronized FeatureBuilder get(ObjectId metadataId) {
        FeatureBuilder featureBuilder = cache.get(metadataId);
        if (featureBuilder == null) {
            RevFeatureType revFtype = odb.getFeatureType(metadataId);
            featureBuilder = new FeatureBuilder(revFtype);
            cache.put(metadataId, featureBuilder);
        }
        return featureBuilder;
    }

    @Override
    public SimpleFeature apply(ObjectInfo<RevFeature> info) {
        FeatureBuilder featureBuilder = get(info.ref().getMetadataId());
        return build(featureBuilder, info, null);
    }

    public static SimpleFeature build(FeatureBuilder featureBuilder, ObjectInfo<RevFeature> info,
            @Nullable GeometryFactory geometryFactory) {

        String fid = info.node().getName();
        RevFeature revFeature = info.object();
        SimpleFeature feature = (SimpleFeature) featureBuilder.build(fid, revFeature,
                geometryFactory);
        feature.getUserData().put(Hints.USE_PROVIDED_FID, Boolean.TRUE);
        feature.getUserData().put(Hints.PROVIDED_FID, fid);
        feature.getUserData().put(RevFeature.class, revFeature);
        feature.getUserData().put(RevFeatureType.class, featureBuilder.getType());
        return feature;
    }
}


text:
import os.path as op

import tempita

from depsolver._package_utils \
    import \
        parse_package_full_name
from depsolver.compat \
    import \
        OrderedDict
from depsolver.package \
    import \
        PackageInfo
from depsolver.requirement \
    import \
        Requirement
from depsolver.solver.rules_generator \
    import \
        RulesGenerator

from depsolver.bundled.traitlets \
    import \
        HasTraits, Instance

from depsolver.solver.tests.scenarios.common \
    import \
        COMMON_IMPORTS, BaseScenario, packages_list_to_php_json, \
        job_to_php_constraints, run_php_scenarios

DATA = op.join(op.dirname(__file__), "data", "rules_generator")

P = PackageInfo.from_string
R = Requirement.from_string

TEMPLATE = """\
<?php
require {{bootstrap_path}};

{{common_imports}}

$loader = new ArrayLoader();

/* Remote repository definition */
$remote_repo_json = '
{{remote_repo_json_string}}
';

$packages = JsonFile::parseJson($remote_repo_json);

$remote_repo = new WritableArrayRepository();
foreach ($packages as $packageData) {
    $package = $loader->load($packageData);
    $remote_repo->addPackage($package);
}

/* Installed repository definition */
$repo_json = '
{{installed_repo_json_string}}
';

$packages = JsonFile::parseJson($repo_json);

$installed_repo = new WritableArrayRepository();
foreach ($packages as $packageData) {
    $package = $loader->load($packageData);
    $installed_repo->addPackage($package);
}

/* Pool definition */
$pool = new Pool();
$pool->addRepository($remote_repo);
$pool->addRepository($installed_repo);

$request = new Request($pool);
{{for operation, requirement_name, constraints in request}}
$constraints = array(
    {{constraints}}
);
$request_constraints = new MultiConstraint($constraints);
$request->{{operation}}("{{requirement_name}}", $request_constraints);
{{endfor}}

class DebuggingSolver extends Solver
{
    public function printRules(Request $request)
    {
        $this->jobs = $request->getJobs();

        $this->setupInstalledMap();

        $this->decisions = new Decisions($this->pool);

        $this->rules = $this->ruleSetGenerator->getRulesFor($this->jobs, $this->installedMap);
        $this->watchGraph = new RuleWatchGraph;

        foreach ($this->rules as $rule) {
            printf("%s\\n", $rule);
        }
    }
}

$policy = new DefaultPolicy();

$solver = new DebuggingSolver($policy, $pool, $installed_repo);
$solver->printRules($request);
"""

class RulesGeneratorScenario(HasTraits):
    _base_scenario = Instance(BaseScenario)

    @property
    def remote_repository(self):
        return self._base_scenario.remote_repository

    @property
    def installed_repository(self):
        return self._base_scenario.installed_repository

    @property
    def pool(self):
        return self._base_scenario.pool

    @property
    def request(self):
        return self._base_scenario.request

    @classmethod
    def from_yaml(cls, filename):
        base_scenario = BaseScenario.from_yaml(filename)
        return cls(_base_scenario=base_scenario)

    @classmethod
    def from_data(cls, remote_packages, installed_packages, request_jobs):
        base_scenario = BaseScenario.from_data(filename)
        return cls(_base_scenario=base_scenario)

    def compute_rules(self):
        installed_map = OrderedDict()
        for package in self.installed_repository.iter_packages():
            installed_map[package.id] = package
        rules_generator = RulesGenerator(self.pool, self.request, installed_map)
        return list(rules_generator.iter_rules())

    def to_php(self, filename="test_installed_map.php", composer_location=None):
        if composer_location is None:
            bootstrap_path = "__DIR__.'/src/bootstrap.php'"
        else:
            bootstrap_path = "'%s'" % op.join(composer_location, "src", "bootstrap.php")

        template = tempita.Template(TEMPLATE)

        remote_packages = self.remote_repository.list_packages()
        installed_packages = self.installed_repository.list_packages()

        variables = {
                "bootstrap_path": bootstrap_path,
                "remote_repo_json_string": packages_list_to_php_json(remote_packages),
                "installed_repo_json_string": packages_list_to_php_json(installed_packages),
                "request": [(job.job_type, job.requirement.name, job_to_php_constraints(job)) \
                            for job in self.request.jobs],
                "common_imports": COMMON_IMPORTS,
        }
        with open(filename, "wt") as fp:
            fp.write(template.substitute(variables))

def post_process(output):
    """Crappy function to convert php rule string to depsolver ones."""
    lines = []
    for line in output.splitlines():
        new_parts = []
        parts = [p.strip() for p in line[1:-1].split("|")]
        for part in parts:
            if part.startswith("-"):
                part = part[1:-2]
                name, version = parse_package_full_name(part)
                new_part = "-" + "%s-%s" % (name, str(version))
            else:
                part = part[:-2]
                name, version = parse_package_full_name(part)
                new_part = "%s-%s" % (name, str(version))
            new_parts.append(new_part)
        lines.append("(" + " | ".join(new_parts) + ")")
    lines.append("")
    return "\n".join(lines)

if __name__ == "__main__":
    data_directory = op.join(op.dirname(__file__), "data", "rules_generator")
    run_php_scenarios(data_directory, RulesGeneratorScenario, post_process)


text:
package cloudformation

import (
	"encoding/json"
	"errors"
	"fmt"
)

// AWSIoTTopicRule AWS CloudFormation Resource (AWS::IoT::TopicRule)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-topicrule.html
type AWSIoTTopicRule struct {

	// RuleName AWS CloudFormation Property
	// Required: false
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-topicrule.html#cfn-iot-topicrule-rulename
	RuleName string `json:"RuleName,omitempty"`

	// TopicRulePayload AWS CloudFormation Property
	// Required: true
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-topicrule.html#cfn-iot-topicrule-topicrulepayload
	TopicRulePayload *AWSIoTTopicRule_TopicRulePayload `json:"TopicRulePayload,omitempty"`
}

// AWSCloudFormationType returns the AWS CloudFormation resource type
func (r *AWSIoTTopicRule) AWSCloudFormationType() string {
	return "AWS::IoT::TopicRule"
}

// MarshalJSON is a custom JSON marshalling hook that embeds this object into
// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'.
func (r *AWSIoTTopicRule) MarshalJSON() ([]byte, error) {
	type Properties AWSIoTTopicRule
	return json.Marshal(&struct {
		Type       string
		Properties Properties
	}{
		Type:       r.AWSCloudFormationType(),
		Properties: (Properties)(*r),
	})
}

// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer
// AWS CloudFormation resource object, and just keeps the 'Properties' field.
func (r *AWSIoTTopicRule) UnmarshalJSON(b []byte) error {
	type Properties AWSIoTTopicRule
	res := &struct {
		Type       string
		Properties *Properties
	}{}
	if err := json.Unmarshal(b, &res); err != nil {
		fmt.Printf("ERROR: %s\n", err)
		return err
	}

	// If the resource has no Properties set, it could be nil
	if res.Properties != nil {
		*r = AWSIoTTopicRule(*res.Properties)
	}

	return nil
}

// GetAllAWSIoTTopicRuleResources retrieves all AWSIoTTopicRule items from an AWS CloudFormation template
func (t *Template) GetAllAWSIoTTopicRuleResources() map[string]AWSIoTTopicRule {
	results := map[string]AWSIoTTopicRule{}
	for name, untyped := range t.Resources {
		switch resource := untyped.(type) {
		case AWSIoTTopicRule:
			// We found a strongly typed resource of the correct type; use it
			results[name] = resource
		case map[string]interface{}:
			// We found an untyped resource (likely from JSON) which *might* be
			// the correct type, but we need to check it's 'Type' field
			if resType, ok := resource["Type"]; ok {
				if resType == "AWS::IoT::TopicRule" {
					// The resource is correct, unmarshal it into the results
					if b, err := json.Marshal(resource); err == nil {
						var result AWSIoTTopicRule
						if err := json.Unmarshal(b, &result); err == nil {
							results[name] = result
						}
					}
				}
			}
		}
	}
	return results
}

// GetAWSIoTTopicRuleWithName retrieves all AWSIoTTopicRule items from an AWS CloudFormation template
// whose logical ID matches the provided name. Returns an error if not found.
func (t *Template) GetAWSIoTTopicRuleWithName(name string) (AWSIoTTopicRule, error) {
	if untyped, ok := t.Resources[name]; ok {
		switch resource := untyped.(type) {
		case AWSIoTTopicRule:
			// We found a strongly typed resource of the correct type; use it
			return resource, nil
		case map[string]interface{}:
			// We found an untyped resource (likely from JSON) which *might* be
			// the correct type, but we need to check it's 'Type' field
			if resType, ok := resource["Type"]; ok {
				if resType == "AWS::IoT::TopicRule" {
					// The resource is correct, unmarshal it into the results
					if b, err := json.Marshal(resource); err == nil {
						var result AWSIoTTopicRule
						if err := json.Unmarshal(b, &result); err == nil {
							return result, nil
						}
					}
				}
			}
		}
	}
	return AWSIoTTopicRule{}, errors.New("resource not found")
}


text:
var version = function() { return '(loading)'; }
var compileJSON = function() { return ''; }
addEventListener('message', function(e) {
	var data = e.data;
	switch (data.cmd) {
		case 'loadVersion':
			delete Module;
			version = null;
			compileJSON = null;

			importScripts(data.data);
			version = Module.cwrap("version", "string", []);
			compileJSON = Module.cwrap("compileJSON", "string", ["string", "number"]);
			postMessage({cmd: 'versionLoaded', data: version()});
			break;
		case 'version':
			postMessage({cmd: 'versionLoaded', data: version()});
			break;
		case 'compile':
			postMessage({cmd: 'compiled', data: compileJSON(data.source, data.optimize)});
			break;
	}
}, false);


text:
class IndustryNewsController < ApplicationController

  before_action :set_news, only: [:show]

  def index
    @news = News.with_locale.industry.visible.page(params[:page])
  end

  def show

  end

  private
  def set_news
    @news = News.with_locale.industry.visible.find(params[:id])
  rescue ActiveRecord::RecordNotFound
    redirect_to industry_news_index_path
  end
end


text:
lgtm,codescanning
* Support for the ECMAScript proposed feature "class static initialization blocks" has been added.


text:
#include <napi.h>

#include "Connection.h"
#include "Function.h"

Napi::Object init(Napi::Env env, Napi::Object exports) {
  Connection::Init(env, exports);
  Function::Init(env, exports);
  return exports;
}

NODE_API_MODULE(sapnwrfc, init);