@parra/parra-js-sdk 0.3.11 → 0.3.12

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,16 +3,23 @@ export interface Size {
3
3
  width: number;
4
4
  height: number;
5
5
  }
6
- export interface UploadImageAssetRequestBody {
6
+ export interface UploadUserAvatarRequestBody {
7
+ image: File;
8
+ }
9
+ export interface UploadImageAssetForTenantRequestBody {
7
10
  group: string;
8
11
  image: File;
9
12
  }
13
+ export interface ImageAssetStub {
14
+ id: string;
15
+ size: Size;
16
+ url: string;
17
+ }
10
18
  export interface ImageAsset {
11
19
  id: string;
12
20
  created_at: string;
13
21
  updated_at: string;
14
22
  deleted_at?: string | null;
15
- tenant_id: string;
16
23
  size: Size;
17
24
  url: string;
18
25
  bucket: string;
@@ -306,7 +313,7 @@ export interface TeamMember {
306
313
  user_id?: string | null;
307
314
  name: string;
308
315
  email: string;
309
- avatar_url?: string;
316
+ avatar?: ImageAssetStub;
310
317
  }
311
318
  export type TeamMemberListResponse = Array<TeamMember>;
312
319
  export interface AnswerData {
@@ -1195,9 +1202,9 @@ export interface UserResponse {
1195
1202
  last_name?: string | null;
1196
1203
  email?: string | null;
1197
1204
  email_verified?: boolean;
1198
- avatar_url?: string | null;
1199
1205
  locale?: string | null;
1200
1206
  type: string;
1207
+ avatar?: ImageAssetStub;
1201
1208
  }
1202
1209
  export interface CreateIdentityRequestBody {
1203
1210
  provider: string;
@@ -1217,7 +1224,6 @@ export interface CreateUserRequestBody {
1217
1224
  last_name?: string | null;
1218
1225
  email?: string | null;
1219
1226
  email_verified?: boolean;
1220
- avatar_url?: string | null;
1221
1227
  locale?: string | null;
1222
1228
  type: string;
1223
1229
  identities?: Array<CreateIdentityRequestBody>;
@@ -1251,7 +1257,8 @@ declare class ParraAPI {
1251
1257
  constructor(http: HTTPClient, options: {
1252
1258
  baseUrl: string;
1253
1259
  });
1254
- uploadImageAssetForTenantById: (tenant_id: string, body?: UploadImageAssetRequestBody) => Promise<ImageAsset>;
1260
+ uploadAvatarForUser: (body?: UploadUserAvatarRequestBody) => Promise<ImageAssetStub>;
1261
+ uploadImageAssetForTenantById: (tenant_id: string, body?: UploadImageAssetForTenantRequestBody) => Promise<ImageAsset>;
1255
1262
  createCustomer: (body?: CreateCustomerRequestBody) => Promise<Customer>;
1256
1263
  updateEntitlementsForCustomerById: (customer_id: string) => Promise<Response>;
1257
1264
  createBillingPortalSession: (tenant_id: string) => Promise<BillingPortalSession>;
@@ -1442,6 +1449,7 @@ declare class ParraAPI {
1442
1449
  getUserById: (user_id: string) => Promise<UserResponse>;
1443
1450
  updateUserById: (user_id: string, body: UpdateUserRequestBody) => Promise<UserResponse>;
1444
1451
  deleteUserById: (user_id: string) => Promise<Response>;
1452
+ updateAvatarForUserById: (user_id: string, body: ImageAssetStub) => Promise<Response>;
1445
1453
  createIdentityForUserById: (user_id: string, body: CreateIdentityRequestBody) => Promise<IdentityResponse>;
1446
1454
  listIdentitiesForUserById: (user_id: string) => Promise<Array<IdentityResponse>>;
1447
1455
  getUserByProviderAndProviderUserId: (provider: string, provider_user_id: string) => Promise<UserResponse>;
package/dist/ParraAPI.js CHANGED
@@ -113,6 +113,18 @@ var ParraAPI = /** @class */ (function () {
113
113
  var _this = this;
114
114
  this.http = http;
115
115
  this.options = options;
116
+ this.uploadAvatarForUser = function (body) {
117
+ var formData = new FormData();
118
+ Object.entries(body || {}).forEach(function (_a) {
119
+ var key = _a[0], value = _a[1];
120
+ formData.append(key, value);
121
+ });
122
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/users/avatar"), {
123
+ method: "post",
124
+ body: formData,
125
+ headers: {},
126
+ });
127
+ };
116
128
  this.uploadImageAssetForTenantById = function (tenant_id, body) {
117
129
  var formData = new FormData();
118
130
  Object.entries(body || {}).forEach(function (_a) {
@@ -709,6 +721,16 @@ var ParraAPI = /** @class */ (function () {
709
721
  method: "delete",
710
722
  });
711
723
  };
724
+ this.updateAvatarForUserById = function (user_id, body) {
725
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/users/").concat(user_id, "/avatar"), {
726
+ method: "post",
727
+ body: JSON.stringify(body),
728
+ headers: {
729
+ "content-type": "application/json",
730
+ },
731
+ raw: true,
732
+ });
733
+ };
712
734
  this.createIdentityForUserById = function (user_id, body) {
713
735
  return _this.http.execute("".concat(_this.options.baseUrl, "/v1/users/").concat(user_id, "/identities"), {
714
736
  method: "post",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parra/parra-js-sdk",
3
- "version": "0.3.11",
3
+ "version": "0.3.12",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",