Skip to content

Commit ce22527

Browse files
committed
docs: adds patterns documentation
1 parent 5542724 commit ce22527

3 files changed

Lines changed: 24 additions & 4 deletions

File tree

documents/patterns.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## Service Version Support
2+
3+
Some Globus services expose multiple API generations. The SDK surfaces these under a version namespace on the service object (e.g, `transfer.v2`).
4+
5+
```ts
6+
import { transfer } from '@globus/sdk';
7+
8+
await transfer.v2.bookmarks.getAll();
9+
await transfer.v2.bookmarks.get({ bookmark_id: '...' });
10+
await transfer.v2.bookmarks.create({ request: { data: { name, endpoint_id, path } } });
11+
await transfer.v2.bookmarks.update({ bookmark_id: '...', request: { data: { name } } });
12+
await transfer.v2.bookmarks.remove({ bookmark_id: '...' });
13+
14+
// Service-specific imports are also available.
15+
import { bookmarks } from '@globus/sdk/tranfer/v2';
16+
import { getAll } from '@globus/sdk/tranfer/v2/bookmarks';
17+
```
18+
19+
As of `v6.x.x` the methods on the default namespace _may_ contain mixed version usage. The default namespace will likely be removed, or more formally aliased to the "latest" version of a service resource in an upcoming major release (breaking change).

src/services/transfer/service/v2/bookmarks.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type GetResponse = GetOperation['responses']['200']['content']['application/json
2929
export const get = createServiceMethodFactory({
3030
service: ID,
3131
resource_server: RESOURCE_SERVERS.TRANSFER,
32-
path: `/v2/bookmark/{bookmark_id}`,
32+
path: `/v2/bookmarks/{bookmark_id}`,
3333
}).generate<
3434
{
3535
request?: {
@@ -46,7 +46,7 @@ type CreateResponse = CreateOperation['responses']['201']['content']['applicatio
4646
export const create = createServiceMethodFactory({
4747
service: ID,
4848
resource_server: RESOURCE_SERVERS.TRANSFER,
49-
path: `/v2/bookmark`,
49+
path: `/v2/bookmarks`,
5050
method: HTTP_METHODS.POST,
5151
}).generate<
5252
{
@@ -63,7 +63,7 @@ type UpdateResponse = UpdateOperation['responses']['200']['content']['applicatio
6363
export const update = createServiceMethodFactory({
6464
service: ID,
6565
resource_server: RESOURCE_SERVERS.TRANSFER,
66-
path: `/v2/bookmark/{bookmark_id}`,
66+
path: `/v2/bookmarks/{bookmark_id}`,
6767
method: HTTP_METHODS.PATCH,
6868
}).generate<
6969
{
@@ -80,7 +80,7 @@ type RemoveResponse = RemoveOperation['responses']['200'];
8080
export const remove = createServiceMethodFactory({
8181
service: ID,
8282
resource_server: RESOURCE_SERVERS.TRANSFER,
83-
path: `/v2/bookmark/{bookmark_id}`,
83+
path: `/v2/bookmarks/{bookmark_id}`,
8484
method: HTTP_METHODS.DELETE,
8585
}).generate<
8686
{

typedoc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"./src/core/info/index.ts",
99
"./src/core/authorization/index.ts"
1010
],
11+
"projectDocuments": ["documents/*.md"],
1112
"entryPointStrategy": "expand",
1213
"out": "docs"
1314
}

0 commit comments

Comments
 (0)