Change user endpoint
This commit is contained in:
parent
77da2e32c6
commit
0e58c36bae
3 changed files with 5 additions and 5 deletions
|
@ -37,7 +37,7 @@ proc getProfile*(username: string): Future[Profile] {.async.} =
|
||||||
let
|
let
|
||||||
ps = genParams({"screen_name": username})
|
ps = genParams({"screen_name": username})
|
||||||
url = userLookup ? ps
|
url = userLookup ? ps
|
||||||
result = parseUserShow(await fetch(url, oldApi=true), username)
|
result = parseUserLookup(await fetch(url, oldApi=true), username)
|
||||||
|
|
||||||
proc getTimeline*(id: string; after=""; replies=false): Future[Timeline] {.async.} =
|
proc getTimeline*(id: string; after=""; replies=false): Future[Timeline] {.async.} =
|
||||||
let
|
let
|
||||||
|
|
|
@ -13,7 +13,7 @@ const
|
||||||
mediaTimeline* = timelineApi / "media"
|
mediaTimeline* = timelineApi / "media"
|
||||||
listTimeline* = timelineApi / "list.json"
|
listTimeline* = timelineApi / "list.json"
|
||||||
listMembers* = api / "1.1/lists/members.json"
|
listMembers* = api / "1.1/lists/members.json"
|
||||||
userLookup* = api / "1.1/users/show.json"
|
userLookup* = api / "1.1/users/lookup.json"
|
||||||
photoRail* = api / "1.1/statuses/media_timeline.json"
|
photoRail* = api / "1.1/statuses/media_timeline.json"
|
||||||
tweet* = timelineApi / "conversation"
|
tweet* = timelineApi / "conversation"
|
||||||
search* = api / "2/search/adaptive.json"
|
search* = api / "2/search/adaptive.json"
|
||||||
|
|
|
@ -24,15 +24,15 @@ proc parseProfile(js: JsonNode; id=""): Profile =
|
||||||
|
|
||||||
result.expandProfileEntities(js)
|
result.expandProfileEntities(js)
|
||||||
|
|
||||||
proc parseUserShow*(js: JsonNode; username: string): Profile =
|
proc parseUserLookup*(js: JsonNode; username: string): Profile =
|
||||||
if js.isNull: return
|
if js.isNull or js.kind == JArray and js.len == 0: return
|
||||||
with error, js{"errors"}:
|
with error, js{"errors"}:
|
||||||
result = Profile(username: username)
|
result = Profile(username: username)
|
||||||
if error.getError == suspended:
|
if error.getError == suspended:
|
||||||
result.suspended = true
|
result.suspended = true
|
||||||
return
|
return
|
||||||
|
|
||||||
result = parseProfile(js)
|
result = parseProfile(js[0])
|
||||||
|
|
||||||
proc parseGraphProfile*(js: JsonNode; username: string): Profile =
|
proc parseGraphProfile*(js: JsonNode; username: string): Profile =
|
||||||
if js.isNull: return
|
if js.isNull: return
|
||||||
|
|
Loading…
Reference in a new issue