Create a new room object

@param  {String} userId id of the user whose reserving a room
@param  {Boolean} isPublic whether the room your are creating is publicly available
@return {Promise} This promise will resolve by sending a room instance
971780
function( userId ) {

		return this.memory.createRoom( userId )
			   .then( function( id ) {

			   		rooms[ id ] = room( this.memory, id );
			   			
						return promise.resolve( rooms[ id ] );
			   }.bind( this ), function() {

			   		return promise.reject( 'could not get a roomID to create a room' );
			   });
	}
864596
func CreatePublicKey(c *context.APIContext, form api.CreateKeyOption) {
	CreateUserPublicKey(c, form, c.User.ID)
}
537688
async def create(cls, user_id: Union[int, str],
                     is_active: bool = True,
                     is_admin: bool = False,
                     resource_policy: str = None,
                     rate_limit: int = None,
                     fields: Iterable[str] = None) -> dict:
        '''
        
        '''
        if fields is None:
            fields = ('access_key', 'secret_key')
        uid_type = 'Int!' if isinstance(user_id, int) else 'String!'
        q = 'mutation($user_id: {0}, $input: KeyPairInput!) {{'.format(uid_type) + \
            '  create_keypair(user_id: $user_id, props: $input) {' \
            '    ok msg keypair { $fields }' \
            '  }' \
            '}'
        q = q.replace('$fields', ' '.join(fields))
        variables = {
            'user_id': user_id,
            'input': {
                'is_active': is_active,
                'is_admin': is_admin,
                'resource_policy': resource_policy,
                'rate_limit': rate_limit,
            },
        }
        rqst = Request(cls.session, 'POST', '/admin/graphql')
        rqst.set_json({
            'query': q,
            'variables': variables,
        })
        async with rqst.fetch() as resp:
            data = await resp.json()
            return data['create_keypair']
770684
function Partyflock(consumerKey, consumerSecret, endpoint, debug) {
  this.endpoint = 'partyflock.nl';
  // Check instance arguments
  this.endpoint = (endpoint ? endpoint : this.endpoint);
  this.consumerKey = (consumerKey ? consumerKey : false);
  this.consumerSecret = (consumerSecret ? consumerSecret : false);
  this.debug = (typeof debug !== 'undefined' ? debug : false);
  // Check config options
  if(config.partyflock) {
    this.consumerKey = (this.consumerKey === false ? config.partyflock.consumerKey : false);
    this.consumerSecret = (this.consumerSecret === false ? config.partyflock.consumerSecret : false);
    this.endpoint = (this.endpoint !== config.partyflock.endpoint ? config.partyflock.endpoint : this.endpoint);
    this.debug = (this.debug === false && config.partyflock.debug !== 'undefined' ? config.partyflock.debug : this.debug);
  }
  // CI integration
  if(process.env['CONSUMER_KEY'] && process.env['CONSUMER_SECRET']) {
    this.consumerKey = process.env['CONSUMER_KEY'];
    this.consumerSecret = process.env['CONSUMER_SECRET'];  
  }
  this.type = 'json';


  this.date = new date(this);
  this.location = new location(this);
  this.artist = new artist(this);
  this.user = new user(this);
  this.party = new party(this);

  this.oauth = new OAuth.OAuth(
    'https://' + this.endpoint + '/request_token',
    '', // no need for an oauth_token request
    this.consumerKey,
    this.consumerSecret,
    '1.0A',
    null,
    'HMAC-SHA1'
  );
}
715598
public ComponentDto create(DbSession dbSession, NewComponent newComponent, @Nullable Integer userId) {
    ComponentDto componentDto = createWithoutCommit(dbSession, newComponent, userId);
    commitAndIndex(dbSession, componentDto);
    return componentDto;
  }
25551
def room(id, &callback)
      http(:get, "/room/#{id}.json") do |data, http|
        Firering::Room.instantiate(self, data, :room, &callback)
      end
    end
840204
function ImboClient(options, publicKey, privateKey) {
    // Run a feature check, ensuring all required features are present
    features.checkFeatures();

    // Initialize options
    var opts = this.options = {
        hosts: parseUrls(options.hosts || options),
        publicKey: options.publicKey || publicKey,
        privateKey: options.privateKey || privateKey,
        user: options.user || options.publicKey || publicKey
    };

    // Validate options
    ['publicKey', 'privateKey', 'user'].forEach(function validateOption(opt) {
        if (!opts[opt] || typeof opts[opt] !== 'string') {
            throw new Error('`options.' + opt + '` must be a valid string');
        }
    });
}
111829
function( roomID, key ) {

		return this.getRoomIdForKey( key )
		.then( function( savedRoomId ) {

			if( savedRoomId == roomID ) {

				delete idToKey[ roomID ];
				delete keyToId[ key ];

				keys.push( key );

				return promise.resolve();
			} else {

				return promise.reject( 'roomID and roomID for key do not match' );
			}
		});
	}
999790
function( roomID ) {

		if( keys.length > 0 ) {

			var randIdx = Math.round( Math.random() * ( keys.length - 1 ) ),
				key = keys.splice( randIdx, 1 )[ 0 ];

			keyToId[ key ] = roomID;
			idToKey[ roomID ] = key;

			return promise.resolve( key );
		} else {

			return promise.reject( 'Run out of keys' );
		}
	}
273966
public function leave($roomId, RoomLeaveRequest $postBody, $optParams = array()) {
      $params = array('roomId' => $roomId, 'postBody' => $postBody);
      $params = array_merge($params, $optParams);
      $data = $this->__call('leave', array($params));
      if ($this->useObjects()) {
        return new Room($data);
      } else {
        return $data;
      }
    }
