--- Posting topic ID helper --- resolvePostingTopicID extracts the topic ID from an SDK Posting. The SDK Posting doesn't have a TopicID field, so we parse from AppUrl.
(p generated.Posting)
| 124 | // resolvePostingTopicID extracts the topic ID from an SDK Posting. |
| 125 | // The SDK Posting doesn't have a TopicID field, so we parse from AppUrl. |
| 126 | func resolvePostingTopicID(p generated.Posting) int64 { |
| 127 | if i := strings.LastIndex(p.AppUrl, "/topics/"); i >= 0 { |
| 128 | segment := p.AppUrl[i+len("/topics/"):] |
| 129 | // Strip trailing path components or query strings |
| 130 | if j := strings.IndexAny(segment, "/?#"); j >= 0 { |
| 131 | segment = segment[:j] |
| 132 | } |
| 133 | if id, err := strconv.ParseInt(segment, 10, 64); err == nil { |
| 134 | return id |
| 135 | } |
| 136 | } |
| 137 | return p.Id |
| 138 | } |
| 139 | |
| 140 | // --- Calendar helpers --- |
| 141 |