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

chore: add Api operation decorator for summary description #37

Merged
merged 3 commits into from
Oct 5, 2023
Merged
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
19 changes: 17 additions & 2 deletions packages/api/src/api/api.controller.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Controller, Get, Query, Req, Next, UseFilters } from "@nestjs/common";
import { ApiTags, ApiOkResponse, ApiExcludeEndpoint, ApiQuery, ApiExtraModels } from "@nestjs/swagger";
import { ApiTags, ApiOkResponse, ApiExcludeEndpoint, ApiQuery, ApiExtraModels, ApiOperation } from "@nestjs/swagger";
import { Request, NextFunction } from "express";
import { PagingOptionsWithMaxItemsLimitDto } from "./dtos/common/pagingOptionsWithMaxItemsLimit.dto";
import { ContractAbiResponseDto } from "./dtos/contract/contractAbiResponse.dto";
Expand Down Expand Up @@ -50,6 +50,7 @@ export class ApiController {

@ApiTags("Contract API")
@Get("api?module=contract&action=getabi")
@ApiOperation({ summary: "Fetch the ABI for a given contract address" })
@ApiQuery({
name: "address",
description: "The contract address that has a verified source code",
Expand All @@ -66,6 +67,7 @@ export class ApiController {

@ApiTags("Contract API")
@Get("api?module=contract&action=getsourcecode")
@ApiOperation({ summary: "Fetch the source code for a given contract address" })
@ApiQuery({
name: "address",
description: "The contract address that has a verified source code",
Expand All @@ -82,6 +84,7 @@ export class ApiController {

@ApiTags("Contract API")
@Get("api?module=contract&action=getcontractcreation")
@ApiOperation({ summary: "Fetch creation details for a list of contract addresses" })
@ApiQuery({
isArray: true,
explode: false,
Expand All @@ -92,7 +95,7 @@ export class ApiController {
})
@ApiExtraModels(ContractCreationInfoDto)
@ApiOkResponse({
description: "Contract creation info",
description: "Contract creation information",
type: ContractCreationResponseDto,
})
public async getContractCreation(): Promise<ContractCreationResponseDto> {
Expand All @@ -101,6 +104,7 @@ export class ApiController {

@ApiTags("Transaction API")
@Get("api?module=transaction&action=getstatus")
@ApiOperation({ summary: "Fetch the status for a given transaction hash" })
@ApiQuery({
name: "txhash",
description: "The transaction hash to check the execution status",
Expand All @@ -118,6 +122,7 @@ export class ApiController {

@ApiTags("Transaction API")
@Get("api?module=transaction&action=gettxreceiptstatus")
@ApiOperation({ summary: "Fetch the receipt status for a given transaction hash" })
@ApiQuery({
name: "txhash",
description: "The transaction hash to check the execution status",
Expand All @@ -134,6 +139,7 @@ export class ApiController {

@ApiTags("Account API")
@Get("api?module=account&action=txlist")
@ApiOperation({ summary: "Retrieve transactions for a given address" })
@ApiQuery({
name: "address",
description: "The address to filter transactions by",
Expand Down Expand Up @@ -168,6 +174,7 @@ export class ApiController {

@ApiTags("Account API")
@Get("api?module=account&action=txlistinternal")
@ApiOperation({ summary: "Retrieve internal transactions for a given address or transaction hash" })
@ApiQuery({
name: "address",
description: "The address to filter internal transactions by",
Expand Down Expand Up @@ -208,6 +215,7 @@ export class ApiController {

@ApiTags("Account API")
@Get("api?module=account&action=balance")
@ApiOperation({ summary: "Retrieve the balance for a given address" })
@ApiQuery({
name: "address",
description: "The address to get Ether balance for",
Expand All @@ -224,6 +232,7 @@ export class ApiController {

@ApiTags("Account API")
@Get("api?module=account&action=balancemulti")
@ApiOperation({ summary: "Retrieve the balances for a list of addresses" })
@ApiQuery({
isArray: true,
explode: false,
Expand All @@ -242,6 +251,7 @@ export class ApiController {

@ApiTags("Account API")
@Get("api?module=account&action=tokenbalance")
@ApiOperation({ summary: "Retrieve token balance for a specific address" })
@ApiQuery({
name: "address",
description: "The address to get Token balance for",
Expand All @@ -264,6 +274,7 @@ export class ApiController {

@ApiTags("Account API")
@Get("api?module=account&action=tokentx")
@ApiOperation({ summary: "Retrieve token transfers for a specific address or token contract" })
@ApiQuery({
name: "address",
description: "The address to get transfers for",
Expand Down Expand Up @@ -304,6 +315,7 @@ export class ApiController {

@ApiTags("Account API")
@Get("api?module=account&action=tokennfttx")
@ApiOperation({ summary: "Retrieve NFT transfers for a specific address" })
@ApiQuery({
name: "address",
description: "The address to get transfers for",
Expand Down Expand Up @@ -344,6 +356,7 @@ export class ApiController {

@ApiTags("Block API")
@Get("api?module=block&action=getblocknobytime")
@ApiOperation({ summary: "Retrieve block number closest to a specific timestamp" })
@ApiQuery({
name: "timestamp",
type: "integer",
Expand All @@ -368,6 +381,7 @@ export class ApiController {

@ApiTags("Block API")
@Get("api?module=block&action=getblockcountdown")
@ApiOperation({ summary: "Retrieve countdown details for a specific block number" })
@ApiQuery({
name: "blockno",
type: "integer",
Expand All @@ -385,6 +399,7 @@ export class ApiController {

@ApiTags("Block API")
@Get("api?module=block&action=getblockreward")
@ApiOperation({ summary: "Retrieve block reward details for a specific block number" })
@ApiQuery({
name: "blockno",
type: "integer",
Expand Down