aboutsummaryrefslogtreecommitdiff
path: root/content/docs/mal2go/v4/anime/get-suggested-anime.md
blob: 98dc01cdf20f824df07fd068430dc6f63532d7f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
---
title: "Get suggested animes"
description: "Returns some suggestions for the user"
weight: 6
---

`GetSuggestedAnime` returns a list of animes suggested to the authenticated user.

- `limit int` Is the max amount of results to get. Max is 100.
- `offset int` Is the "offset" for results. If offset is greater than 0 the first n number of reults will be ignored.
- `nsfw bool` Wether to include NSFW rated results
- `fields []string` The fields to include in the response. [Here](/docs/mal2go/v4/anime/types#mal2goanimeanime) is a list of the valid fields. Just using an empty slice (`[]string{}`) will include all the fields.

Example:

``` go
package main

import (
  "github.com/MikunoNaka/MAL2Go/v4/anime"
  "log"
  "fmt"
)

func main() {
  authToken := "YOUR_TOKEN_HERE"
  myClient := anime.Client {
    AuthToken: "Bearer " + authToken,
  }
    
  limit, offset := 10, 0
  nsfw := true // include NSFW results
  fields := []string{"title"}
    
  suggestedAnimes, err := myClient.GetSuggestedAnime(limit, offset, nsfw, fields)
  if err != nil {
    log.Fatal(err) // remember kids, always handle errors
  }
    
  for _, i := range suggestedAnimes {
    fmt.Println(i.Title)
  }
}
```

Above example prints 10 animes suggested to the authenticated user.