864551
function Client(identity) {
  if (!(this instanceof Client)) {
    return new Client(identity);
  }

  assert(identity instanceof Identity, 'Invalid identity supplied');

  this._identity = identity;
  this._podhost = utils.getPodHostFromUserID(this._identity.userID);
  this._baseUrl = 'https://' + this._podhost;
  this._pubkey = this._identity._publicKeyArmored;
}
489527
private function setup_user( $id, $public_key, $secret_key ) {
            $user = self::_get_user_by_id( $id );

            if ( is_object( $user ) ) {
                $this->_user = $user;
            } else {
                $user             = new FS_User();
                $user->id         = $id;
                $user->public_key = $public_key;
                $user->secret_key = $secret_key;

                $this->_user = $user;
                $user_result = $this->get_api_user_scope()->get();
                $user        = new FS_User( $user_result );

                $this->_user = $user;
                $this->_store_user();
            }

            return $user;
        }
1173853
function persistentStateProvider(publicAPI, model) {
  if (!model.persistentStateImpl) {
    if (localStorageAvailable()) {
      model.persistentStateImpl = {
        getState: (key) => {
          const strVal = window.localStorage[key];
          if (strVal === undefined) {
            return null;
          }
          return JSON.parse(strVal);
        },
        setState: (key, value) => {
          window.localStorage.setItem(key, JSON.stringify(value));
        },
      };
    } else {
      model.persistentStateImpl = {
        state: {},
        getState: (key) => model.persistentStateImpl.state[key],
        setState: (key, value) => {
          model.persistentStateImpl.state[key] = value;
        },
      };
    }
  }

  // Provide this method an object that implements getState(key) and setState(key, value)
  publicAPI.setImplementation = (impl) => {
    model.persistentStateImpl = impl;
  };

  publicAPI.getPersistentState = (key) =>
    model.persistentStateImpl.getState(key);

  publicAPI.setPersistentState = (key, value) => {
    model.persistentStateImpl.setState(key, value);
  };
}
799381
function createAccessPolicy(thingId) {
  const thingPolicy = {
    id: thingId + "-" + thingId + "-cru-policy",
    effect: "allow",
    actions: ["dcd:actions:create", "dcd:actions:read", "dcd:actions:update"],
    subjects: ["dcd:things:" + thingId],
    resources: [
      "dcd:things:" + thingId,
      "dcd:things:" + thingId + ":properties",
      "dcd:things:" + thingId + ":properties:<.*>"
    ]
  };
  logger.debug("Thing policy: " + JSON.stringify(thingPolicy));
  return policies.create(thingPolicy);
}
960982
@SneakyThrows
    protected boolean createUserResource(final Principal p, final Credential credential) {
        val user = new UserResource(CoreSchema.USER_DESCRIPTOR);
        this.mapper.map(user, p, credential);
        return endpoint.create(user) != null;
    }
489921
function(userId) {
    var self = this;

    if (userId !== null && typeof userId !== "string")
      throw new Error("setUserId must be called on string or null, not " +
                      typeof userId);

    // Prevent newly-created universal subscriptions from being added to our
    // session; they will be found below when we call startUniversalSubs.
    //
    // (We don't have to worry about named subscriptions, because we only add
    // them when we process a 'sub' message. We are currently processing a
    // 'method' message, and the method did not unblock, because it is illegal
    // to call setUserId after unblock. Thus we cannot be concurrently adding a
    // new named subscription.)
    self._dontStartNewUniversalSubs = true;

    // Prevent current subs from updating our collectionViews and call their
    // stop callbacks. This may yield.
    self._eachSub(function (sub) {
      sub._deactivate();
    });

    // All subs should now be deactivated. Stop sending messages to the client,
    // save the state of the published collections, reset to an empty view, and
    // update the userId.
    self._isSending = false;
    var beforeCVs = self.collectionViews;
    self.collectionViews = {};
    self.userId = userId;

    // Save the old named subs, and reset to having no subscriptions.
    var oldNamedSubs = self._namedSubs;
    self._namedSubs = {};
    self._universalSubs = [];

    _.each(oldNamedSubs, function (sub, subscriptionId) {
      self._namedSubs[subscriptionId] = sub._recreate();
      // nb: if the handler throws or calls this.error(), it will in fact
      // immediately send its 'nosub'. This is OK, though.
      self._namedSubs[subscriptionId]._runHandler();
    });

    // Allow newly-created universal subs to be started on our connection in
    // parallel with the ones we're spinning up here, and spin up universal
    // subs.
    self._dontStartNewUniversalSubs = false;
    self.startUniversalSubs();

    // Start sending messages again, beginning with the diff from the previous
    // state of the world to the current state. No yields are allowed during
    // this diff, so that other changes cannot interleave.
    Meteor._noYieldsAllowed(function () {
      self._isSending = true;
      self._diffCollectionViews(beforeCVs);
      if (!_.isEmpty(self._pendingReady)) {
        self.sendReady(self._pendingReady);
        self._pendingReady = [];
      }
    });
  }
207890
function createKeyObject (rawKeyObject, finalPublicKey = null) {
  const created = rawKeyObject.created ? dateToUnixTimestamp(rawKeyObject.created) : null;
  const revoked = rawKeyObject.revoked ? dateToUnixTimestamp(rawKeyObject.revoked) : null;
  const expires = rawKeyObject.expires ? dateToUnixTimestamp(rawKeyObject.expires) : null;
  // backcompat for v2 alpha
  let publicKey = finalPublicKey;
  if (!finalPublicKey) {
    const publicKeyTemp = rawKeyObject.id || rawKeyObject.publicKey;
    publicKey = publicKeyTemp.replace('ecdsa-koblitz-pubkey:', '');
  }
  return new Key(publicKey, created, revoked, expires);
}