From 3c5b75f7ca586663a8c99ca5e09d6925972cf44c Mon Sep 17 00:00:00 2001 From: "Viv B." Date: Thu, 24 Apr 2025 09:29:46 +1000 Subject: [PATCH 1/3] feat(drivers): add recompile endpoint --- src/placeos/api_wrapper/drivers.cr | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/placeos/api_wrapper/drivers.cr b/src/placeos/api_wrapper/drivers.cr index 12a64d2..76b8014 100644 --- a/src/placeos/api_wrapper/drivers.cr +++ b/src/placeos/api_wrapper/drivers.cr @@ -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 From e220addd8cc576e89152ec3bd218cb20416a16db Mon Sep 17 00:00:00 2001 From: "Viv B." Date: Thu, 24 Apr 2025 09:31:11 +1000 Subject: [PATCH 2/3] chore(shard): bump version --- shard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shard.yml b/shard.yml index 3a6e89a..9613117 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: placeos -version: 2.11.10 +version: 2.12.0 license: MIT description: | From bf6de7aead2fab2ba6ffd33af9add2f2435ac590 Mon Sep 17 00:00:00 2001 From: viv-4 Date: Thu, 18 Dec 2025 11:28:37 +1100 Subject: [PATCH 3/3] feat(users): add create & update user --- src/placeos/api_wrapper/users.cr | 46 +++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/src/placeos/api_wrapper/users.cr b/src/placeos/api_wrapper/users.cr index d838360..fb2b2d1 100644 --- a/src/placeos/api_wrapper/users.cr +++ b/src/placeos/api_wrapper/users.cr @@ -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 @@ -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