MCPcopy Index your code
hub / github.com/SMNETSTUDIO/Groq2API / GerOrganizationId

Function GerOrganizationId

pkg/groq/request.go:30–55  ·  view source on GitHub ↗
(client tls_client.HttpClient, api_key string, proxy string)

Source from the content-addressed store, hash-verified

28 return header
29}
30func GerOrganizationId(client tls_client.HttpClient, api_key string, proxy string) (string, error) {
31 header := baseHeader()
32
33 if proxy != "" {
34 client.SetProxy(proxy)
35 }
36 req, err := http.NewRequest(http.MethodGet, "https://api.groq.com/platform/v1/user/profile", nil)
37 header.Set("authorization", "Bearer "+api_key)
38 req.Header = header
39 if err != nil {
40 return "", err
41 }
42 response, err := client.Do(req)
43 if err != nil {
44 return "", err
45 }
46 if response.StatusCode != 200 {
47 return "", errors.New("response status code is not 200")
48 }
49 var result groq.Profile
50 err = json.NewDecoder(response.Body).Decode(&result)
51 if err != nil {
52 return "", err
53 }
54 return result.User.Orgs.Data[0].Id, nil
55}
56
57func GetSessionToken(client tls_client.HttpClient, api_key string, proxy string) (groq.AuthenticateResponse, error) {
58 if proxy != "" {

Callers

nothing calls this directly

Calls 3

baseHeaderFunction · 0.85
SetProxyMethod · 0.80
SetMethod · 0.80

Tested by

no test coverage detected