func main() {
entrypoint := flag.String("entrypoint", "mm.rnd.stcnet.ru", "Entrypoint")
pageNum := flag.Int("page", 0, "Page number")
+ direct := flag.Bool("direct", false, "Direct channel")
flag.Parse()
log.SetFlags(log.Lshortfile)
log.SetOutput(os.Stdout)
}
c := model.NewAPIv4Client("https://" + *entrypoint)
c.Login(login, password)
+ me, _, err := c.GetMe("")
+ if err != nil {
+ log.Fatalln(err)
+ }
users, err := mmc.GetUsers(c, nil)
if err != nil {
log.Fatalln(err)
}
+ if *direct {
+ dc, _, err := c.CreateDirectChannel(me.Id, chId)
+ if err != nil {
+ log.Fatalln(err)
+ }
+ chId = dc.Id
+ }
list, _, err := c.GetPostsBefore(chId, postId, *pageNum, PerPage, "", false)
if err != nil {
log.Fatalln(err)