Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: placeos
version: 2.11.11
version: 2.12.1
license: MIT

description: |
Expand Down
12 changes: 12 additions & 0 deletions src/placeos/api_wrapper/drivers.cr
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,17 @@ module PlaceOS
)
put "#{base}/#{id}", body: from_args, as: Driver
end

def recompile(id : String)
client.connection do |conn|
url = "#{base}/#{id}/recompile"
response = conn.post(url)
unless response.success?
raise "Recompile failed with status #{response.status_code}: #{response.body}"
end
true
end
end

end
end
46 changes: 43 additions & 3 deletions src/placeos/api_wrapper/users.cr
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
require "./endpoint"

module PlaceOS
# TODO:
# - create
# - update
class Client::APIWrapper::Users < Client::APIWrapper::Endpoint
include Client::APIWrapper::Endpoint::Fetch(User)
include Client::APIWrapper::Endpoint::Destroy
Expand All @@ -18,6 +15,49 @@ module PlaceOS
post "#{base}/resource_token", as: ResourceToken
end

# Creates a new user.
def create(
email : String,
first_name : String,
last_name : String,
authority_id : String,
password : String? = nil,
confirm_password : String? = nil,
card_number : String? = nil,
groups : Array(String)? = nil,
image : String? = nil,
locatable : Bool? = nil,
staff_id : String? = nil,
support : Bool? = nil,
sys_admin : Bool? = nil,
work_overrides : Hash(String, PlaceOS::Model::User::WorktimePreference)? = nil,
work_preferences : Array(PlaceOS::Model::User::WorktimePreference)? = nil
)
post base, body: from_args, as: User
end

# Updates an existing user.
def update(
id : String,
email : String? = nil,
first_name : String? = nil,
last_name : String? = nil,
authority_id : String? = nil,
password : String? = nil,
confirm_password : String? = nil,
card_number : String? = nil,
groups : Array(String)? = nil,
image : String? = nil,
locatable : Bool? = nil,
staff_id : String? = nil,
support : Bool? = nil,
sys_admin : Bool? = nil,
work_overrides : Hash(String, PlaceOS::Model::User::WorktimePreference)? = nil,
work_preferences : Array(PlaceOS::Model::User::WorktimePreference)? = nil
)
put "#{base}/#{id}", body: from_args, as: User
end

# List or search for users.
#
# Results maybe filtered by specifying a query - *q* - to search across zone
Expand Down