protected function api( $url ) {
		add_filter( 'http_request_args', [ $this, 'http_request_args' ], 10, 2 );

		$type          = $this->return_repo_type();
		$response      = wp_remote_get( $this->get_api_url( $url ) );
		$code          = (int) wp_remote_retrieve_response_code( $response );
		$allowed_codes = [ 200, 404 ];
		remove_filter( 'http_request_args', [ $this, 'http_request_args' ] );

		if ( is_wp_error( $response ) ) {
			Singleton::get_instance( 'Messages', $this )->create_error_message( $response );

			return $response;
		}
		if ( ! in_array( $code, $allowed_codes, true ) ) {
			static::$error_code = array_merge(
				static::$error_code,
				[
					$this->type->slug => [
						'repo' => $this->type->slug,
						'code' => $code,
						'name' => $this->type->name,
						'git'  => $this->type->git,
					],
				]
			);
			if ( 'github' === $type['git'] ) {
				GitHub_API::ratelimit_reset( $response, $this->type->slug );
			}
			Singleton::get_instance( 'Messages', $this )->create_error_message( $type['git'] );

			return false;
		}

		// Gitea doesn't return json encoded raw file.
		$response = $this->convert_body_string_to_json( $response );

		return json_decode( wp_remote_retrieve_body( $response ) );
	}