diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5bc8fea..a7fff6b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: matrix: include: - pair: - elixir: '1.12' + elixir: '1.15' otp: 24 lint: lint steps: diff --git a/lib/req_bigquery.ex b/lib/req_bigquery.ex index 475358a..df51eb0 100644 --- a/lib/req_bigquery.ex +++ b/lib/req_bigquery.ex @@ -255,9 +255,13 @@ defmodule ReqBigQuery do %{ "pageToken" => page_token, - "jobReference" => %{"jobId" => job_id, "projectId" => project_id} + "jobReference" => job_reference } -> - resp = page_request(request_options, project_id, job_id, page_token) + %{"jobId" => job_id, "projectId" => project_id} = job_reference + + job_location = Map.get(job_reference, "location") + + resp = page_request(request_options, project_id, job_id, job_location, page_token) {resp.body["rows"], resp.body} _end -> @@ -267,12 +271,18 @@ defmodule ReqBigQuery do |> Stream.flat_map(& &1) end - defp page_request(options, project_id, job_id, page_token) do + defp page_request(options, project_id, job_id, job_location, page_token) do uri = URI.parse( "#{@base_url}/projects/#{project_id}/queries/#{job_id}?maxResults=#{options[:max_results]}&pageToken=#{page_token}" ) + uri = + case job_location do + nil -> uri + job_location -> URI.append_query(uri, "location=#{job_location}") + end + token = Goth.fetch!(options[:goth]).token Req.new(url: uri) diff --git a/mix.exs b/mix.exs index 4eac03d..d5d229e 100644 --- a/mix.exs +++ b/mix.exs @@ -10,7 +10,7 @@ defmodule ReqBigQuery.MixProject do version: @version, description: @description, name: "ReqBigQuery", - elixir: "~> 1.12", + elixir: "~> 1.15", preferred_cli_env: [ "test.all": :test, docs: :docs,