Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Constructors

constructor

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

Properties

config

config: knex.Config

Methods

addNewMember

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

    Add a member to the team

    Parameters

    • userId: number

      User ID

    • form: any

      Form contains: "teamIdFk" and "email"

    Returns Promise<void>

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>

createNewPath

  • createNewPath(userId: number, tagId: number, form: any): Promise<Path>
  • description

    Create a New Path

    Parameters

    • userId: number

      User ID

    • tagId: number

      Tag ID

    • form: any

      Form contain fields: methodType, pathName, descriptionVerb, path, parameter, headersValue, bodyValue and data

    Returns Promise<Path>

createNewResponse

  • createNewResponse(userId: number, pathId: number, form: any): Promise<Response>

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>

createTeam

  • createTeam(userId: number, form: any): Promise<string>
  • description

    Create a new Team

    Parameters

    • userId: number

      User ID

    • form: any

      Form contains: "teamName" and "apiIdFk"

    Returns Promise<string>

deleteApiById

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

    Delete one API

    Parameters

    • userId: number

      User ID

    • id: number

      Api ID

    Returns Promise<void>

deleteMemberById

  • deleteMemberById(rulesId: number): Promise<void>
  • description

    Remove a member from team

    Parameters

    • rulesId: number

      Rules ID

    Returns Promise<void>

deletePathById

  • deletePathById(userId: number, pathId: number): Promise<void>

deleteResponseById

  • deleteResponseById(userId: number, responseId: number): Promise<void>

deleteTagByIdAndUserId

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

deleteTeamById

  • deleteTeamById(userId: number, teamId: number): Promise<void>
  • description

    Delete a team

    Parameters

    • userId: number

      User ID "owner"

    • teamId: number

      Team ID

    Returns Promise<void>

exitTeam

  • exitTeam(userId: number, ruleId: number): Promise<void>
  • description

    Exit Team, "don't need to own"

    Parameters

    • userId: number

      User ID

    • ruleId: number

      Rule 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[]>

getAllMembersByTeamId

  • getAllMembersByTeamId(userId: number, teamIdFk: number): Promise<any[]>
  • description

    List all team members

    Parameters

    • userId: number

      User ID

    • teamIdFk: number

      Team ID

    Returns Promise<any[]>

getAllPathByIdAndUserId

  • getAllPathByIdAndUserId(userId: number, tagId: number): Promise<Path[]>

getAllResponsesByPathAndUserId

  • getAllResponsesByPathAndUserId(userId: number, pathId: number): Promise<Response[]>

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[]>

getAllTeamByUserId

  • getAllTeamByUserId(userId: number): Promise<Team[]>
  • description

    Get all team by User ID

    Parameters

    • userId: number

      User ID

    Returns Promise<Team[]>

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>

getApiAndTagsTeam

  • getApiAndTagsTeam(userId: number, ruleId: number): Promise<Api>
  • description

    Get Api with Tags - Team Method

    Parameters

    • userId: number

      User ID

    • ruleId: number

      Rule 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[]>

getPathAndResponsesTeam

  • getPathAndResponsesTeam(knexInstance: knex<knex>, userId: number, tagId: number, ruleId: number): Promise<Path[]>
  • description

    Get Paths with Response - Team Method

    Parameters

    • knexInstance: knex<knex>

      Instance Knex

    • userId: number

      User ID

    • tagId: number

      Tag ID

    • ruleId: number

      Rule ID

    Returns Promise<Path[]>

knex

listTeamsOwner

  • listTeamsOwner(userId: number): Promise<any[]>
  • description

    Team list that the applicant owns

    Parameters

    • userId: number

      User ID "Owner"

    Returns Promise<any[]>

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>

updatePath

  • updatePath(userId: number, pathId: number, form: any): Promise<void>
  • description

    Update a Path

    Parameters

    • userId: number

      User ID

    • pathId: number

      Path ID

    • form: any

      Form contains: methodType, pathName, descriptionVerb, path, parameter, headersValue, bodyValue and data

    Returns Promise<void>

updateResponse

  • updateResponse(userId: number, responseId: number, form: any): Promise<void>
  • description

    Update Response

    Parameters

    • userId: number

      User ID

    • responseId: number

      Resposne ID

    • form: any

      Form contains: typeCode and responseModel

    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>

updateTeam

  • updateTeam(userId: number, teamId: number, form: any): Promise<Team>
  • description

    Update a team

    Parameters

    • userId: number

      User ID

    • teamId: number

      Team ID

    • form: any

      Form contains: "teamName"

    Returns Promise<Team>

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