Files
CodeSnippet/CodeSnippetRofi/entity/response.py

20 lines
562 B
Python

import json
class SearchResponse:
def __init__(self, response: dict):
self.status = response["status"]
self.data = [SearchResponse.SearchData(dict(r)) for r in json.loads(response["data"])]
class SearchData:
def __init__(self, data: dict):
self.id = data["id"]
self.name = data["name"]
self.path = data["path"]
self.score = data["score"]
class NormalResponse:
def __init__(self, response: dict):
self.status = response["status"]
self.data = response["data"]