'required string', 'members' => 'optional list', 'icon' => 'optional string', 'color' => 'optional string', 'tags' => 'optional list', ); } protected function defineReturnType() { return 'dict'; } protected function execute(ConduitAPIRequest $request) { $user = $request->getUser(); $this->requireApplicationCapability( ProjectCreateProjectsCapability::CAPABILITY, $user); $project = PhabricatorProject::initializeNewProject($user); $type_name = PhabricatorProjectNameTransaction::TRANSACTIONTYPE; $members = $request->getValue('members'); $xactions = array(); $xactions[] = id(new PhabricatorProjectTransaction()) ->setTransactionType($type_name) ->setNewValue($request->getValue('name')); if ($request->getValue('icon')) { $xactions[] = id(new PhabricatorProjectTransaction()) ->setTransactionType( PhabricatorProjectIconTransaction::TRANSACTIONTYPE) ->setNewValue($request->getValue('icon')); } if ($request->getValue('color')) { $xactions[] = id(new PhabricatorProjectTransaction()) ->setTransactionType( PhabricatorProjectColorTransaction::TRANSACTIONTYPE) ->setNewValue($request->getValue('color')); } if ($request->getValue('tags')) { $xactions[] = id(new PhabricatorProjectTransaction()) ->setTransactionType( PhabricatorProjectSlugsTransaction::TRANSACTIONTYPE) ->setNewValue($request->getValue('tags')); } $xactions[] = id(new PhabricatorProjectTransaction()) ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) ->setMetadataValue( 'edge:type', PhabricatorProjectProjectHasMemberEdgeType::EDGECONST) ->setNewValue( array( '+' => array_fuse($members), )); $editor = id(new PhabricatorProjectTransactionEditor()) ->setActor($user) ->setContinueOnNoEffect(true) ->setContentSource($request->newContentSource()); $editor->applyTransactions($project, $xactions); return $this->buildProjectInfoDictionary($project); } }