Skip to content

Commit

Permalink
Corrections for linter
Browse files Browse the repository at this point in the history
  • Loading branch information
danilobispo committed Oct 27, 2023
1 parent 60d5679 commit 455634f
Show file tree
Hide file tree
Showing 3 changed files with 253 additions and 252 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ exports.AmpliaErrorCodes = AmpliaErrorCodes;
exports.HttpMethods = HttpMethods;
exports.IssueCertificateRequest = IssueCertificateRequest;
exports.IssuePkcs12CertificateRequest = IssuePkcs12CertificateRequest;
exports.IssuePkcs12CertificateResponse = IssuePkcs12CertificateResponse;
exports.Order = Order;
exports.OrderLocketError = OrderLocketError;
exports.BaseOrder = BaseOrder;
Expand Down
106 changes: 53 additions & 53 deletions lib/amplia-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ class AmpliaClient {
}

/**
* Creates a certificate order in Amplia
*
* @param {CreateOrderRequest} request the request containing information
* about the order to be created
* @returns {Order} the representation of the created order
*/
* Creates a certificate order in Amplia
*
* @param {CreateOrderRequest} request the request containing information
* about the order to be created
* @returns {Order} the representation of the created order
*/
createOrder(request) {
return new Promise((resolve, reject) => {
if (!request) {
Expand All @@ -70,12 +70,12 @@ class AmpliaClient {
}

/**
* Creates a RSA Key in Amplia
*
* @param {CreateKeyRequest} request the request containing information
* about the key to be created
* @returns {KeyModel} the representation of the created order
*/
* Creates a RSA Key in Amplia
*
* @param {CreateKeyRequest} request the request containing information
* about the key to be created
* @returns {KeyModel} the representation of the created order
*/
async createRSAKey(request) {
if (!request) {
throw new Error('The request was not set');
Expand All @@ -93,12 +93,12 @@ class AmpliaClient {
}

/**
* Creates a RSA Protected Key in Amplia
*
* @param {CreateProtectedKeyRequest} request the request containing information
* about the key to be created
* @returns {KeyModel} the representation of the created order
*/
* Creates a RSA Protected Key in Amplia
*
* @param {CreateProtectedKeyRequest} request the request containing information
* about the key to be created
* @returns {KeyModel} the representation of the created order
*/
async createRSAProtectedKey(request) {
if (!request) {
throw new Error('The request was not set');
Expand All @@ -116,13 +116,13 @@ class AmpliaClient {
}

/**
* Signs a hash with the assigned keyId
*
* @param {string} keyId the ID of the desired key
* @param {SignHashRequest} request the request containing info about
* the hash to be signed
* @returns {SignHashResponse} the response returned
*/
* Signs a hash with the assigned keyId
*
* @param {string} keyId the ID of the desired key
* @param {SignHashRequest} request the request containing info about
* the hash to be signed
* @returns {SignHashResponse} the response returned
*/
signHashWithKey(keyId, request) {
return new Promise((resolve, reject) => {
if (!request) {
Expand All @@ -145,11 +145,11 @@ class AmpliaClient {
}

/**
* Retrieves an order from Amplia
*
* @param {string} orderId the ID of the desired order
* @returns {Order} the desired order
*/
* Retrieves an order from Amplia
*
* @param {string} orderId the ID of the desired order
* @returns {Order} the desired order
*/
getOrder(orderId) {
return new Promise((resolve, reject) => {
if (!orderId) {
Expand Down Expand Up @@ -192,10 +192,10 @@ class AmpliaClient {
}

/**
* Deletes an order in Amplia
*
* @param {string} orderId the ID of the desired order
*/
* Deletes an order in Amplia
*
* @param {string} orderId the ID of the desired order
*/
deleteOrder(orderId) {
return new Promise((resolve, reject) => {
if (!orderId) {
Expand All @@ -211,12 +211,12 @@ class AmpliaClient {
}

/**
* Issues a certificate order from Amplia
*
* @param {string} orderId the ID of the desired order
* @returns {Order} the desired order
* @param {string} keyId the ID of the desired key
*/
* Issues a certificate order from Amplia
*
* @param {string} orderId the ID of the desired order
* @returns {Order} the desired order
* @param {string} keyId the ID of the desired key
*/
issueCertificate(orderId, csr, keyMedia = null, keyId = null) {
return new Promise((resolve, reject) => {
let client = this._getRestClient();
Expand All @@ -234,17 +234,17 @@ class AmpliaClient {
}

/**
* Issues a PKCS#12 certificate order from Amplia
*
* @param {string} orderId the ID of the desired order
* @param {string} password the password for the PKCS#12 certificate
* Issues a PKCS#12 certificate order from Amplia
*
* @param {string} orderId the ID of the desired order
* @param {string} password the password for the PKCS#12 certificate
* @param {number} keySize the size of the key for this certificate
* @returns {IssuePkcs12CertificateResponse} the response containing the .PFX file
*/
issuePkcs12Certificate(orderId, password, keySize = null) {
* @returns {IssuePkcs12CertificateResponse} the response containing the .PFX file
*/
issuePkcs12Certificate(orderId, password, keySize = null) {
return new Promise((resolve, reject) => {
let client = this._getRestClient();
let request = new IssuePkcs12CertificateRequest({orderId, password, keySize});
let request = new IssuePkcs12CertificateRequest({ orderId, password, keySize });

client
.post('api/certificates/pkcs12', request)
Expand All @@ -265,7 +265,7 @@ class AmpliaClient {
return new Promise((resolve, reject) => {
if (
searchParams &&
!(searchParams instanceof PaginatedSearchParams)
!(searchParams instanceof PaginatedSearchParams)
) {
throw new Error(
'The "searchParams" parameter is not a instance of the PaginatedSearchParams class.'
Expand Down Expand Up @@ -325,10 +325,10 @@ class AmpliaClient {
static _setPaginatedSearchParams(originalUri, searchParams) {
return (
`${originalUri}?` +
`q=${encodeURIComponent(searchParams.getQ())}&` +
`limit=${searchParams.getLimit()}&` +
`offset=${searchParams.getOffset()}&` +
`order=${searchParams.getOrder()}`
`q=${encodeURIComponent(searchParams.getQ())}&` +
`limit=${searchParams.getLimit()}&` +
`offset=${searchParams.getOffset()}&` +
`order=${searchParams.getOrder()}`
);
}

Expand Down
Loading

0 comments on commit 455634f

Please sign in to comment.