@datocms/cma-client 0.1.8 → 1.0.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.
@@ -11,8 +11,8 @@ export default class Site extends BaseResource {
11
11
  *
12
12
  * Read more: https://www.datocms.com/docs/content-management-api/resources/site/self
13
13
  */
14
- find() {
15
- return this.rawFind().then((body) =>
14
+ find(queryParams?: SimpleSchemaTypes.SiteSelfHrefSchema) {
15
+ return this.rawFind(queryParams).then((body) =>
16
16
  Utils.deserializeResponseBody<SimpleSchemaTypes.SiteSelfTargetSchema>(
17
17
  body,
18
18
  ),
@@ -24,10 +24,13 @@ export default class Site extends BaseResource {
24
24
  *
25
25
  * Read more: https://www.datocms.com/docs/content-management-api/resources/site/self
26
26
  */
27
- rawFind(): Promise<SchemaTypes.SiteSelfTargetSchema> {
27
+ rawFind(
28
+ queryParams?: SchemaTypes.SiteSelfHrefSchema,
29
+ ): Promise<SchemaTypes.SiteSelfTargetSchema> {
28
30
  return this.client.request<SchemaTypes.SiteSelfTargetSchema>({
29
31
  method: 'GET',
30
32
  url: `/site`,
33
+ queryParams,
31
34
  });
32
35
  }
33
36
 
@@ -76,8 +76,11 @@ export default class User extends BaseResource {
76
76
  *
77
77
  * Read more: https://www.datocms.com/docs/content-management-api/resources/user/self
78
78
  */
79
- find(userId: string | SimpleSchemaTypes.UserData) {
80
- return this.rawFind(Utils.toId(userId)).then((body) =>
79
+ find(
80
+ userId: string | SimpleSchemaTypes.UserData,
81
+ queryParams?: SimpleSchemaTypes.UserSelfHrefSchema,
82
+ ) {
83
+ return this.rawFind(Utils.toId(userId), queryParams).then((body) =>
81
84
  Utils.deserializeResponseBody<SimpleSchemaTypes.UserSelfTargetSchema>(
82
85
  body,
83
86
  ),
@@ -89,10 +92,40 @@ export default class User extends BaseResource {
89
92
  *
90
93
  * Read more: https://www.datocms.com/docs/content-management-api/resources/user/self
91
94
  */
92
- rawFind(userId: string): Promise<SchemaTypes.UserSelfTargetSchema> {
95
+ rawFind(
96
+ userId: string,
97
+ queryParams?: SchemaTypes.UserSelfHrefSchema,
98
+ ): Promise<SchemaTypes.UserSelfTargetSchema> {
93
99
  return this.client.request<SchemaTypes.UserSelfTargetSchema>({
94
100
  method: 'GET',
95
101
  url: `/users/${userId}`,
102
+ queryParams,
103
+ });
104
+ }
105
+
106
+ /**
107
+ * Retrieve current signed-in user
108
+ *
109
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/user/me
110
+ */
111
+ findMe(queryParams?: SimpleSchemaTypes.UserMeHrefSchema) {
112
+ return this.rawFindMe(queryParams).then((body) =>
113
+ Utils.deserializeResponseBody<SimpleSchemaTypes.UserMeTargetSchema>(body),
114
+ );
115
+ }
116
+
117
+ /**
118
+ * Retrieve current signed-in user
119
+ *
120
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/user/me
121
+ */
122
+ rawFindMe(
123
+ queryParams?: SchemaTypes.UserMeHrefSchema,
124
+ ): Promise<SchemaTypes.UserMeTargetSchema> {
125
+ return this.client.request<SchemaTypes.UserMeTargetSchema>({
126
+ method: 'GET',
127
+ url: `/users/me`,
128
+ queryParams,
96
129
  });
97
130
  }
98
131