update
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
local notify = require("snacks.notifier").notify
|
||||
local helpers = require("eta.helpers")
|
||||
local M = {}
|
||||
|
||||
---@class eta.solidtime.Session: eta.Session
|
||||
---@field auth string personal access token in the form of `Bearer <TOKEN>`
|
||||
---@field org string organization id
|
||||
|
||||
---@class eta.solidtime.User
|
||||
---@field name string
|
||||
---@field id string
|
||||
|
||||
---@param session eta.solidtime.Session
|
||||
---@return eta.solidtime.User
|
||||
M.get_user = function(session)
|
||||
return helpers.request(
|
||||
"get",
|
||||
session,
|
||||
"/users/me",
|
||||
{}
|
||||
).data
|
||||
end
|
||||
|
||||
---@param session eta.solidtime.Session
|
||||
---@param task eta.clickup.Task
|
||||
---@param project? string
|
||||
M.start_new = function(session, task, project)
|
||||
local req = helpers.request(
|
||||
"post",
|
||||
session,
|
||||
"/organizations/" .. session.org .. "/time-entries",
|
||||
{
|
||||
billable = false,
|
||||
member_id = M.get_user(session).id,
|
||||
start = os.date("%Y-%m-%dT%H:%M:%SZ")
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user