2023-12-11 09:32:50 +01:00
|
|
|
package models
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Response struct {
|
|
|
|
Meta
|
2023-12-17 18:56:20 +01:00
|
|
|
|
|
|
|
Questions map[string]string
|
2023-12-11 09:32:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Response) String() string {
|
2023-12-17 18:56:20 +01:00
|
|
|
return fmt.Sprintf("Questions/Answers: %v", r.Questions)
|
2023-12-11 09:32:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Response) GetHash() string {
|
2023-12-17 18:56:20 +01:00
|
|
|
// return fmt.Sprintf("%x", sha256.Sum256([]byte(r.QuestionID+r.AnswerID)))
|
|
|
|
return ""
|
2023-12-11 09:32:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Response) Marshal() ([]byte, error) {
|
|
|
|
return json.Marshal(r)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Response) Unmarshal(data []byte) error {
|
|
|
|
return json.Unmarshal(data, r)
|
|
|
|
}
|