@ossy/sdk 0.0.16 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/package.json +2 -2
- package/src/Actions.ts +10 -4
- package/src/sdk.ts +21 -14
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 0.1.1 (2025-10-31)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @ossy/sdk
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# 0.1.0 (2025-10-30)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **sdk:** get current workspace ([#4](https://github.com/ossy-se/packages/issues/4)) ([afce7d5](https://github.com/ossy-se/packages/commit/afce7d5787af42691f62c9eba672ea1be000e19e))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## 0.0.16 (2025-10-30)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @ossy/sdk
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ossy/sdk",
|
|
3
3
|
"description": "Sofware Development Kit for interacting with our services",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"url": "git://github.com/ossy-se/packages/sdk",
|
|
6
6
|
"source": "src/public.index.ts",
|
|
7
7
|
"module": "build/public.index.js",
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"access": "public",
|
|
23
23
|
"registry": "https://registry.npmjs.org"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "84a2ce92ad013ccf992a009f84581880a7cb1acc"
|
|
26
26
|
}
|
package/src/Actions.ts
CHANGED
|
@@ -36,8 +36,14 @@ export const WorkspacesList: Action = {
|
|
|
36
36
|
method: 'GET'
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
export const WorkspacesGetCurrent: Action = {
|
|
40
|
+
id: 'workspaces.get-current',
|
|
41
|
+
endpoint: '/workspaces/current',
|
|
42
|
+
method: 'GET'
|
|
43
|
+
}
|
|
44
|
+
|
|
39
45
|
export const WorkspacesGet: Action<{ id: string }> = {
|
|
40
|
-
id: 'workspaces.
|
|
46
|
+
id: 'workspaces.get',
|
|
41
47
|
endpoint: '/workspaces/:id',
|
|
42
48
|
method: 'GET'
|
|
43
49
|
}
|
|
@@ -97,19 +103,19 @@ export const WorkspacesGetUsers: Action = {
|
|
|
97
103
|
}
|
|
98
104
|
|
|
99
105
|
// UserClient actions
|
|
100
|
-
export const
|
|
106
|
+
export const UserCurrentGet: Action = {
|
|
101
107
|
id: 'user.get',
|
|
102
108
|
endpoint: '/users/me',
|
|
103
109
|
method: 'GET'
|
|
104
110
|
}
|
|
105
111
|
|
|
106
|
-
export const
|
|
112
|
+
export const UserCurrentGetHistory: Action = {
|
|
107
113
|
id: 'user.get-history',
|
|
108
114
|
endpoint: '/users/me/history',
|
|
109
115
|
method: 'GET'
|
|
110
116
|
}
|
|
111
117
|
|
|
112
|
-
export const
|
|
118
|
+
export const UserCurrentUpdate: Action<{ user: any }> = {
|
|
113
119
|
id: 'user.update',
|
|
114
120
|
endpoint: '/users/me',
|
|
115
121
|
method: 'PUT'
|
package/src/sdk.ts
CHANGED
|
@@ -13,9 +13,6 @@ import {
|
|
|
13
13
|
WorkspacesEnableService,
|
|
14
14
|
WorkspacesDisableService,
|
|
15
15
|
WorkspacesGetUsers,
|
|
16
|
-
UserGet,
|
|
17
|
-
UserGetHistory,
|
|
18
|
-
UserUpdate,
|
|
19
16
|
ResourcesCreateDirectory,
|
|
20
17
|
ResourcesCreate,
|
|
21
18
|
ResourcesUpload,
|
|
@@ -35,7 +32,11 @@ import {
|
|
|
35
32
|
AuthGetAuthenticatedUserHistory,
|
|
36
33
|
AuthGetUser,
|
|
37
34
|
AuthSignOff,
|
|
38
|
-
WorkspacesGet
|
|
35
|
+
WorkspacesGet,
|
|
36
|
+
WorkspacesGetCurrent,
|
|
37
|
+
UserCurrentGet,
|
|
38
|
+
UserCurrentGetHistory,
|
|
39
|
+
UserCurrentUpdate
|
|
39
40
|
} from './Actions';
|
|
40
41
|
import { SDKConfig } from './config'
|
|
41
42
|
|
|
@@ -69,6 +70,7 @@ export class SDK {
|
|
|
69
70
|
|
|
70
71
|
get workspaces() {
|
|
71
72
|
return {
|
|
73
|
+
current: this.makeRequest(WorkspacesGetCurrent).bind(this),
|
|
72
74
|
list: this.makeRequest(WorkspacesList).bind(this),
|
|
73
75
|
get: this.makeRequest(WorkspacesGet).bind(this),
|
|
74
76
|
create: this.makeRequest(WorkspacesCreate).bind(this),
|
|
@@ -79,16 +81,21 @@ export class SDK {
|
|
|
79
81
|
inviteUser: this.makeRequest(WorkspacesInviteUser).bind(this),
|
|
80
82
|
enableService: this.makeRequest(WorkspacesEnableService).bind(this),
|
|
81
83
|
disableService: this.makeRequest(WorkspacesDisableService).bind(this),
|
|
82
|
-
getUsers: this.makeRequest(WorkspacesGetUsers).bind(this),
|
|
83
84
|
};
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
get
|
|
87
|
+
get users () {
|
|
87
88
|
return {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
list: this.makeRequest(WorkspacesGetUsers).bind(this),
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
get currentUser () {
|
|
94
|
+
return {
|
|
95
|
+
get: this.makeRequest(UserCurrentGet).bind(this),
|
|
96
|
+
update: this.makeRequest(UserCurrentUpdate).bind(this),
|
|
97
|
+
history: this.makeRequest(UserCurrentGetHistory).bind(this),
|
|
98
|
+
}
|
|
92
99
|
}
|
|
93
100
|
|
|
94
101
|
get resources() {
|
|
@@ -121,7 +128,7 @@ export class SDK {
|
|
|
121
128
|
})
|
|
122
129
|
},
|
|
123
130
|
get: this.makeRequest(ResourcesGet).bind(this),
|
|
124
|
-
list: (query: (
|
|
131
|
+
list: (query: ({ location?: string; })) => {
|
|
125
132
|
const search = new URLSearchParams({ ...query }).toString()
|
|
126
133
|
return this.makeRequest(ResourcesList)({ search })
|
|
127
134
|
},
|
|
@@ -147,14 +154,14 @@ export class SDK {
|
|
|
147
154
|
}
|
|
148
155
|
|
|
149
156
|
makeRequest = <T extends Action>(action: T) => {
|
|
150
|
-
return (_payload
|
|
157
|
+
return (_payload?: Required<T['payload']>) => {
|
|
151
158
|
|
|
152
159
|
let payload: Required<T['payload']> = {} as Required<T['payload']>;
|
|
153
160
|
|
|
154
161
|
if (!!_payload || action.payload) {
|
|
155
162
|
payload = {
|
|
156
|
-
...(action.payload || {}),
|
|
157
|
-
...(_payload || {})
|
|
163
|
+
...(action.payload || {} as Required<T['payload']>),
|
|
164
|
+
...(_payload || {} as Required<T['payload']>)
|
|
158
165
|
}
|
|
159
166
|
}
|
|
160
167
|
|