Skip to content

Commit 8dccff1

Browse files
committed
feat: implement catagories
1 parent beba181 commit 8dccff1

3 files changed

Lines changed: 132 additions & 0 deletions

File tree

bridge/bridge.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,12 @@ type TwitterList struct {
400400
Following bool `json:"following" xml:"following"`
401401
}
402402

403+
type TopicSuggestion struct {
404+
Name string `json:"name" xml:"name"`
405+
Slug string `json:"slug" xml:"slug"`
406+
Size int `json:"size" xml:"size"`
407+
}
408+
403409
func encodeToUint63(input string) *int64 {
404410
hasher := fnv.New64a() // Create a new FNV-1a 64-bit hash
405411
hasher.Write([]byte(input)) // Write the input string as bytes

twitterv1/discover.go

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,128 @@ func trends_woeid(c *fiber.Ctx) error {
173173
},
174174
})
175175
}
176+
177+
func SuggestedTopics(c *fiber.Ctx) error {
178+
// I think this is hard coded in?
179+
// It expects a size, but uhhh, it can be unlimited on bsky sooooo...
180+
// It might be worth it later to get the config for this
181+
// Also localization
182+
suggestions := []bridge.TopicSuggestion{
183+
{
184+
Name: "Animals",
185+
Slug: "animals",
186+
Size: 20,
187+
},
188+
{
189+
Name: "Art",
190+
Slug: "art",
191+
Size: 20,
192+
},
193+
{
194+
Name: "Books",
195+
Slug: "books",
196+
Size: 20,
197+
},
198+
{
199+
Name: "Comedy",
200+
Slug: "comedy",
201+
Size: 20,
202+
},
203+
{
204+
Name: "Comics",
205+
Slug: "comics",
206+
Size: 20,
207+
},
208+
{
209+
Name: "Culture",
210+
Slug: "culture",
211+
Size: 20,
212+
},
213+
{
214+
Name: "Software Dev",
215+
Slug: "dev",
216+
Size: 20,
217+
},
218+
{
219+
Name: "Education",
220+
Slug: "education",
221+
Size: 20,
222+
},
223+
{
224+
Name: "Food",
225+
Slug: "food",
226+
Size: 20,
227+
},
228+
{
229+
Name: "Video Games",
230+
Slug: "gaming",
231+
Size: 20,
232+
},
233+
{
234+
Name: "Journalism",
235+
Slug: "journalism",
236+
Size: 20,
237+
},
238+
{
239+
Name: "Movies",
240+
Slug: "movies",
241+
Size: 20,
242+
},
243+
{
244+
Name: "Music",
245+
Slug: "music",
246+
Size: 20,
247+
},
248+
{
249+
Name: "Nature",
250+
Slug: "nature",
251+
Size: 20,
252+
},
253+
{
254+
Name: "News",
255+
Slug: "news",
256+
Size: 20,
257+
},
258+
{
259+
Name: "Pets",
260+
Slug: "pets",
261+
Size: 20,
262+
},
263+
{
264+
Name: "Photography",
265+
Slug: "photography",
266+
Size: 20,
267+
},
268+
{
269+
Name: "Politics",
270+
Slug: "politics",
271+
Size: 20,
272+
},
273+
{
274+
Name: "Science",
275+
Slug: "science",
276+
Size: 20,
277+
},
278+
{
279+
Name: "Sports",
280+
Slug: "sports",
281+
Size: 20,
282+
},
283+
{
284+
Name: "Tech",
285+
Slug: "tech",
286+
Size: 20,
287+
},
288+
{
289+
Name: "TV",
290+
Slug: "tv",
291+
Size: 20,
292+
},
293+
{
294+
Name: "Writers",
295+
Slug: "writers",
296+
Size: 20,
297+
},
298+
}
299+
return EncodeAndSend(c, suggestions)
300+
}

twitterv1/twitterv1.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ func InitServer(config *config.Config) {
114114
// Discover
115115
app.Get("/1/trends/:woeid.:filetype", trends_woeid)
116116
app.Get("/1/trends/current.:filetype", trends_woeid)
117+
app.Get("/1/users/suggestions.:filetype", SuggestedTopics)
117118
app.Get("/i/search.:filetype", InternalSearch)
118119

119120
// Lists

0 commit comments

Comments
 (0)