$params Request body. */ protected function post( string $path, array $params ): Response { $request = new Request( HttpMethodEnum::POST(), AmazeeIoAiProvider::url( $path ), array( 'Content-Type' => 'application/json', 'X-Amazee-Client' => AmazeeIoAiProvider::clientHeaderValue(), ), $params, $this->getRequestOptions() ); $response = $this->getHttpTransporter()->send( $this->getRequestAuthentication()->authenticateRequest( $request ) ); AmazeeIoAiProvider::throwOnBudgetError( $response ); ResponseUtil::throwIfNotSuccessful( $response ); return $response; } /** * Merges the caller's custom options into the request params. * * @param array $params Request params built by the model. * @return array */ protected function withCustomOptions( array $params ): array { foreach ( $this->getConfig()->getCustomOptions() as $key => $value ) { if ( ! array_key_exists( $key, $params ) ) { $params[ $key ] = $value; } } return $params; } }