Sends a POST request to create a new account for a store in Nosto

@return AccountInterface if the request was successful.
@throws NostoException on failure.
778804
public function create()
    {
        $request = $this->initApiRequest($this->account->getSignUpApiToken());
        $request->setPath(ApiRequest::PATH_SIGN_UP);
        $request->setReplaceParams(array('{lang}' => $this->account->getLanguageCode()));
        $response = $request->post($this->account);
        $this->checkResponse($request, $response);

        $account = new Account($this->account->getPlatform() . '-' . $this->account->getName());
        $account->setTokens(Token::parseTokens(
            $response->getJsonResult(true),
            '',
            '_token'
        ));
        return $account;
    }
593735
public function createRequest()
    {
        if ($this->request == null){
            $this->request = Request::fromPhpContext($this);
        }

        return $this->request;
    }
1246633
public function exchange(NostoOAuthToken $token)
    {
        $request = new HttpRequest();
        $request->setContentType(self::CONTENT_TYPE_URL_FORM_ENCODED);
        $request->setPath(HttpRequest::PATH_OAUTH_SYNC);
        $request->setQueryParams(array('access_token' => $token->getAccessToken()));
        $response = $request->get();
        if ($response->getCode() !== 200) {
            throw ExceptionBuilder::fromHttpRequestAndResponse($request, $response);
        }

        $tokens = Token::parseTokens($response->getJsonResult(true), 'api_');
        $account = new Account($token->getMerchantName());
        $account->setTokens($tokens);
        return $account;
    }
907529
protected function create()
    {
        $this->preCreate();
        $this->data = $this->api->create($this->data);
        $this->id   = $this->data['id'];
        $this->postCreate();

        return $this;
    }
519914
public function createResponse()
    {
        // Cannot continue if a resource has not been set
        if (!$this->resource instanceof ResourceInterface) {
            return $this->response;
        }

        return $this->response
            ->setResource($this->resource)
            ->create();
    }
598860
public function add() {
		if ($this->request->is('post')) {
			$this->Cliente->create();
			if ($this->Cliente->save($this->request->data)) {
				$this->Session->setFlash(__('The %s has been saved.', Configure::read('Mesa.tituloCliente')));
				return $this->redirect(array('action' => 'index'));
			} else {
				$this->Session->setFlash(__('The %s could not be saved. Please, try again.', Configure::read('Mesa.tituloCliente')));
			}
		}
		$descuentos = $this->Cliente->Descuento->find('list');
		$tipoDocumentos = $this->Cliente->TipoDocumento->find('list');
		$ivaResponsabilidades = $this->Cliente->IvaResponsabilidad->find('list');
		$this->set(compact('descuentos', 'tipoDocumentos', 'ivaResponsabilidades'));
		$this->render('form');
	}
386603
public function createAction()
    {
        // Load form
        $entityClass = $this->getModuleNamespace() . '\Entity\\' . $this->getEntityName();
        $entity      = new $entityClass();
        $form        = $this->getForm('Create' . $this->getEntityName());
        $form->bind($entity);

        // Implement Post/Redirect/Get pattern
        $prg = $this->prg();
        if ($prg instanceof Response) {
            return $prg;
        } else if (false !== $prg) {

            // Set form data
            $form->setData($prg);

            // Create account
            $result = $this->getService()->create();
            if ($result) {
                return $this->redirect()->toRoute($this->indexRoute);
            }
        }

        // Set up view model
        $viewModel = new ViewModel(array(
            'entityName' => $this->getEntityName(),
            'form'       => $form,
        ));
        $viewModel->setTemplate('infinity-base/crud/create');

        return $viewModel;
    }
644620
public function build(): RequestDataRequest
	{
		$instance = new RequestDataRequest();
		if ($this->securityOrigin === null) {
			throw new BuilderException('Property [securityOrigin] is required.');
		}
		$instance->securityOrigin = $this->securityOrigin;
		if ($this->databaseName === null) {
			throw new BuilderException('Property [databaseName] is required.');
		}
		$instance->databaseName = $this->databaseName;
		if ($this->objectStoreName === null) {
			throw new BuilderException('Property [objectStoreName] is required.');
		}
		$instance->objectStoreName = $this->objectStoreName;
		if ($this->indexName === null) {
			throw new BuilderException('Property [indexName] is required.');
		}
		$instance->indexName = $this->indexName;
		if ($this->skipCount === null) {
			throw new BuilderException('Property [skipCount] is required.');
		}
		$instance->skipCount = $this->skipCount;
		if ($this->pageSize === null) {
			throw new BuilderException('Property [pageSize] is required.');
		}
		$instance->pageSize = $this->pageSize;
		$instance->keyRange = $this->keyRange;
		return $instance;
	}
