config = $config; } public function run(): void { try { $this->client = new Client(); $options = []; if (!empty($this->config['headers'])) { $options['headers'] = json_decode($this->config['headers'], true); } if (!empty($this->config['body'])) { $options['json'] = json_decode($this->config['body'], true); } $this->client->request( $this->config['method'] ?? 'GET', $this->config['url'], $options ); } catch (GuzzleException $e) { Log::error("Call to {$this->config['url']} failed" . $e->getMessage()); } } public static function configSchema(): array { return [ 'url' => [ 'type' => 'string', 'label' => 'API URL', 'rules' => [ 'required', 'url', ] ], 'method' => [ 'type' => 'string', 'label' => 'HTTP Method', 'rules' => [ 'required', 'in:GET,POST,PUT,DELETE,PATCH', ] ], 'headers' => [ 'type' => 'json', 'label' => 'Request Headers (JSON)', 'rules' => [ 'nullable', 'json', ] ], 'body' => [ 'type' => 'json', 'label' => 'Request Body (JSON)', 'rules' => [ 'nullable', 'json', ] ], ]; } }