diff options
author | Pierre de Lacroix <pierre@pdelacroix.com> | 2021-01-06 14:57:16 +0000 |
---|---|---|
committer | Hubert Chathi <hubert@uhoreg.ca> | 2021-01-06 14:57:16 +0000 |
commit | 671a10f29edd916f0525880d1d1fa9c9e63527ae (patch) | |
tree | fc6d59b4358c242122b647d68e8c486a35161650 /lib | |
parent | doc and other minor fixes (diff) |
allow setting user_id in Client.LowLevel API
Diffstat (limited to 'lib')
-rw-r--r-- | lib/polyjuice/client/low_level.ex | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/polyjuice/client/low_level.ex b/lib/polyjuice/client/low_level.ex index 91b39ae..6a6521d 100644 --- a/lib/polyjuice/client/low_level.ex +++ b/lib/polyjuice/client/low_level.ex @@ -37,6 +37,7 @@ defmodule Polyjuice.Client.LowLevel do user_id: String.t(), device_id: String.t(), storage: Polyjuice.Client.Storage.t(), + application_service: boolean, test: boolean } @@ -47,11 +48,21 @@ defmodule Polyjuice.Client.LowLevel do :user_id, :device_id, :storage, + application_service: false, test: false ] defimpl Polyjuice.Client.API do - def call(%{base_url: base_url, access_token: access_token, test: test}, endpoint) do + def call( + %{ + base_url: base_url, + access_token: access_token, + user_id: user_id, + application_service: application_service, + test: test + }, + endpoint + ) do %Polyjuice.Client.Endpoint.HttpSpec{ method: method, headers: headers, @@ -62,6 +73,10 @@ defmodule Polyjuice.Client.LowLevel do stream_response: stream_response } = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint) + query = query || [] + + query = if application_service, do: [{:user_id, user_id} | query], else: query + url = %{ URI.merge(base_url, path) |