Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # I'm using httpclient to access a API, and unmarshall responses to different types
- # Below are examples of some of the types I am using.
- # I have a specific response that returns a ScheduleData object, however, the type of the broadcast field of it
- # varies, it will either end up being nil or a Broadcast object.
- # I'm not sure how to handle this properly in Nim. In golang, I know you would use like an interface.
- type
- Broadcast* = object
- broadcastId*: int
- userId*: int
- title*: string
- status*: int
- state*: string
- channelId*: int
- created*: string
- started*: string
- ended*: string
- permalink*: string
- thumbnailData*: string
- tags*: seq[string]
- socketUrl*: string
- streams*: Streams
- streamUrl*: string
- streamKey*: string
- relativeTimestamp*: int
- links*: Links
- ScheduleData* = object
- active*: bool
- atCapacity*: bool
- showId*: string
- showType*: string
- startTime*: string
- nextShowTime*: string
- upcoming*: seq[Upcoming]
- broadcast*: Broadcast
- nextGameType*: string
- gameType*: string
- media*: string
- broadcastFull*: bool
Advertisement
Add Comment
Please, Sign In to add comment