(pds string, token string, screen_name string)
| 476 | } |
| 477 | |
| 478 | func GetUserInfoRaw(pds string, token string, screen_name string) (*User, error) { |
| 479 | url := pds + "/xrpc/app.bsky.actor.getProfile" + "?actor=" + screen_name |
| 480 | |
| 481 | resp, err := SendRequest(&token, http.MethodGet, url, nil) |
| 482 | if err != nil { |
| 483 | return nil, err |
| 484 | } |
| 485 | defer resp.Body.Close() |
| 486 | if resp.StatusCode != http.StatusOK { |
| 487 | bodyBytes, _ := io.ReadAll(resp.Body) |
| 488 | bodyString := string(bodyBytes) |
| 489 | fmt.Println("Response Status:", resp.StatusCode) |
| 490 | fmt.Println("Response Body:", bodyString) |
| 491 | return nil, errors.New(bodyString) // return response |
| 492 | } |
| 493 | |
| 494 | author := User{} |
| 495 | if err := json.NewDecoder(resp.Body).Decode(&author); err != nil { |
| 496 | return nil, err |
| 497 | } |
| 498 | |
| 499 | return &author, nil |
| 500 | } |
| 501 | |
| 502 | func GetUsersInfo(pds string, token string, items []string, ignoreCache bool) ([]*bridge.TwitterUser, error) { |
| 503 | var results []*bridge.TwitterUser |
no test coverage detected