Skip to content

Commit

Permalink
Refactor function parameters to include server parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
k-haru committed Feb 8, 2024
1 parent 9f78110 commit 13ccd53
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions macro/generate_endpoint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ function generate_endpoint(endpoint, post_data, server)
#=
$(description)
=#
function $(name)(params::$(string(name, "_params")))
function $(name)(server,params::$(string(name, "_params")))
if params.i == "" && $(credentials_required)
error("$(endpoint): This function require credential")
end
url = "https://$(server)/api$(endpoint)"
url = string("https://",server,"/api","$(endpoint)")
params = Dict(lowercasefirst(string(key)) => getfield(params, key) for key in propertynames(params)) |>
x -> filter(t -> t.second != nothing,x)
Expand Down
4 changes: 2 additions & 2 deletions src/drive/files/create.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ Upload a new drive file.
**Credential required**: *Yes* / **Permission**: *write:drive*
=#
function create(params::create_params)
function create(server,params::create_params)
if params.i == "" && true
error("/drive/files/create: This function require credential")
end


url = "https://misskey.io/api/drive/files/create"
url = string("https://",server,"/api","/drive/files/create")
params = Dict(lowercasefirst(string(key)) => getfield(params, key) for key in propertynames(params)) |>
x -> filter(t -> t.second != nothing,x)

Expand Down

0 comments on commit 13ccd53

Please sign in to comment.