%pip install servicestack
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
class TechnologyTier(str, Enum):
PROGRAMMING_LANGUAGE = 'ProgrammingLanguage'
CLIENT = 'Client'
HTTP = 'Http'
SERVER = 'Server'
DATA = 'Data'
SOFTWARE_INFRASTRUCTURE = 'SoftwareInfrastructure'
OPERATING_SYSTEM = 'OperatingSystem'
HARDWARE_INFRASTRUCTURE = 'HardwareInfrastructure'
THIRD_PARTY_SERVICES = 'ThirdPartyServices'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class TechnologyBase:
id: int = 0
name: Optional[str] = None
vendor_name: Optional[str] = None
vendor_url: Optional[str] = None
product_url: Optional[str] = None
logo_url: Optional[str] = None
description: Optional[str] = None
created: datetime.datetime = datetime.datetime(1, 1, 1)
created_by: Optional[str] = None
last_modified: datetime.datetime = datetime.datetime(1, 1, 1)
last_modified_by: Optional[str] = None
owner_id: Optional[str] = None
slug: Optional[str] = None
logo_approved: bool = False
is_locked: bool = False
tier: Optional[TechnologyTier] = None
last_status_update: Optional[datetime.datetime] = None
organization_id: Optional[int] = None
comments_post_id: Optional[int] = None
view_count: int = 0
fav_count: int = 0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Technology(TechnologyBase):
pass
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class TechnologyView:
id: Optional[int] = None
name: Optional[str] = None
vendor_name: Optional[str] = None
vendor_url: Optional[str] = None
product_url: Optional[str] = None
logo_url: Optional[str] = None
description: Optional[str] = None
created: Optional[datetime.datetime] = None
created_by: Optional[str] = None
last_modified: Optional[datetime.datetime] = None
last_modified_by: Optional[str] = None
owner_id: Optional[str] = None
slug: Optional[str] = None
logo_approved: Optional[bool] = None
is_locked: Optional[bool] = None
tier: Optional[TechnologyTier] = None
last_status_update: Optional[datetime.datetime] = None
organization_id: Optional[int] = None
comments_post_id: Optional[int] = None
view_count: Optional[int] = None
fav_count: Optional[int] = None
# @Route("/technology/search")
# @AutoQueryViewer(DefaultSearchField="Tier", DefaultSearchText="Data", DefaultSearchType="=", Description="Explore different Technologies", IconUrl="octicon:database", Title="Find Technologies")
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class FindTechnologies(QueryDb2[Technology, TechnologyView], IReturn[QueryResponse[TechnologyView]], IGet):
ids: Optional[List[int]] = None
name: Optional[str] = None
vendor_name: Optional[str] = None
name_contains: Optional[str] = None
vendor_name_contains: Optional[str] = None
description_contains: Optional[str] = None
from IPython.core.display import display, HTML
client = JsonServiceClient("https://techstacks.io")
response = client.send(FindTechnologies(
ids=[1, 2, 4, 6],
vendor_name="Google",
take=10,
fields="Id, Name, VendorName, Tier, FavCount, ViewCount"))
display(HTML(htmldump(response)))
offset | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
total | 19 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
results |
|
printtable(response.results)
+-----------------------------------------------------------------------------------------+ | id | name | vendorName | tier | viewCount | favCount | |-----------------------------------------------------------------------------------------| | 1 | ServiceStack | ServiceStack | Server | 4204 | 5 | | 2 | PostgreSQL | PostgreSQL | Data | 2291 | 4 | | 4 | Windows Server 2012 | Microsoft | OperatingSystem | 878 | 1 | | 6 | AWS RDS | Amazon | Data | 625 | 1 | | 7 | AngularJS | Google | Client | 5012 | 1 | | 13 | Google Closure Library | Google | Client | 390 | 1 | | 15 | Dart | Google | ProgrammingLanguage | 320 | 2 | | 18 | Go | Google | ProgrammingLanguage | 3865 | 2 | | 57 | LevelDB | Google | Data | 325 | 1 | | 61 | Firebase | Google | Data | 722 | 1 | +-----------------------------------------------------------------------------------------+