Skip to content

Commit

Permalink
Ajouter demanderCodeSecret
Browse files Browse the repository at this point in the history
  • Loading branch information
julienmalard committed Nov 15, 2024
1 parent 5bffb04 commit ad4a89f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ mutable struct Client
Client(;port, codeSecret, émetteur) = new(port, codeSecret, émetteur)
end

function avecClient(f::Function, port::Int)
codeSecret = demanderCodeSecret(port)
avecClient(f, port, codeSecret)
end
function avecClient(f::Function, port::Int, codeSecret::String)
client = Client(;port=port, codeSecret=codeSecret, émetteur=Émetteur())

Expand All @@ -34,6 +38,13 @@ function avecClient(f::Function, port::Int, codeSecret::String)
end;
end

function demanderCodeSecret(port::Int)
idDemande = string("Julia ", String(rand()))
réponse = HTTP.get(string("http://localhost:", port, "/demande/", requête); query=["id" => idDemande])

String(réponse.body)
end

function attendreRéponse(client::Client, idRequête::AbstractString, type::AbstractString)
cond = Condition()

Expand Down

0 comments on commit ad4a89f

Please sign in to comment.