@steffesgroup/steffes-auth
Advanced tools
Comparing version
@@ -57,2 +57,4 @@ import { AxiosInstance, AxiosRequestConfig, AxiosResponse, CancelToken } from 'axios'; | ||
changeAddress(address: Address): Promise<boolean>; | ||
updatePassword(updatePasswordDTO: UpdatePasswordDTO): Promise<boolean>; | ||
updateProfile(updateUserDTO: UpdateUserDTO): Promise<boolean>; | ||
} | ||
@@ -76,2 +78,6 @@ export declare class UserClient extends AuthorizedApiBase implements IUserClient { | ||
protected processChangeAddress(response: AxiosResponse): Promise<boolean>; | ||
updatePassword(updatePasswordDTO: UpdatePasswordDTO, cancelToken?: CancelToken | undefined): Promise<boolean>; | ||
protected processUpdatePassword(response: AxiosResponse): Promise<boolean>; | ||
updateProfile(updateUserDTO: UpdateUserDTO, cancelToken?: CancelToken | undefined): Promise<boolean>; | ||
protected processUpdateProfile(response: AxiosResponse): Promise<boolean>; | ||
} | ||
@@ -269,2 +275,32 @@ export declare class TokenDTO implements ITokenDTO { | ||
} | ||
export declare class UpdatePasswordDTO implements IUpdatePasswordDTO { | ||
oldPassword?: string | undefined; | ||
newPassword?: string | undefined; | ||
constructor(data?: IUpdatePasswordDTO); | ||
init(_data?: any): void; | ||
static fromJS(data: any): UpdatePasswordDTO; | ||
toJSON(data?: any): any; | ||
} | ||
export interface IUpdatePasswordDTO { | ||
oldPassword?: string | undefined; | ||
newPassword?: string | undefined; | ||
} | ||
export declare class UpdateUserDTO implements IUpdateUserDTO { | ||
firstName?: string | undefined; | ||
lastName?: string | undefined; | ||
email?: string | undefined; | ||
industry?: string | undefined; | ||
company?: string | undefined; | ||
constructor(data?: IUpdateUserDTO); | ||
init(_data?: any): void; | ||
static fromJS(data: any): UpdateUserDTO; | ||
toJSON(data?: any): any; | ||
} | ||
export interface IUpdateUserDTO { | ||
firstName?: string | undefined; | ||
lastName?: string | undefined; | ||
email?: string | undefined; | ||
industry?: string | undefined; | ||
company?: string | undefined; | ||
} | ||
export interface FileResponse { | ||
@@ -271,0 +307,0 @@ data: Blob; |
166
dist/api.js
@@ -11,3 +11,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.IConfig = exports.ApiException = exports.UpdatePhoneDTO = exports.VerifyPhoneDTO = exports.CreateUserDTO = exports.RegistrationState = exports.UserDTO = exports.Address = exports.RegisterUserDTO = exports.VerifyTwoFactorDTO = exports.RefreshTokenDTO = exports.LoginDTO = exports.TokenDTO = exports.UserClient = exports.RegisterClient = exports.AuthClient = exports.AuthorizedApiBase = void 0; | ||
exports.IConfig = exports.ApiException = exports.UpdateUserDTO = exports.UpdatePasswordDTO = exports.UpdatePhoneDTO = exports.VerifyPhoneDTO = exports.CreateUserDTO = exports.RegistrationState = exports.UserDTO = exports.Address = exports.RegisterUserDTO = exports.VerifyTwoFactorDTO = exports.RefreshTokenDTO = exports.LoginDTO = exports.TokenDTO = exports.UserClient = exports.RegisterClient = exports.AuthClient = exports.AuthorizedApiBase = void 0; | ||
const axios_1 = require("axios"); | ||
@@ -807,2 +807,102 @@ class AuthorizedApiBase { | ||
} | ||
updatePassword(updatePasswordDTO, cancelToken) { | ||
let url_ = this.baseUrl + "/api/v1/User/Update/Password"; | ||
url_ = url_.replace(/[?&]$/, ""); | ||
const content_ = JSON.stringify(updatePasswordDTO); | ||
let options_ = { | ||
data: content_, | ||
method: "PUT", | ||
url: url_, | ||
headers: { | ||
"Content-Type": "application/json", | ||
"Accept": "application/json" | ||
}, | ||
cancelToken | ||
}; | ||
return this.transformOptions(options_).then(transformedOptions_ => { | ||
return this.instance.request(transformedOptions_); | ||
}).catch((_error) => { | ||
if (isAxiosError(_error) && _error.response) { | ||
return _error.response; | ||
} | ||
else { | ||
throw _error; | ||
} | ||
}).then((_response) => { | ||
return this.processUpdatePassword(_response); | ||
}); | ||
} | ||
processUpdatePassword(response) { | ||
const status = response.status; | ||
let _headers = {}; | ||
if (response.headers && typeof response.headers === "object") { | ||
for (let k in response.headers) { | ||
if (response.headers.hasOwnProperty(k)) { | ||
_headers[k] = response.headers[k]; | ||
} | ||
} | ||
} | ||
if (status === 200) { | ||
const _responseText = response.data; | ||
let result200 = null; | ||
let resultData200 = _responseText; | ||
result200 = resultData200 !== undefined ? resultData200 : null; | ||
return result200; | ||
} | ||
else if (status !== 200 && status !== 204) { | ||
const _responseText = response.data; | ||
return throwException("An unexpected server error occurred.", status, _responseText, _headers); | ||
} | ||
return Promise.resolve(null); | ||
} | ||
updateProfile(updateUserDTO, cancelToken) { | ||
let url_ = this.baseUrl + "/api/v1/User/Update/Profile"; | ||
url_ = url_.replace(/[?&]$/, ""); | ||
const content_ = JSON.stringify(updateUserDTO); | ||
let options_ = { | ||
data: content_, | ||
method: "PUT", | ||
url: url_, | ||
headers: { | ||
"Content-Type": "application/json", | ||
"Accept": "application/json" | ||
}, | ||
cancelToken | ||
}; | ||
return this.transformOptions(options_).then(transformedOptions_ => { | ||
return this.instance.request(transformedOptions_); | ||
}).catch((_error) => { | ||
if (isAxiosError(_error) && _error.response) { | ||
return _error.response; | ||
} | ||
else { | ||
throw _error; | ||
} | ||
}).then((_response) => { | ||
return this.processUpdateProfile(_response); | ||
}); | ||
} | ||
processUpdateProfile(response) { | ||
const status = response.status; | ||
let _headers = {}; | ||
if (response.headers && typeof response.headers === "object") { | ||
for (let k in response.headers) { | ||
if (response.headers.hasOwnProperty(k)) { | ||
_headers[k] = response.headers[k]; | ||
} | ||
} | ||
} | ||
if (status === 200) { | ||
const _responseText = response.data; | ||
let result200 = null; | ||
let resultData200 = _responseText; | ||
result200 = resultData200 !== undefined ? resultData200 : null; | ||
return result200; | ||
} | ||
else if (status !== 200 && status !== 204) { | ||
const _responseText = response.data; | ||
return throwException("An unexpected server error occurred.", status, _responseText, _headers); | ||
} | ||
return Promise.resolve(null); | ||
} | ||
} | ||
@@ -1188,2 +1288,66 @@ exports.UserClient = UserClient; | ||
exports.UpdatePhoneDTO = UpdatePhoneDTO; | ||
class UpdatePasswordDTO { | ||
constructor(data) { | ||
if (data) { | ||
for (var property in data) { | ||
if (data.hasOwnProperty(property)) | ||
this[property] = data[property]; | ||
} | ||
} | ||
} | ||
init(_data) { | ||
if (_data) { | ||
this.oldPassword = _data["oldPassword"]; | ||
this.newPassword = _data["newPassword"]; | ||
} | ||
} | ||
static fromJS(data) { | ||
data = typeof data === 'object' ? data : {}; | ||
let result = new UpdatePasswordDTO(); | ||
result.init(data); | ||
return result; | ||
} | ||
toJSON(data) { | ||
data = typeof data === 'object' ? data : {}; | ||
data["oldPassword"] = this.oldPassword; | ||
data["newPassword"] = this.newPassword; | ||
return data; | ||
} | ||
} | ||
exports.UpdatePasswordDTO = UpdatePasswordDTO; | ||
class UpdateUserDTO { | ||
constructor(data) { | ||
if (data) { | ||
for (var property in data) { | ||
if (data.hasOwnProperty(property)) | ||
this[property] = data[property]; | ||
} | ||
} | ||
} | ||
init(_data) { | ||
if (_data) { | ||
this.firstName = _data["firstName"]; | ||
this.lastName = _data["lastName"]; | ||
this.email = _data["email"]; | ||
this.industry = _data["industry"]; | ||
this.company = _data["company"]; | ||
} | ||
} | ||
static fromJS(data) { | ||
data = typeof data === 'object' ? data : {}; | ||
let result = new UpdateUserDTO(); | ||
result.init(data); | ||
return result; | ||
} | ||
toJSON(data) { | ||
data = typeof data === 'object' ? data : {}; | ||
data["firstName"] = this.firstName; | ||
data["lastName"] = this.lastName; | ||
data["email"] = this.email; | ||
data["industry"] = this.industry; | ||
data["company"] = this.company; | ||
return data; | ||
} | ||
} | ||
exports.UpdateUserDTO = UpdateUserDTO; | ||
class ApiException extends Error { | ||
@@ -1190,0 +1354,0 @@ constructor(message, status, response, headers, result) { |
{ | ||
"name": "@steffesgroup/steffes-auth", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "Steffes Auth", | ||
@@ -5,0 +5,0 @@ "main": "dist/api.js", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
65634
12.28%1718
13.18%1
Infinity%