From 671a10f29edd916f0525880d1d1fa9c9e63527ae Mon Sep 17 00:00:00 2001 From: Pierre de Lacroix Date: Wed, 6 Jan 2021 14:57:16 +0000 Subject: allow setting user_id in Client.LowLevel API --- lib/polyjuice/client/low_level.ex | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3