Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs/typedoc improvements #369

Merged
merged 6 commits into from
Apr 2, 2024
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
5 changes: 2 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
"node": ">=14"
},
"scripts": {
"gen-docs": "npx typedoc --plugin typedoc-plugin-markdown --out temp_docs",
"gen-docs": "npx typedoc --plugin typedoc-plugin-markdown --out temp_docs",
"copy-changelog": "cp ../CHANGELOG.md temp_docs/changelog.md",
"remove-readme": "rm temp_docs/README.md",
"build": "yarn gen-docs && yarn copy-changelog && yarn remove-readme"
"build": "yarn gen-docs && yarn copy-changelog"
},
"devDependencies": {
"typedoc": "^0.25.12",
Expand Down
15 changes: 15 additions & 0 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// see https://www.typescriptlang.org/tsconfig to better understand tsconfigs
"include": ["../src"],
"compilerOptions": {
"lib": ["esnext"],
"allowJs": true,
"target": "esnext",
"resolveJsonModule": true,
// match output dir to input dir. e.g. dist/index instead of dist/src/index
"rootDir": "../",
// use Node's module resolution algorithm, instead of the legacy TS one
"moduleResolution": "nodenext",
"module": "nodenext",
}
}
24 changes: 21 additions & 3 deletions docs/typedoc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
{
"entryPoints": ["../src"],
"entryPoints": [
"../src"
],
"out": "doc",
"githubPages": false,
"exclude": ["**/errors/*.ts"]
}
"exclude": [
"**/errors/*.ts"
],
"categoryOrder": [
"*",
"Other",
],
"readme": "none",
"categorizeByGroup": true,
"excludeInternal": true,
"excludePrivate": true,
"excludeProtected": true,
"groupOrder": [
"Classes",
"Interfaces",
"*"
]
}
10 changes: 5 additions & 5 deletions examples/typescript/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ export const submitVote = (participant: Wallet, electionId: string, voteArray: (

/**
* Await to specific election to be ready
* @param client the specific client
* @param electionId election identifier to check
* @param delayTimeout delay until next check
* @param abortController mechanism used to abort de function execution. To use it:
* @param client - the specific client
* @param electionId - election identifier to check
* @param delayTimeout - delay until next check
* @param abortController - mechanism used to abort de function execution. To use it:
*
* ```ts
* let controller = new AbortController();
Expand Down Expand Up @@ -61,7 +61,7 @@ export const waitForElectionReady = (
}
return client.fetchElection(electionId);
})
.then((election) => {
.then(election => {
if (signal.aborted) {
throw new Error('Aborted');
}
Expand Down
44 changes: 18 additions & 26 deletions src/api/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,8 @@ export abstract class AccountAPI extends API {
/**
* Returns paginated list of accounts
*
* @param {string} url API endpoint URL
* @param {number} page The page number
* @returns {Promise<IAccountsListResponse>}
* @param url - API endpoint URL
* @param page - The page number
*/
public static list(url: string, page: number = 0): Promise<IAccountsListResponse> {
return axios
Expand All @@ -127,8 +126,7 @@ export abstract class AccountAPI extends API {
/**
* Returns the number of accounts
*
* @param {string} url API endpoint URL
* @returns {Promise<IAccountsCountResponse>}
* @param url - API endpoint URL
*/
public static count(url: string): Promise<IAccountsCountResponse> {
return axios
Expand All @@ -140,9 +138,8 @@ export abstract class AccountAPI extends API {
/**
* Fetches an Account information
*
* @param {string} url API endpoint URL
* @param {string} accountId The account we want the info from
* @returns {Promise<IAccountInfoResponse>}
* @param url - API endpoint URL
* @param accountId - The account we want the info from
*/
public static info(url: string, accountId: string): Promise<IAccountInfoResponse> {
return axios
Expand All @@ -154,9 +151,8 @@ export abstract class AccountAPI extends API {
/**
* Fetches the account metadata
*
* @param {string} url API endpoint URL
* @param {string} accountId The account we want the info from
* @returns {Promise<AccountMetadata>}
* @param url - API endpoint URL
* @param accountId - The account we want the info from
*/
public static metadata(url: string, accountId: string): Promise<AccountMetadata> {
return axios
Expand All @@ -168,10 +164,9 @@ export abstract class AccountAPI extends API {
/**
* Sets Account information
*
* @param {string} url API endpoint URL
* @param {string} payload The set information info raw payload to be submitted to the chain
* @param {string} metadata The base64 encoded metadata JSON object
* @returns {Promise<IAccountSetInfoResponse>}
* @param url - API endpoint URL
* @param payload - The set information info raw payload to be submitted to the chain
* @param metadata - The base64 encoded metadata JSON object
*/
public static setInfo(url: string, payload: string, metadata: string): Promise<IAccountSetInfoResponse> {
return axios
Expand All @@ -183,10 +178,9 @@ export abstract class AccountAPI extends API {
/**
* Returns paginated list of transfers for a specific account
*
* @param {string} url API endpoint URL
* @param {string} accountId accountId to get transfers
* @param {number} page The page number
* @returns {Promise<IAccountTransfersResponse>}
* @param url - API endpoint URL
* @param accountId - accountId to get transfers
* @param page - The page number
*/
public static transfersList(url: string, accountId: string, page: number = 0): Promise<IAccountTransfersResponse> {
return axios
Expand All @@ -198,9 +192,8 @@ export abstract class AccountAPI extends API {
/**
* Returns the account's transfers count
*
* @param {string} url API endpoint URL
* @param {string} accountId accountId to get the transfers count
* @returns {Promise<IAccountTransfersCountResponse>}
* @param url - API endpoint URL
* @param accountId - accountId to get the transfers count
*/
public static transfersCount(url: string, accountId: string): Promise<IAccountTransfersCountResponse> {
return axios
Expand All @@ -212,10 +205,9 @@ export abstract class AccountAPI extends API {
/**
* Returns paginated list of elections for a specific account
*
* @param {string} url API endpoint URL
* @param {string} accountId accountId to get elections
* @param {number} page The page number
* @returns {Promise<IElectionListResponse>}
* @param url - API endpoint URL
* @param accountId - accountId to get elections
* @param page - The page number
*/
public static electionsList(url: string, accountId: string, page: number = 0): Promise<IElectionListResponse> {
return axios
Expand Down
77 changes: 36 additions & 41 deletions src/api/census.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,9 @@ export abstract class CensusAPI extends API {
/**
* Create's a new census in the API.
*
* @param {string} url API endpoint URL
* @param {string} authToken Authentication token
* @param {CensusType} type Type of census to be created
* @returns {Promise<ICensusCreateResponse>}
* @param url - API endpoint URL
* @param authToken - Authentication token
* @param type - Type of census to be created
*/
public static create(url: string, authToken: string, type: CensusType): Promise<ICensusCreateResponse> {
return axios
Expand All @@ -144,11 +143,10 @@ export abstract class CensusAPI extends API {
/**
* Adds participants to a census
*
* @param {string} url API endpoint URL
* @param {string} authToken Authentication token
* @param {string} censusId The id of the census to which participants are being added
* @param {Array.<{key: string, weight: BigInt | null}>} participants An array of participants
* @returns {Promise<ICensusAddResponse>}
* @param url - API endpoint URL
* @param authToken - Authentication token
* @param censusId - The id of the census to which participants are being added
* @param participants - An array of participants
*/
public static add(
url: string,
Expand Down Expand Up @@ -181,10 +179,10 @@ export abstract class CensusAPI extends API {
/**
* Publishes the census, so it can be used in processes
*
* @param {string} url API endpoint URL
* @param {string} authToken Authentication token
* @param {string} censusId The census ID we're publishing
* @returns {Promise<ICensusPublishResponse>} on success
* @param url - API endpoint URL
* @param authToken - Authentication token
* @param censusId - The census ID we're publishing
* @returns on success
*/
public static publish(url: string, authToken: string, censusId: string): Promise<ICensusPublishResponse> {
return axios
Expand All @@ -200,10 +198,10 @@ export abstract class CensusAPI extends API {
/**
* Checks if the specified address is in the specified census
*
* @param {string} url API endpoint URL
* @param {string} censusId The census ID of which we want the proof from
* @param {string} key The address to be checked
* @returns {Promise<ICensusProofResponse>} on success
* @param url - API endpoint URL
* @param censusId - The census ID of which we want the proof from
* @param key - The address to be checked
* @returns on success
*/
public static proof(url: string, censusId: string, key: string): Promise<ICensusProofResponse> {
return axios
Expand All @@ -215,10 +213,10 @@ export abstract class CensusAPI extends API {
/**
* Exports the given census identifier
*
* @param {string} url API endpoint URL
* @param {string} authToken Authentication token
* @param {string} censusId The census ID we want to export
* @returns {Promise<ICensusExportResponse>} on success
* @param url - API endpoint URL
* @param authToken - Authentication token
* @param censusId - The census ID we want to export
* @returns on success
*/
public static export(url: string, authToken: string, censusId: string): Promise<ICensusExportResponse> {
return axios
Expand All @@ -234,13 +232,13 @@ export abstract class CensusAPI extends API {
/**
* Imports data into the given census identifier
*
* @param {string} url API endpoint URL
* @param {string} authToken Authentication token
* @param {string} censusId The census ID we want to export
* @param {number} type The type of the census
* @param {string} rootHash The root hash of the census
* @param {string} data The census data to be imported
* @returns {Promise<void>} on success
* @param url - API endpoint URL
* @param authToken - Authentication token
* @param censusId - The census ID we want to export
* @param type - The type of the census
* @param rootHash - The root hash of the census
* @param data - The census data to be imported
* @returns on success
*/
public static import(
url: string,
Expand All @@ -267,10 +265,10 @@ export abstract class CensusAPI extends API {
/**
* Deletes the given census
*
* @param {string} url API endpoint URL
* @param {string} authToken Authentication token
* @param {string} censusId The census ID we want to export
* @returns {Promise<void>} on success
* @param url - API endpoint URL
* @param authToken - Authentication token
* @param censusId - The census ID we want to export
* @returns on success
*/
public static delete(url: string, authToken: string, censusId: string): Promise<void> {
return axios
Expand All @@ -286,9 +284,8 @@ export abstract class CensusAPI extends API {
/**
* Returns the size of a given census
*
* @param {string} url API endpoint URL
* @param {string} censusId The census ID
* @returns {Promise<ICensusSizeResponse>}
* @param url - API endpoint URL
* @param censusId - The census ID
*/
public static size(url: string, censusId: string): Promise<ICensusSizeResponse> {
return axios
Expand All @@ -300,9 +297,8 @@ export abstract class CensusAPI extends API {
/**
* Returns the weight of a given census
*
* @param {string} url API endpoint URL
* @param {string} censusId The census ID
* @returns {Promise<ICensusWeightResponse>}
* @param url - API endpoint URL
* @param censusId - The census ID
*/
public static weight(url: string, censusId: string): Promise<ICensusWeightResponse> {
return axios
Expand All @@ -314,9 +310,8 @@ export abstract class CensusAPI extends API {
/**
* Returns the type of given census
*
* @param {string} url API endpoint URL
* @param {string} censusId The census ID
* @returns {Promise<ICensusTypeResponse>}
* @param url - API endpoint URL
* @param censusId - The census ID
*/
public static type(url: string, censusId: string): Promise<ICensusTypeResponse> {
return axios
Expand Down
23 changes: 10 additions & 13 deletions src/api/census3/census.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,8 @@ export abstract class Census3CensusAPI extends Census3API {
/**
* Fetches list of census based on given strategy
*
* @param {string} url API endpoint URL
* @param {number} strategy The identifier of the strategy
* @returns {Promise<ICensus3CensusListResponse>}
* @param url - API endpoint URL
* @param strategy - The identifier of the strategy
*/
public static list(url: string, strategy: number): Promise<ICensus3CensusListResponse> {
return axios
Expand All @@ -114,9 +113,8 @@ export abstract class Census3CensusAPI extends Census3API {
/**
* Returns the information of the census
*
* @param {string} url API endpoint URL
* @param {number} id The identifier of the census
* @returns {Promise<ICensus3CensusResponse>}
* @param url - API endpoint URL
* @param id - The identifier of the census
*/
public static census(url: string, id: number): Promise<ICensus3CensusResponse> {
return axios
Expand All @@ -128,9 +126,8 @@ export abstract class Census3CensusAPI extends Census3API {
/**
* Returns the information of the census queue
*
* @param {string} url API endpoint URL
* @param {string} id The identifier of the census queue
* @returns {Promise<ICensus3CensusQueueResponse>}
* @param url - API endpoint URL
* @param id - The identifier of the census queue
*/
public static queue(url: string, id: string): Promise<ICensus3CensusQueueResponse> {
return axios
Expand All @@ -142,10 +139,10 @@ export abstract class Census3CensusAPI extends Census3API {
/**
* Requests the creation of a new census with the strategy provided.
*
* @param {string} url API endpoint URL
* @param {number} strategyId The strategy identifier
* @param {boolean} anonymous If the census has to be anonymous
* @returns {Promise<ICensus3QueueResponse>} The queue identifier
* @param url - API endpoint URL
* @param strategyId - The strategy identifier
* @param anonymous - If the census has to be anonymous
* @returns The queue identifier
*/
public static create(url: string, strategyId: number, anonymous: boolean = false): Promise<ICensus3QueueResponse> {
return axios
Expand Down
3 changes: 1 addition & 2 deletions src/api/census3/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ export abstract class Census3ServiceAPI extends Census3API {
/**
* Fetches supported chains from the service
*
* @param {string} url API endpoint URL
* @returns {Promise<ICensus3ServiceInfoResponse>}
* @param url - API endpoint URL
*/
public static info(url: string): Promise<ICensus3ServiceInfoResponse> {
return axios
Expand Down
Loading
Loading