Home Reference Source
import Answer from '~/models/Answer.js'
public class | source

Answer

Implements:

An answer to a challenge

Static Method Summary

Static Public Methods
public static

Unwraps from serach Index JSON object

public static

Unwraps from an API JSON object.

Constructor Summary

Public Constructor
public

constructor(answer: Object)

Creates an answer from an answer config object

Member Summary

Public Members
public get

Returns the code

public set

Sets the code

public get
public get
public get

General endpoint for this type of model

public get
public set

Gets if deleted

public get

Gets if deleted

public get

Language of ans

public get

Returns length of answer

public get
public get

URL of answer

public get

Returns owner of the answer

Method Summary

Public Methods
public

Clones and returns a new copy of the answer.

public

Converts to json

Static Public Methods

public static fromIndexJSON(JSON: Object): User source

Unwraps from serach Index JSON object

Params:

NameTypeAttributeDescription
JSON Object

Search index JSON

Return:

User (nullable: true)

Created object

public static fromJSON(json: Object): Answer source

Unwraps from an API JSON object.

Params:

NameTypeAttributeDescription
json Object

User JSON object.

Return:

Answer (nullable: true)

object if succesful, null if unauthorized.

Throw:

TypeError

if invalid JSON object

Public Constructors

public constructor(answer: Object) source

Creates an answer from an answer config object

Params:

NameTypeAttributeDescription
answer Object
answer.id number
answer.code string
  • nullable: true
answer.encoding string
  • nullable: true
answer.deleted boolean
  • optional
  • default: false
answer.commentary string
  • nullable: true
answer.length number
  • nullable: true
answer.language Language
  • nullable: true
answer.user User
answer.post Post
  • nullable: true

Parent post

answer.dateCreated Date
  • nullable: true
answer.dateModified Date
  • nullable: true

Public Members

public get code: string source

Returns the code

public set code: string source

Sets the code

public get dateCreated: Date source

public get dateModified: Date source

public get endpoint: string source

General endpoint for this type of model

public get id: number source

public set isDeleted source

Gets if deleted

public get isDeleted source

Gets if deleted

public get language: Language source

Language of ans

public get length: number source

Returns length of answer

public get post: Post source

public get url: string source

URL of answer

Return:

string

public get user: User source

Returns owner of the answer

Public Methods

public clone(): Answer source

Clones and returns a new copy of the answer. This is not deep

Return:

Answer

a copy

public toJSON(): Object source

Converts to json

Return:

Object

json object