/** * Create an Amp\Artax\Request object from the operation. * * @return \Amp\Artax\Request */ public function createRequest() { $request = new \Amp\Artax\Request(); $url = null; $request->setMethod('POST'); $jsonParams = []; if (array_key_exists('Accept', $this->parameters) == true) { $value = $this->getFilteredParameter('Accept'); $request->setHeader('Accept', $value); } $value = $this->getFilteredParameter('userAgent'); $request->setHeader('User-Agent', $value); $value = $this->getFilteredParameter('Authorization'); $request->setHeader('Authorization', $value); if (array_key_exists('otp', $this->parameters) == true) { $value = $this->getFilteredParameter('otp'); $request->setHeader('X-GitHub-OTP', $value); } $value = $this->getFilteredParameter('scopes'); $jsonParams['scopes'] = $value; $value = $this->getFilteredParameter('note'); $jsonParams['note'] = $value; if (array_key_exists('note_url', $this->parameters) == true) { $value = $this->getFilteredParameter('note_url'); $jsonParams['note_url'] = $value; } if (array_key_exists('client_id', $this->parameters) == true) { $value = $this->getFilteredParameter('client_id'); $jsonParams['client_id'] = $value; } if (array_key_exists('client_secret', $this->parameters) == true) { $value = $this->getFilteredParameter('client_secret'); $jsonParams['client_secret'] = $value; } if (array_key_exists('fingerprint', $this->parameters) == true) { $value = $this->getFilteredParameter('fingerprint'); $jsonParams['fingerprint'] = $value; } //Parameters are parsed and set, lets prepare the request if (count($jsonParams)) { $jsonBody = json_encode($jsonParams); $request->setHeader("Content-Type", "application/json"); $request->setBody($jsonBody); } if ($url == null) { $url = "https://api.github.com/authorizations"; } $request->setUri($url); return $request; }
/** * Create an Amp\Artax\Request object from the operation. * * @return \Amp\Artax\Request */ public function createRequest() { $request = new \Amp\Artax\Request(); $url = null; $request->setMethod(''); $jsonParams = []; $value = $this->getFilteredParameter('scopes'); $jsonParams['scopes'] = $value; $value = $this->getFilteredParameter('add_scopes'); $jsonParams['add_scopes'] = $value; $value = $this->getFilteredParameter('remove_scopes'); $jsonParams['remove_scopes'] = $value; $value = $this->getFilteredParameter('note'); $jsonParams['note'] = $value; $value = $this->getFilteredParameter('note_url'); $jsonParams['note_url'] = $value; $value = $this->getFilteredParameter('fingerprint'); $jsonParams['fingerprint'] = $value; //Parameters are parsed and set, lets prepare the request if (count($jsonParams)) { $jsonBody = json_encode($jsonParams); $request->setHeader("Content-Type", "application/json"); $request->setBody($jsonBody); } if ($url == null) { $url = "https://api.github.com/authorizations/{id}"; } $request->setUri($url); return $request; }
/** * Create an Amp\Artax\Request object from the operation. * * @return \Amp\Artax\Request */ public function createRequest() { $request = new \Amp\Artax\Request(); $url = null; $request->setMethod('POST'); $jsonParams = []; $value = $this->getFilteredParameter('userAgent'); $request->setHeader('User-Agent', $value); $value = $this->getFilteredParameter('client_id'); $jsonParams['client_id'] = $value; $value = $this->getFilteredParameter('client_secret'); $jsonParams['client_secret'] = $value; $value = $this->getFilteredParameter('code'); $jsonParams['code'] = $value; if (array_key_exists('state', $this->parameters) == true) { $value = $this->getFilteredParameter('state'); $jsonParams['state'] = $value; } if (array_key_exists('redirect_uri', $this->parameters) == true) { $value = $this->getFilteredParameter('redirect_uri'); $jsonParams['redirect_uri'] = $value; } //Parameters are parsed and set, lets prepare the request if (count($jsonParams)) { $jsonBody = json_encode($jsonParams); $request->setHeader("Content-Type", "application/json"); $request->setBody($jsonBody); } if ($url == null) { $url = "https://github.com/login/oauth/access_token"; } $request->setUri($url); return $request; }