Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@internxt/sdk",
"author": "Internxt <[email protected]>",
"version": "1.9.7",
"version": "1.9.8",
"description": "An sdk for interacting with Internxt's services",
"repository": {
"type": "git",
Expand Down
27 changes: 27 additions & 0 deletions src/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ export class Auth {
}

/**
* @deprecated Use `sendUserDeactivationEmail` instead.
* Sends request to send the email to delete the account
* @param email
*/
Expand All @@ -313,13 +314,39 @@ export class Auth {
}

/**
* Sends request to send the email to delete the account
*/
public sendUserDeactivationEmail(token?: Token): Promise<void> {
return this.client.post(
'/users/deactivation/send',
{},
this.headersWithToken(token ?? <string>this.apiSecurity?.token),
);
}

/**
* @deprecated Use `confirmUserDeactivation` instead.
* Confirms the account deactivation
* @param token
*/
public confirmDeactivation(token: string): Promise<void> {
return this.client.get(`/confirmDeactivation/${token}`, this.basicHeaders());
}

/**
* Confirms the account deactivation
* @param token
*/
public confirmUserDeactivation(deactivationToken: string, token?: string): Promise<void> {
return this.client.post(
'/users/deactivation/confirm',
{
token: deactivationToken,
},
this.headersWithToken(token ?? <string>this.apiSecurity?.token),
);
}

/**
* Check credentials
* @param hashedPassword
Expand Down
38 changes: 38 additions & 0 deletions src/drive/users/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export class Users {
}

/**
* @deprecated Use `updateUserProfile` instead.
* Updates a user profile
* @param payload
*/
Expand All @@ -162,6 +163,19 @@ export class Users {
}

/**
* Updates a user profile
* @param payload
*/
public updateUserProfile(payload: UpdateProfilePayload, token?: Token) {
return this.client.patch<void>(
'/users/profile',
payload,
this.headersWithToken(token ?? <string>this.apiSecurity?.token),
);
}

/**
* @deprecated Use `updateUserAvatar` instead.
* Updates a user avatar
* @param payload
*/
Expand All @@ -173,11 +187,35 @@ export class Users {
}

/**
* Updates a user avatar
* @param payload
*/
public updateUserAvatar(payload: { avatar: Blob }, token?: Token) {
const formData = new FormData();
formData.set('avatar', payload.avatar);

return this.client.put<{ avatar: string }>(
'/users/avatar',
formData,
this.headersWithToken(token ?? <string>this.apiSecurity?.token),
);
}

/**
* @deprecated Use `deleteUserAvatar` instead.
* Delete current user avatar
*/
public deleteAvatar() {
return this.client.delete<void>('/user/avatar', this.headers());
}

/**
* Delete current user avatar
*/
public deleteUserAvatar(token?: Token) {
return this.client.delete<void>('/users/avatar', this.headersWithToken(token ?? <string>this.apiSecurity?.token));
}

/**
* Gets all friend invites created by this user
*/
Expand Down