client = $client; } public function withConfig(Config $config): self { $this->config = $config; return $this; } public function getToken(): string { $response = $this->client ->request( 'POST', self::BASE_URL.self::ENDPOINT, [ 'query' => [ 'password' => $this->config->getPassword(), 'username' => $this->config->getUsername(), ], ] ); return json_decode($response->getContent()); } }