forked from freezey/php-togglSDK
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTogglWorkspace.php
More file actions
64 lines (58 loc) · 2.45 KB
/
Copy pathTogglWorkspace.php
File metadata and controls
64 lines (58 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
class TogglWorkspace extends Toggl{
public static $fields = array(
"name", // (string, required)
"premium", // If it's a pro workspace or not. Shows if someone is paying for the workspace or not (boolean, not required)
"at", // timestamp that is sent in the response, indicates the time item was last updated
);
public static function getWorkspaces(array $params = array()){
foreach ($params as $name => $param){
if (array_search($name, self::$fields) === false){
return "Invalid Parameter: $name";
}
}
$params['method'] = "GET";
$params['url'] = "https://www.toggl.com/api/v8/workspaces";
return self::send($params);
}
public static function getWorkspaceUsers($workspace_id, array $params = array()){
foreach ($params as $name => $param){
if (array_search($name, self::$fields) === false){
return "Invalid Parameter: $name";
}
}
$params['method'] = "GET";
$params['url'] = "https://www.toggl.com/api/v8/workspaces/$workspace_id/users";
return self::send($params);
}
public static function getWorkspaceClients($workspace_id, array $params = array()){
foreach ($params as $name => $param){
if (array_search($name, self::$fields) === false){
return "Invalid Parameter: $name";
}
}
$params['method'] = "GET";
$params['url'] = "https://www.toggl.com/api/v8/workspaces/$workspace_id/clients";
return self::send($params);
}
public static function getWorkspaceProjects($workspace_id, array $params = array()){
foreach ($params as $name => $param){
if (array_search($name, self::$fields) === false){
return "Invalid Parameter: $name";
}
}
$params['method'] = "GET";
$params['url'] = "https://www.toggl.com/api/v8/workspaces/$workspace_id/projects";
return self::send($params);
}
public static function getWorkspaceTasks($workspace_id, array $params = array()){
foreach ($params as $name => $param){
if (array_search($name, self::$fields) === false){
return "Invalid Parameter: $name";
}
}
$params['method'] = "GET";
$params['url'] = "https://www.toggl.com/api/v8/workspaces/$workspace_id/tasks";
return self::send($params);
}
}