static/scripts/wp-stateless-setup.js
/**
   * Create Project
   *
   *
   *  wp.stateless.createProject( {"projectId": "uds-test-project-4","name": "uds-test-project-4"} );
   *
   *
   * @todo After this is implemented we also need to assign the user to the project. - potanin@UD
   * @param options
   */


@todo After this is implemented we also need to assign the user to the project. - potanin@UD
@param options
@todo After this is implemented we also need to assign the user to the project . - potanin@UD @param options
function createProject( options ) {
    var defer = new jQuery.Deferred();
    if(!wp.stateless.getAccessToken()){
      defer.reject();
      return defer.promise("In valid access token.");
    }
    jQuery.ajax({
      url: 'https://cloudresourcemanager.googleapis.com/v1/projects',
      method: "POST",
      data: JSON.stringify( options ),
    }).done(function( responseData  ) {
      defer.resolve(responseData);
    }).fail(function(responseData) {
      defer.reject(responseData);
    });
    return defer.promise();
  }
function createProject ( options ) { var defer = new jQuery . Deferred ( ) ; if ( ! wp . stateless . getAccessToken ( ) ) { defer . reject ( ) ; return defer . promise ( "In valid access token." ) ; } jQuery . ajax ( { url : 'https://cloudresourcemanager.googleapis.com/v1/projects' , method : "POST" , data : JSON . stringify ( options ) , } ) . done ( function ( responseData ) { defer . resolve ( responseData ) ; } ) . fail ( function ( responseData ) { defer . reject ( responseData ) ; } ) ; return defer . promise ( ) ; }
Create Project
  wp.stateless.createProject( {"projectId": "uds-test-project-4","name": "uds-test-project-4"} );
Create Project wp . stateless . createProject ( { " projectId " : " uds - test - project - 4 " " name " : " uds - test - project - 4 " } ) ;