@uidu/client 3.6.0 → 3.7.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.
@@ -3,7 +3,10 @@ import {
3
3
  GetChannelDocument,
4
4
  type GetChannelQuery,
5
5
  type GetChannelQueryVariables,
6
+ ListChannelsDocument,
7
+ type ListChannelsQueryVariables,
6
8
  } from './generated';
9
+ import { nodes } from './utils/relay';
7
10
 
8
11
  export type Channel = NonNullable<
9
12
  NonNullable<GetChannelQuery['currentWorkspace']>['channel']
@@ -16,3 +19,16 @@ export async function getChannel(
16
19
  const result = await client.query(GetChannelDocument, variables);
17
20
  return result.currentWorkspace?.channel ?? null;
18
21
  }
22
+
23
+ /**
24
+ * The workspace's help center channels. `isDefault` marks the one the
25
+ * workspace treats as its main channel — a caller that has no channel id
26
+ * configured should prefer it over the first row.
27
+ */
28
+ export async function listChannels(
29
+ client: UiduClient,
30
+ variables: ListChannelsQueryVariables = {},
31
+ ) {
32
+ const result = await client.query(ListChannelsDocument, variables);
33
+ return nodes(result.currentWorkspace?.channels);
34
+ }
package/src/index.ts CHANGED
@@ -40,6 +40,7 @@ export {
40
40
  createPage,
41
41
  createPageBlock,
42
42
  createFieldValue,
43
+ listProjects,
43
44
  } from './cms';
44
45
  export type { Page, Template } from './cms';
45
46
 
@@ -98,7 +99,7 @@ export {
98
99
  } from './forms';
99
100
  export type { Form } from './forms';
100
101
 
101
- export { getChannel } from './help-center';
102
+ export { getChannel, listChannels } from './help-center';
102
103
  export type { Channel } from './help-center';
103
104
 
104
105
  export { search } from './search';
@@ -0,0 +1,17 @@
1
+ query ListProjects($first: Int, $after: String) {
2
+ currentWorkspace {
3
+ projects(first: $first, after: $after) {
4
+ pageInfo {
5
+ hasNextPage
6
+ endCursor
7
+ }
8
+ edges {
9
+ node {
10
+ id
11
+ name
12
+ slug
13
+ }
14
+ }
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,17 @@
1
+ query ListChannels($first: Int, $after: String) {
2
+ currentWorkspace {
3
+ channels(first: $first, after: $after) {
4
+ pageInfo {
5
+ hasNextPage
6
+ endCursor
7
+ }
8
+ edges {
9
+ node {
10
+ id
11
+ name
12
+ isDefault
13
+ }
14
+ }
15
+ }
16
+ }
17
+ }