From 67bc503391d315b3fa007e259593c08e6e6f8ae3 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Mon, 30 Jan 2023 18:03:30 -0500 Subject: [PATCH] rename "apiAuth" to "login" --- .../apis/favorites/favorites-api.ts | 10 +++--- .../repo-client/apis/nodes/nodes-api.ts | 32 +++++++++---------- .../repo-client/apis/queries/queries-api.ts | 4 +-- .../utilities/repo-client/apis/repo-api.ts | 2 +- .../repo-client/apis/search/search-api.ts | 6 ++-- .../apis/shared-links/shared-links-api.ts | 6 ++-- .../repo-client/apis/sites/sites-api.ts | 24 +++++++------- .../repo-client/apis/upload/upload-api.ts | 4 +-- 8 files changed, 44 insertions(+), 44 deletions(-) diff --git a/projects/aca-testing-shared/src/utilities/repo-client/apis/favorites/favorites-api.ts b/projects/aca-testing-shared/src/utilities/repo-client/apis/favorites/favorites-api.ts index 728efd7e9..90e8611b6 100755 --- a/projects/aca-testing-shared/src/utilities/repo-client/apis/favorites/favorites-api.ts +++ b/projects/aca-testing-shared/src/utilities/repo-client/apis/favorites/favorites-api.ts @@ -57,7 +57,7 @@ export class FavoritesApi extends RepoApi { async addFavoriteById(nodeType: 'file' | 'folder' | 'site', id: string): Promise { let guid; try { - await this.apiAuth(); + await this.login(); if (nodeType === 'site') { guid = (await this.sitesApi.getSite(id)).entry.guid; } else { @@ -94,7 +94,7 @@ export class FavoritesApi extends RepoApi { async getFavorites() { try { - await this.apiAuth(); + await this.login(); return await this.favoritesApi.listFavorites(this.username); } catch (error) { this.handleError(`FavoritesApi getFavorites : catch : `, error); @@ -104,7 +104,7 @@ export class FavoritesApi extends RepoApi { async getFavoritesTotalItems(): Promise { try { - await this.apiAuth(); + await this.login(); return (await this.favoritesApi.listFavorites(this.username)).list.pagination.totalItems; } catch (error) { this.handleError(`FavoritesApi getFavoritesTotalItems : catch : `, error); @@ -114,7 +114,7 @@ export class FavoritesApi extends RepoApi { async getFavoriteById(nodeId: string) { try { - await this.apiAuth(); + await this.login(); return await this.favoritesApi.getFavorite('-me-', nodeId); } catch (error) { this.handleError(`FavoritesApi getFavoriteById : catch : `, error); @@ -149,7 +149,7 @@ export class FavoritesApi extends RepoApi { async removeFavoriteById(nodeId: string) { try { - await this.apiAuth(); + await this.login(); return await this.favoritesApi.deleteFavorite('-me-', nodeId); } catch (error) { this.handleError(`FavoritesApi removeFavoriteById : catch : `, error); diff --git a/projects/aca-testing-shared/src/utilities/repo-client/apis/nodes/nodes-api.ts b/projects/aca-testing-shared/src/utilities/repo-client/apis/nodes/nodes-api.ts index f1c912976..0c66e081c 100755 --- a/projects/aca-testing-shared/src/utilities/repo-client/apis/nodes/nodes-api.ts +++ b/projects/aca-testing-shared/src/utilities/repo-client/apis/nodes/nodes-api.ts @@ -38,7 +38,7 @@ export class NodesApi extends RepoApi { async getNodeByPath(relativePath: string = '/', parentFolderId: string = '-my-'): Promise { try { - await this.apiAuth(); + await this.login(); return await this.nodesApi.getNode(parentFolderId, { relativePath }); } catch (error) { this.handleError(`${this.constructor.name} ${this.getNodeByPath.name}`, error); @@ -48,7 +48,7 @@ export class NodesApi extends RepoApi { async getNodeById(id: string): Promise { try { - await this.apiAuth(); + await this.login(); return await this.nodesApi.getNode(id); } catch (error) { this.handleError(`${this.constructor.name} ${this.getNodeById.name}`, error); @@ -148,7 +148,7 @@ export class NodesApi extends RepoApi { async deleteNodeById(id: string, permanent: boolean = true): Promise { try { - await this.apiAuth(); + await this.login(); await this.nodesApi.deleteNode(id, { permanent }); } catch (error) { this.handleError(`${this.constructor.name} ${this.deleteNodeById.name}`, error); @@ -191,7 +191,7 @@ export class NodesApi extends RepoApi { const opts = { include: ['properties'] }; - await this.apiAuth(); + await this.login(); return await this.nodesApi.listNodeChildren(nodeId, opts); } catch (error) { this.handleError(`${this.constructor.name} ${this.getNodeChildren.name}`, error); @@ -256,7 +256,7 @@ export class NodesApi extends RepoApi { } try { - await this.apiAuth(); + await this.login(); return await this.nodesApi.createNode(parentId, nodeBody, { majorVersion }); @@ -310,7 +310,7 @@ export class NodesApi extends RepoApi { async createChildren(data: NodeBodyCreate[]): Promise { try { - await this.apiAuth(); + await this.login(); return await this.nodesApi.createNode('-my-', data as any); } catch (error) { this.handleError(`${this.constructor.name} ${this.createChildren.name}`, error); @@ -343,7 +343,7 @@ export class NodesApi extends RepoApi { async addAspects(nodeId: string, aspectNames: string[]): Promise { try { - await this.apiAuth(); + await this.login(); return this.nodesApi.updateNode(nodeId, { aspectNames }); } catch (error) { this.handleError(`${this.constructor.name} ${this.addAspects.name}`, error); @@ -362,7 +362,7 @@ export class NodesApi extends RepoApi { }; try { - await this.apiAuth(); + await this.login(); const link = await this.nodesApi.createNode(destinationId, nodeBody); await this.addAspects(originalNodeId, ['app:linked']); return link; @@ -386,7 +386,7 @@ export class NodesApi extends RepoApi { }; try { - await this.apiAuth(); + await this.login(); const link = await this.nodesApi.createNode(destinationId, nodeBody); await this.addAspects(originalNodeId, ['app:linked']); return link; @@ -399,7 +399,7 @@ export class NodesApi extends RepoApi { // node content async getNodeContent(nodeId: string): Promise { try { - await this.apiAuth(); + await this.login(); return await this.nodesApi.getNodeContent(nodeId); } catch (error) { this.handleError(`${this.constructor.name} ${this.getNodeContent.name}`, error); @@ -419,7 +419,7 @@ export class NodesApi extends RepoApi { comment, name: newName }; - await this.apiAuth(); + await this.login(); return await this.nodesApi.updateNodeContent(nodeId, content, opts); } catch (error) { this.handleError(`${this.constructor.name} ${this.updateNodeContent.name}`, error); @@ -429,7 +429,7 @@ export class NodesApi extends RepoApi { async renameNode(nodeId: string, newName: string): Promise { try { - await this.apiAuth(); + await this.login(); return this.nodesApi.updateNode(nodeId, { name: newName }); } catch (error) { this.handleError(`${this.constructor.name} ${this.renameNode.name}`, error); @@ -446,7 +446,7 @@ export class NodesApi extends RepoApi { }; try { - await this.apiAuth(); + await this.login(); return await this.nodesApi.updateNode(nodeId, data); } catch (error) { this.handleError(`${this.constructor.name} ${this.setGranularPermission.name}`, error); @@ -468,7 +468,7 @@ export class NodesApi extends RepoApi { }; try { - await this.apiAuth(); + await this.login(); return await this.nodesApi.updateNode(nodeId, data); } catch (error) { this.handleError(`${this.constructor.name} ${this.setGranularPermission.name}`, error); @@ -483,7 +483,7 @@ export class NodesApi extends RepoApi { } as NodeBodyLock; try { - await this.apiAuth(); + await this.login(); return await this.nodesApi.lockNode(nodeId, data); } catch (error) { this.handleError(`${this.constructor.name} ${this.lockFile.name}`, error); @@ -494,7 +494,7 @@ export class NodesApi extends RepoApi { /* @deprecated check {UserActions.unlockNodes} instead. */ async unlockFile(nodeId: string): Promise { try { - await this.apiAuth(); + await this.login(); return await this.nodesApi.unlockNode(nodeId); } catch (error) { this.handleError(`${this.constructor.name} ${this.unlockFile.name}`, error); diff --git a/projects/aca-testing-shared/src/utilities/repo-client/apis/queries/queries-api.ts b/projects/aca-testing-shared/src/utilities/repo-client/apis/queries/queries-api.ts index c14872eec..2814cd8f9 100755 --- a/projects/aca-testing-shared/src/utilities/repo-client/apis/queries/queries-api.ts +++ b/projects/aca-testing-shared/src/utilities/repo-client/apis/queries/queries-api.ts @@ -42,7 +42,7 @@ export class QueriesApi extends RepoApi { }; try { - await this.apiAuth(); + await this.login(); return this.queriesApi.findSites(searchTerm, data); } catch (error) { this.handleError(`QueriesApi findSites : catch : `, error); @@ -66,7 +66,7 @@ export class QueriesApi extends RepoApi { }; try { - await this.apiAuth(); + await this.login(); return this.queriesApi.findNodes(searchTerm, data); } catch (error) { this.handleError(`QueriesApi findNodes : catch : `, error); diff --git a/projects/aca-testing-shared/src/utilities/repo-client/apis/repo-api.ts b/projects/aca-testing-shared/src/utilities/repo-client/apis/repo-api.ts index bfcee12fb..699b1a7ed 100644 --- a/projects/aca-testing-shared/src/utilities/repo-client/apis/repo-api.ts +++ b/projects/aca-testing-shared/src/utilities/repo-client/apis/repo-api.ts @@ -34,7 +34,7 @@ export abstract class RepoApi { this.alfrescoJsApi.setConfig(browser.params.config); } - apiAuth(): Promise { + login(): Promise { return this.alfrescoJsApi.login(this.username, this.password); } diff --git a/projects/aca-testing-shared/src/utilities/repo-client/apis/search/search-api.ts b/projects/aca-testing-shared/src/utilities/repo-client/apis/search/search-api.ts index 83fbc76fe..91658c344 100755 --- a/projects/aca-testing-shared/src/utilities/repo-client/apis/search/search-api.ts +++ b/projects/aca-testing-shared/src/utilities/repo-client/apis/search/search-api.ts @@ -49,7 +49,7 @@ export class SearchApi extends RepoApi { }; try { - await this.apiAuth(); + await this.login(); return this.searchApi.search(data); } catch (error) { this.handleError(`SearchApi queryRecentFiles : catch : `, error); @@ -76,7 +76,7 @@ export class SearchApi extends RepoApi { }; try { - await this.apiAuth(); + await this.login(); return this.searchApi.search(data); } catch (error) { this.handleError(`SearchApi queryNodesNames : catch : `, error); @@ -103,7 +103,7 @@ export class SearchApi extends RepoApi { }; try { - await this.apiAuth(); + await this.login(); return this.searchApi.search(data); } catch (error) { this.handleError(`SearchApi queryNodesExactNames : catch : `, error); diff --git a/projects/aca-testing-shared/src/utilities/repo-client/apis/shared-links/shared-links-api.ts b/projects/aca-testing-shared/src/utilities/repo-client/apis/shared-links/shared-links-api.ts index 959be5b51..28e78e959 100755 --- a/projects/aca-testing-shared/src/utilities/repo-client/apis/shared-links/shared-links-api.ts +++ b/projects/aca-testing-shared/src/utilities/repo-client/apis/shared-links/shared-links-api.ts @@ -37,7 +37,7 @@ export class SharedLinksApi extends RepoApi { async shareFileById(id: string, expireDate?: Date): Promise { try { - await this.apiAuth(); + await this.login(); const data = { nodeId: id, expiresAt: expireDate @@ -86,7 +86,7 @@ export class SharedLinksApi extends RepoApi { async getSharedLinks(maxItems: number = 250): Promise { try { - await this.apiAuth(); + await this.login(); const opts = { maxItems }; @@ -99,7 +99,7 @@ export class SharedLinksApi extends RepoApi { async getSharedLinksTotalItems(): Promise { try { - await this.apiAuth(); + await this.login(); const opts = { maxItems: 250 }; diff --git a/projects/aca-testing-shared/src/utilities/repo-client/apis/sites/sites-api.ts b/projects/aca-testing-shared/src/utilities/repo-client/apis/sites/sites-api.ts index 07884ecec..66146ad52 100755 --- a/projects/aca-testing-shared/src/utilities/repo-client/apis/sites/sites-api.ts +++ b/projects/aca-testing-shared/src/utilities/repo-client/apis/sites/sites-api.ts @@ -46,7 +46,7 @@ export class SitesApi extends RepoApi { async getSite(siteId: string) { try { - await this.apiAuth(); + await this.login(); return await this.sitesApi.getSite(siteId); } catch (error) { this.handleError(`SitesApi getSite : catch : `, error); @@ -56,7 +56,7 @@ export class SitesApi extends RepoApi { async getSites() { try { - await this.apiAuth(); + await this.login(); return await this.sitesApi.listSiteMembershipsForPerson(this.username); } catch (error) { this.handleError(`SitesApi getSites : catch : `, error); @@ -66,7 +66,7 @@ export class SitesApi extends RepoApi { async getSitesTotalItems(): Promise { try { - await this.apiAuth(); + await this.login(); return (await this.sitesApi.listSiteMembershipsForPerson(this.username)).list.pagination.totalItems; } catch (error) { this.handleError(`SitesApi getSitesTotalItems : catch : `, error); @@ -76,7 +76,7 @@ export class SitesApi extends RepoApi { async getDocLibId(siteId: string): Promise { try { - await this.apiAuth(); + await this.login(); return (await this.sitesApi.listSiteContainers(siteId)).list.entries[0].entry.id; } catch (error) { this.handleError(`SitesApi getDocLibId : catch : `, error); @@ -123,7 +123,7 @@ export class SitesApi extends RepoApi { } as SiteBody; try { - await this.apiAuth(); + await this.login(); return await this.sitesApi.createSite(site); } catch (error) { this.handleError(`SitesApi createSite : catch : `, error); @@ -160,7 +160,7 @@ export class SitesApi extends RepoApi { async deleteSite(siteId: string, permanent: boolean = true) { try { - await this.apiAuth(); + await this.login(); return await this.sitesApi.deleteSite(siteId, { permanent }); } catch (error) { this.handleError(`SitesApi deleteSite : catch : `, error); @@ -170,7 +170,7 @@ export class SitesApi extends RepoApi { async deleteSites(siteIds: string[], permanent: boolean = true) { try { if (siteIds && siteIds.length > 0) { - await this.apiAuth(); + await this.login(); for (const siteId of siteIds) { await this.sitesApi.deleteSite(siteId, { permanent }); @@ -200,7 +200,7 @@ export class SitesApi extends RepoApi { } as SiteMemberRoleBody; try { - await this.apiAuth(); + await this.login(); return await this.sitesApi.updateSiteMembership(siteId, userId, siteRole); } catch (error) { this.handleError(`SitesApi updateSiteMember : catch : `, error); @@ -215,7 +215,7 @@ export class SitesApi extends RepoApi { } as SiteMemberBody; try { - await this.apiAuth(); + await this.login(); return await this.sitesApi.createSiteMembership(siteId, memberBody); } catch (error) { if (error.status === 409) { @@ -245,7 +245,7 @@ export class SitesApi extends RepoApi { async deleteSiteMember(siteId: string, userId: string) { try { - await this.apiAuth(); + await this.login(); return await this.sitesApi.deleteSiteMembership(siteId, userId); } catch (error) { this.handleError(`SitesApi deleteSiteMember : catch : `, error); @@ -258,7 +258,7 @@ export class SitesApi extends RepoApi { }; try { - await this.apiAuth(); + await this.login(); return await this.sitesApi.createSiteMembershipRequestForPerson('-me-', body); } catch (error) { this.handleError(`SitesApi requestToJoin : catch : `, error); @@ -268,7 +268,7 @@ export class SitesApi extends RepoApi { async hasMembershipRequest(siteId: string) { try { - await this.apiAuth(); + await this.login(); const requests = (await this.sitesApi.getSiteMembershipRequests('-me-')).list.entries.map((e) => e.entry.id); return requests.includes(siteId); } catch (error) { diff --git a/projects/aca-testing-shared/src/utilities/repo-client/apis/upload/upload-api.ts b/projects/aca-testing-shared/src/utilities/repo-client/apis/upload/upload-api.ts index 0597c4bb3..cf5cab24e 100644 --- a/projects/aca-testing-shared/src/utilities/repo-client/apis/upload/upload-api.ts +++ b/projects/aca-testing-shared/src/utilities/repo-client/apis/upload/upload-api.ts @@ -44,7 +44,7 @@ export class UploadApi extends RepoApi { }; try { - await this.apiAuth(); + await this.login(); return await this.upload.uploadFile(file, '', parentFolderId, null, opts); } catch (error) { this.handleError(`${this.constructor.name} ${this.uploadFile.name}`, error); @@ -66,7 +66,7 @@ export class UploadApi extends RepoApi { }; try { - await this.apiAuth(); + await this.login(); return await this.upload.uploadFile(file, '', parentId, nodeProps, opts); } catch (error) { this.handleError(`${this.constructor.name} ${this.uploadFileWithRename.name}`, error);