Skip to content

Commit

Permalink
chore: add Api operation decorator for summary description
Browse files Browse the repository at this point in the history
  • Loading branch information
dutterbutter committed Oct 5, 2023
1 parent fec8a49 commit 2cf52f1
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion 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 @@ -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 Ether 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 Ether 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

0 comments on commit 2cf52f1

Please sign in to comment.