add alias support for mentions
This commit is contained in:
parent
fa0376bf3c
commit
164f3629ab
3 changed files with 53 additions and 7 deletions
|
@ -133,6 +133,13 @@ type TelegramRecord struct {
|
|||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
type Alias struct {
|
||||
Target string `json:"target"`
|
||||
Subject string `json:"subject"`
|
||||
Error string `json:"error"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
func (bluesky *Bluesky) CommitTelegramResponse(data *TelegramRecord, rkey string) *CommitResponse {
|
||||
bluesky.CheckSessionValid()
|
||||
|
||||
|
@ -225,3 +232,34 @@ func (bluesky *Bluesky) DeleteRecord(args []string) *CommitResponse {
|
|||
Post("/xrpc/com.atproto.repo.deleteRecord").BodyJSON(params).Receive(resp, resp)
|
||||
return resp
|
||||
}
|
||||
|
||||
func (bluesky *Bluesky) FetchAliases() []Records {
|
||||
resp := new(AliasRecord)
|
||||
params := struct {
|
||||
Repo string `url:"repo"`
|
||||
Collection string `url:"collection"`
|
||||
}{
|
||||
Repo: bluesky.Cfg.DID,
|
||||
Collection: "blue.zio.bsky2tg.alias",
|
||||
}
|
||||
|
||||
bluesky.sling.New().Get("/xrpc/com.atproto.repo.listRecords").QueryStruct(¶ms).Receive(resp, resp)
|
||||
return resp.Records
|
||||
}
|
||||
|
||||
type AliasRecord struct {
|
||||
Records []Records `json:"records"`
|
||||
Cursor string `json:"cursor"`
|
||||
}
|
||||
type Value struct {
|
||||
Type string `json:"$type"`
|
||||
Error string `json:"error"`
|
||||
Target string `json:"target"`
|
||||
Message string `json:"message"`
|
||||
Subject string `json:"subject"`
|
||||
}
|
||||
type Records struct {
|
||||
URI string `json:"uri"`
|
||||
Cid string `json:"cid"`
|
||||
Value Value `json:"value"`
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue