@sanity/client 7.9.0 → 7.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.
@@ -2629,9 +2629,13 @@ export declare class ObservableProjectsClient {
2629
2629
  *
2630
2630
  * @param options - Options for the list request
2631
2631
  * - `includeMembers` - Whether to include members in the response (default: true)
2632
+ * - `organizationId` - ID of the organization to fetch projects for
2632
2633
  */
2633
- list(options?: {includeMembers?: true}): Observable<SanityProject[]>
2634
- list(options?: {includeMembers?: false}): Observable<Omit<SanityProject, 'members'>[]>
2634
+ list(options?: {includeMembers?: true; organizationId?: string}): Observable<SanityProject[]>
2635
+ list(options?: {
2636
+ includeMembers?: false
2637
+ organizationId?: string
2638
+ }): Observable<Omit<SanityProject, 'members'>[]>
2635
2639
  /**
2636
2640
  * Fetch a project by project ID
2637
2641
  *
@@ -3989,9 +3993,13 @@ export declare class ProjectsClient {
3989
3993
  *
3990
3994
  * @param options - Options for the list request
3991
3995
  * - `includeMembers` - Whether to include members in the response (default: true)
3996
+ * - `organizationId` - ID of the organization to fetch projects for
3992
3997
  */
3993
- list(options?: {includeMembers?: true}): Promise<SanityProject[]>
3994
- list(options?: {includeMembers?: false}): Promise<Omit<SanityProject, 'members'>[]>
3998
+ list(options?: {includeMembers?: true; organizationId?: string}): Promise<SanityProject[]>
3999
+ list(options?: {
4000
+ includeMembers?: false
4001
+ organizationId?: string
4002
+ }): Promise<Omit<SanityProject, 'members'>[]>
3995
4003
  /**
3996
4004
  * Fetch a project by project ID
3997
4005
  *
@@ -2629,9 +2629,13 @@ export declare class ObservableProjectsClient {
2629
2629
  *
2630
2630
  * @param options - Options for the list request
2631
2631
  * - `includeMembers` - Whether to include members in the response (default: true)
2632
+ * - `organizationId` - ID of the organization to fetch projects for
2632
2633
  */
2633
- list(options?: {includeMembers?: true}): Observable<SanityProject[]>
2634
- list(options?: {includeMembers?: false}): Observable<Omit<SanityProject, 'members'>[]>
2634
+ list(options?: {includeMembers?: true; organizationId?: string}): Observable<SanityProject[]>
2635
+ list(options?: {
2636
+ includeMembers?: false
2637
+ organizationId?: string
2638
+ }): Observable<Omit<SanityProject, 'members'>[]>
2635
2639
  /**
2636
2640
  * Fetch a project by project ID
2637
2641
  *
@@ -3989,9 +3993,13 @@ export declare class ProjectsClient {
3989
3993
  *
3990
3994
  * @param options - Options for the list request
3991
3995
  * - `includeMembers` - Whether to include members in the response (default: true)
3996
+ * - `organizationId` - ID of the organization to fetch projects for
3992
3997
  */
3993
- list(options?: {includeMembers?: true}): Promise<SanityProject[]>
3994
- list(options?: {includeMembers?: false}): Promise<Omit<SanityProject, 'members'>[]>
3998
+ list(options?: {includeMembers?: true; organizationId?: string}): Promise<SanityProject[]>
3999
+ list(options?: {
4000
+ includeMembers?: false
4001
+ organizationId?: string
4002
+ }): Promise<Omit<SanityProject, 'members'>[]>
3995
4003
  /**
3996
4004
  * Fetch a project by project ID
3997
4005
  *
package/dist/stega.d.cts CHANGED
@@ -2629,9 +2629,13 @@ export declare class ObservableProjectsClient {
2629
2629
  *
2630
2630
  * @param options - Options for the list request
2631
2631
  * - `includeMembers` - Whether to include members in the response (default: true)
2632
+ * - `organizationId` - ID of the organization to fetch projects for
2632
2633
  */
2633
- list(options?: {includeMembers?: true}): Observable<SanityProject[]>
2634
- list(options?: {includeMembers?: false}): Observable<Omit<SanityProject, 'members'>[]>
2634
+ list(options?: {includeMembers?: true; organizationId?: string}): Observable<SanityProject[]>
2635
+ list(options?: {
2636
+ includeMembers?: false
2637
+ organizationId?: string
2638
+ }): Observable<Omit<SanityProject, 'members'>[]>
2635
2639
  /**
2636
2640
  * Fetch a project by project ID
2637
2641
  *
@@ -3989,9 +3993,13 @@ export declare class ProjectsClient {
3989
3993
  *
3990
3994
  * @param options - Options for the list request
3991
3995
  * - `includeMembers` - Whether to include members in the response (default: true)
3996
+ * - `organizationId` - ID of the organization to fetch projects for
3992
3997
  */
3993
- list(options?: {includeMembers?: true}): Promise<SanityProject[]>
3994
- list(options?: {includeMembers?: false}): Promise<Omit<SanityProject, 'members'>[]>
3998
+ list(options?: {includeMembers?: true; organizationId?: string}): Promise<SanityProject[]>
3999
+ list(options?: {
4000
+ includeMembers?: false
4001
+ organizationId?: string
4002
+ }): Promise<Omit<SanityProject, 'members'>[]>
3995
4003
  /**
3996
4004
  * Fetch a project by project ID
3997
4005
  *
package/dist/stega.d.ts CHANGED
@@ -2629,9 +2629,13 @@ export declare class ObservableProjectsClient {
2629
2629
  *
2630
2630
  * @param options - Options for the list request
2631
2631
  * - `includeMembers` - Whether to include members in the response (default: true)
2632
+ * - `organizationId` - ID of the organization to fetch projects for
2632
2633
  */
2633
- list(options?: {includeMembers?: true}): Observable<SanityProject[]>
2634
- list(options?: {includeMembers?: false}): Observable<Omit<SanityProject, 'members'>[]>
2634
+ list(options?: {includeMembers?: true; organizationId?: string}): Observable<SanityProject[]>
2635
+ list(options?: {
2636
+ includeMembers?: false
2637
+ organizationId?: string
2638
+ }): Observable<Omit<SanityProject, 'members'>[]>
2635
2639
  /**
2636
2640
  * Fetch a project by project ID
2637
2641
  *
@@ -3989,9 +3993,13 @@ export declare class ProjectsClient {
3989
3993
  *
3990
3994
  * @param options - Options for the list request
3991
3995
  * - `includeMembers` - Whether to include members in the response (default: true)
3996
+ * - `organizationId` - ID of the organization to fetch projects for
3992
3997
  */
3993
- list(options?: {includeMembers?: true}): Promise<SanityProject[]>
3994
- list(options?: {includeMembers?: false}): Promise<Omit<SanityProject, 'members'>[]>
3998
+ list(options?: {includeMembers?: true; organizationId?: string}): Promise<SanityProject[]>
3999
+ list(options?: {
4000
+ includeMembers?: false
4001
+ organizationId?: string
4002
+ }): Promise<Omit<SanityProject, 'members'>[]>
3995
4003
  /**
3996
4004
  * Fetch a project by project ID
3997
4005
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/client",
3
- "version": "7.9.0",
3
+ "version": "7.10.0",
4
4
  "description": "Client for retrieving, creating and patching data from Sanity.io",
5
5
  "keywords": [
6
6
  "sanity",
@@ -18,14 +18,27 @@ export class ObservableProjectsClient {
18
18
  *
19
19
  * @param options - Options for the list request
20
20
  * - `includeMembers` - Whether to include members in the response (default: true)
21
+ * - `organizationId` - ID of the organization to fetch projects for
21
22
  */
22
- list(options?: {includeMembers?: true}): Observable<SanityProject[]>
23
- list(options?: {includeMembers?: false}): Observable<Omit<SanityProject, 'members'>[]>
23
+ list(options?: {includeMembers?: true; organizationId?: string}): Observable<SanityProject[]>
24
+ list(options?: {
25
+ includeMembers?: false
26
+ organizationId?: string
27
+ }): Observable<Omit<SanityProject, 'members'>[]>
24
28
  list(options?: {
25
29
  includeMembers?: boolean
30
+ organizationId?: string
26
31
  }): Observable<SanityProject[] | Omit<SanityProject, 'members'>[]> {
27
- const uri = options?.includeMembers === false ? '/projects?includeMembers=false' : '/projects'
28
- return _request<SanityProject[]>(this.#client, this.#httpRequest, {uri})
32
+ const query: Record<string, string> = {}
33
+ const uri = '/projects'
34
+ if (options?.includeMembers === false) {
35
+ query.includeMembers = 'false'
36
+ }
37
+ if (options?.organizationId) {
38
+ query.organizationId = options.organizationId
39
+ }
40
+
41
+ return _request<SanityProject[]>(this.#client, this.#httpRequest, {uri, query})
29
42
  }
30
43
 
31
44
  /**
@@ -52,12 +65,26 @@ export class ProjectsClient {
52
65
  *
53
66
  * @param options - Options for the list request
54
67
  * - `includeMembers` - Whether to include members in the response (default: true)
68
+ * - `organizationId` - ID of the organization to fetch projects for
55
69
  */
56
- list(options?: {includeMembers?: true}): Promise<SanityProject[]>
57
- list(options?: {includeMembers?: false}): Promise<Omit<SanityProject, 'members'>[]>
58
- list(options?: {includeMembers?: boolean}): Promise<SanityProject[]> {
59
- const uri = options?.includeMembers === false ? '/projects?includeMembers=false' : '/projects'
60
- return lastValueFrom(_request<SanityProject[]>(this.#client, this.#httpRequest, {uri}))
70
+ list(options?: {includeMembers?: true; organizationId?: string}): Promise<SanityProject[]>
71
+ list(options?: {
72
+ includeMembers?: false
73
+ organizationId?: string
74
+ }): Promise<Omit<SanityProject, 'members'>[]>
75
+ list(options?: {
76
+ includeMembers?: boolean
77
+ organizationId?: string
78
+ }): Promise<SanityProject[] | Omit<SanityProject, 'members'>[]> {
79
+ const query: Record<string, string> = {}
80
+ const uri = '/projects'
81
+ if (options?.includeMembers === false) {
82
+ query.includeMembers = 'false'
83
+ }
84
+ if (options?.organizationId) {
85
+ query.organizationId = options.organizationId
86
+ }
87
+ return lastValueFrom(_request<SanityProject[]>(this.#client, this.#httpRequest, {uri, query}))
61
88
  }
62
89
 
63
90
  /**
@@ -3581,8 +3581,8 @@ ${selectionOpts}`);
3581
3581
  this.#client = client, this.#httpRequest = httpRequest;
3582
3582
  }
3583
3583
  list(options) {
3584
- const uri = options?.includeMembers === false ? "/projects?includeMembers=false" : "/projects";
3585
- return _request(this.#client, this.#httpRequest, { uri });
3584
+ const query = {}, uri = "/projects";
3585
+ return options?.includeMembers === false && (query.includeMembers = "false"), options?.organizationId && (query.organizationId = options.organizationId), _request(this.#client, this.#httpRequest, { uri, query });
3586
3586
  }
3587
3587
  /**
3588
3588
  * Fetch a project by project ID
@@ -3600,8 +3600,8 @@ ${selectionOpts}`);
3600
3600
  this.#client = client, this.#httpRequest = httpRequest;
3601
3601
  }
3602
3602
  list(options) {
3603
- const uri = options?.includeMembers === false ? "/projects?includeMembers=false" : "/projects";
3604
- return lastValueFrom(_request(this.#client, this.#httpRequest, { uri }));
3603
+ const query = {}, uri = "/projects";
3604
+ return options?.includeMembers === false && (query.includeMembers = "false"), options?.organizationId && (query.organizationId = options.organizationId), lastValueFrom(_request(this.#client, this.#httpRequest, { uri, query }));
3605
3605
  }
3606
3606
  /**
3607
3607
  * Fetch a project by project ID