Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Tag

Hierarchy

Index

Constructors

constructor

  • new Tag(config: knex.Config, secret: string): Tag

Properties

config

config: knex.Config

Methods

api

  • api(table: string): knex.QueryBuilder<any>
  • description

    Método central que inicia query

    Parameters

    • table: string

      Nome da tabela

    Returns knex.QueryBuilder<any>

createNewApiDoc

  • createNewApiDoc(userId: number, apiForm: Api): Promise<void>
  • description

    Create a new API Documentation

    Parameters

    • userId: number

      User ID

    • apiForm: Api

      Form for new API

    Returns Promise<void>

createNewTag

  • createNewTag(userId: number, apiId: number, form: any): Promise<Tag>
  • description

    Create a new Tag

    Parameters

    • userId: number

      User ID

    • apiId: number

      Api ID

    • form: any

      Form with "nameTag" and "descriptionTag"

    Returns Promise<Tag>

deleteApiById

  • deleteApiById(userId: number, id: number): Promise<void>
  • description

    Delete one API

    Parameters

    • userId: number

      User ID

    • id: number

      Api ID

    Returns Promise<void>

deleteTagByIdAndUserId

  • deleteTagByIdAndUserId(userId: number, tagId: number): Promise<void>
  • description

    Remove a tag by ID and User ID

    Parameters

    • userId: number

      User ID

    • tagId: number

      Tag ID

    Returns Promise<void>

generateToken

  • generateToken(params: string | object, validade: string): Promise<string>
  • description

    Gera um novo token com validade determinada pelo parametro validade

    Parameters

    • params: string | object
    • validade: string

      Validade do token, ex: 7d

    Returns Promise<string>

getAllApiByUser

  • getAllApiByUser(userId: number): Promise<Api[]>

getAllApiByUserAndVisibility

  • getAllApiByUserAndVisibility(userId: number, isPublic: boolean): Promise<Api[]>
  • description

    Get All Api docs by user and visibility, is public or not

    Parameters

    • userId: number

      User ID

    • isPublic: boolean

      State of visibility: true | false

    Returns Promise<Api[]>

getAllTagById

  • getAllTagById(userId: number, apiId: number): Promise<Tag[]>
  • description

    Find all Tags by User ID and Api ID

    Parameters

    • userId: number

      User ID

    • apiId: number

      Api ID

    Returns Promise<Tag[]>

getApiAndTags

  • getApiAndTags(userId: number, apiId: number): Promise<Api>
  • description

    Get a Api and all Tags related

    Parameters

    • userId: number

      User ID

    • apiId: number

      API ID

    Returns Promise<Api>

getOneApi

  • getOneApi(userId: number, id: number): Promise<Api>
  • description

    Get one API doc

    Parameters

    • userId: number

      User ID

    • id: number

      API ID

    Returns Promise<Api>

getPathAndResponses

  • getPathAndResponses(knexInstance: knex<knex>, tagId: string): Promise<Path[]>

knex

migrate

  • migrate(): Promise<void>

registerNewUser

  • registerNewUser(name: string, email: string, password: string): Promise<User>
  • description

    Register a new user

    Parameters

    • name: string

      User Name

    • email: string

      User Email

    • password: string

      User Password

    Returns Promise<User>

updateApiById

  • updateApiById(userId: number, id: number, newApi: Api): Promise<void>
  • description

    Updates an existing api

    Parameters

    • userId: number

      User ID

    • id: number

      Api ID

    • newApi: Api

      Api update form

    Returns Promise<void>

updateTagById

  • updateTagById(userId: number, tagId: number, form: any): Promise<void>
  • description

    Update a tag

    Parameters

    • userId: number

      User ID

    • tagId: number

      Tag ID

    • form: any

      Form with "nameTag" and "descriptionTag"

    Returns Promise<void>

userAuth

  • userAuth(email: string, password: string): Promise<User>
  • description

    Logs in user and returns user object with jwt token

    Parameters

    • email: string

      User email

    • password: string

      Password email

    Returns Promise<User>

userRegister

  • userRegister(nome: string, email: string, password: string): Promise<User>
  • description

    Checks user availability and initializes user registration

    Parameters

    • nome: string

      User Name

    • email: string

      User Email

    • password: string

      User Password

    Returns Promise<User>

Generated using TypeDoc