@ossy/sdk 0.9.1 → 0.10.0

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.
Files changed (2) hide show
  1. package/README.md +88 -1
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1 +1,88 @@
1
- # @ossy/sdk
1
+ # @ossy/sdk
2
+
3
+ API client for Ossy services. Use with `@ossy/sdk-react` for React hooks.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @ossy/sdk @ossy/sdk-react
9
+ ```
10
+
11
+ ## Quick start
12
+
13
+ ```js
14
+ import { SDK } from '@ossy/sdk'
15
+
16
+ const sdk = SDK.of({
17
+ workspaceId: 'your-workspace-id',
18
+ apiUrl: 'https://api.ossy.se/api/v0', // optional, this is the default
19
+ })
20
+
21
+ // List resources in a folder
22
+ const resources = await sdk.resources.list({ location: '/docs' })
23
+
24
+ // Get a single resource
25
+ const resource = await sdk.resources.get({ id: 'resource-id' })
26
+ ```
27
+
28
+ ## Configuration
29
+
30
+ | Option | Description |
31
+ |--------|-------------|
32
+ | `workspaceId` | Your workspace identifier (required for most operations) |
33
+ | `apiUrl` | API base URL (default: `https://api.ossy.se/api/v0`) |
34
+ | `authorization` | Bearer token for authenticated requests |
35
+
36
+ ## API overview
37
+
38
+ ### Workspaces
39
+
40
+ - `sdk.workspaces.current()` — Get current workspace
41
+ - `sdk.workspaces.list()` — List workspaces
42
+ - `sdk.workspaces.get({ workspaceId })` — Get workspace by ID
43
+ - `sdk.workspaces.create(payload)` — Create workspace
44
+ - `sdk.workspaces.importResourceTemplates(...)` — Import resource templates
45
+ - `sdk.workspaces.getResourceTemplates(...)` — Get resource templates
46
+
47
+ ### Resources
48
+
49
+ - `sdk.resources.list({ location })` — List resources in folder
50
+ - `sdk.resources.get({ id })` — Get resource by ID
51
+ - `sdk.resources.create(payload)` — Create resource
52
+ - `sdk.resources.search(query)` — Search resources
53
+ - `sdk.resources.remove({ id })` — Delete resource
54
+ - `sdk.resources.updateContent(...)` — Update resource content
55
+ - `sdk.resources.move(...)` — Move resource
56
+ - `sdk.resources.rename(...)` — Rename resource
57
+ - `sdk.resources.upload({ location, file })` — Upload file
58
+
59
+ ### Auth
60
+
61
+ - `sdk.auth.signIn(payload)` — Sign in
62
+ - `sdk.auth.signOff()` — Sign off
63
+ - `sdk.auth.getAuthenticatedUser()` — Get current user
64
+
65
+ ### Current user
66
+
67
+ - `sdk.currentUser.get()` — Get current user
68
+ - `sdk.currentUser.update(payload)` — Update user
69
+ - `sdk.currentUser.history()` — Get user history
70
+
71
+ ## With React
72
+
73
+ Use `@ossy/sdk-react` for React hooks (`useResource`, `useResources`) and wrap your app in `WorkspaceProvider`:
74
+
75
+ ```jsx
76
+ import { SDK } from '@ossy/sdk'
77
+ import { WorkspaceProvider } from '@ossy/sdk-react'
78
+
79
+ const sdk = SDK.of({ workspaceId: 'your-workspace-id' })
80
+
81
+ export const App = () => (
82
+ <WorkspaceProvider sdk={sdk}>
83
+ <YourApp />
84
+ </WorkspaceProvider>
85
+ )
86
+ ```
87
+
88
+ See [@ossy/sdk-react README](../sdk-react/README.md) for hook usage.
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.9.1",
4
+ "version": "0.10.0",
5
5
  "url": "git://github.com/ossy-se/packages/sdk",
6
6
  "source": "src/public.index.ts",
7
7
  "main": "build/public.index.js",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@ossy/types": "^0.2.1"
24
+ "@ossy/types": "^0.3.0"
25
25
  },
26
26
  "scripts": {
27
27
  "start": "",
@@ -36,5 +36,5 @@
36
36
  "/build",
37
37
  "README.md"
38
38
  ],
39
- "gitHead": "009330a43cf08e0cab806434b5f654401924af95"
39
+ "gitHead": "3019a8da590435ba6f10d7d861addeba011baf5d"
40
40
  }