587812
public function add()
    {
        $post = $this->Posts->newEntity();

        if ($this->request->is('post')) {
            //Only admins and managers can add posts on behalf of other users
            if (!$this->Auth->isGroup(['admin', 'manager'])) {
                $this->request = $this->request->withData('user_id', $this->Auth->user('id'));
            }

            $post = $this->Posts->patchEntity($post, $this->request->getData());

            if ($this->Posts->save($post)) {
                $this->Flash->success(I18N_OPERATION_OK);

                return $this->redirect(['action' => 'index']);
            }

            $this->Flash->error(I18N_OPERATION_NOT_OK);
        }

        $this->set(compact('post'));
    }
866026
@POST
    @Path("create")
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    public Response createFromBasicAuth() throws Exception {
        return doCreateFromBasicAuth(null);
    }
524678
public Sendout instantiateForInsert() {
        Sendout entity = new Sendout();
        entity.setIsRead(Boolean.FALSE);
        entity.setCandidate(new Candidate(1));
        entity.setUser(new CorporateUser(1));
        return entity;
    }
128804
public function create()
    {
        $class = $this->getClass();
        $form = new $class();

        $schema = $this->schemaManager->create();
        $schema->setObjectClass($this->postManager->getClass());

        $form->setSchema($schema);

        return $form;
    }
884528
public function signUp()
    {
        if (!$this->get('username'))
        {
            throw new AVException("Cannot sign up user with an empty name");
        }
        if (!$this->get('password'))
        {
            throw new AVException("Cannot sign up user with an empty password.");
        }
        if ($this->getObjectId())
        {
            throw new AVException("Cannot sign up an already existing user.");
        }
        parent::save();
        $this->handleSaveResult(true);
    }
78183
protected function create()
    {
        if ($this->executed) {
            return;
        }
        
        $request = new Request(Request::POST);
        $request->setHost($this->app->getHost())
            ->setEndpoint(self::ENDPOINT)
            ->setCredentials($this->app->getAppId(), $this->app->getSecretKey());
        
        $result = $request->send(
            [
                "email" => $this->email,
                "locale" => $this->locale
            ]
        );
        
        $data = $result->getData();
        
        if (!(isset($data["reference_id"]))) {
            throw new EndpointException("Invalid result structure: " . $result->getBody());
        }
        
        $this->status = $data["status"];
        $this->referenceId = $data["reference_id"];
        $this->executed = true;
    }
19550
public function create()
    {
        /**
         * @var BannerZoneInterface $bannerZone
         */
        $classNamespace = $this->getEntityNamespace();
        $bannerZone = new $classNamespace();
        $bannerZone->setBanners(new ArrayCollection());

        return $bannerZone;
    }
1295452
public function create(): Response
    {
        $request = $this->request->getPost();

        if (empty($request)) {
            $request = $this->request->getJsonRawBody(true);
        }

        //we need even if empty the custome fields
        if (empty($request)) {
            throw new Exception('No valie info sent');
        }

        //set the custom fields to update
        $this->model->setCustomFields($request);

        //try to save all the fields we allow
        if ($this->model->save($request, $this->createFields)) {
            return $this->getById($this->model->id);
        } else {
            //if not thorw exception
            throw new Exception($this->model->getMessages()[0]);
        }
    }
381584
public function add() {
		if ($this->request->is('post')) {
			$this->IvaResponsabilidad->create();
			if ($this->IvaResponsabilidad->save($this->request->data)) {
				$this->Session->setFlash(__('The iva responsabilidad has been saved.'));
				return $this->redirect(array('action' => 'index'));
			} else {
				$this->Session->setFlash(__('The iva responsabilidad could not be saved. Please, try again.'));
			}
		}
		$tipoFacturas = $this->IvaResponsabilidad->TipoFactura->find('list');
		$this->set(compact('tipoFacturas'));
	}