-
Notifications
You must be signed in to change notification settings - Fork 4
/
config.go
50 lines (43 loc) · 999 Bytes
/
config.go
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
47
48
49
50
package yandexgpt
import "net/http"
type YandexGPTClientConfig struct {
OAuthToken string
ApiKey string
IAMToken string
HTTPClient *http.Client
}
func NewYandexGPTClientConfig() *YandexGPTClientConfig {
return &YandexGPTClientConfig{
HTTPClient: &http.Client{},
}
}
func NewYandexGPTClientConfigWithIAMToken(
iamToken string,
) *YandexGPTClientConfig {
return &YandexGPTClientConfig{
IAMToken: iamToken,
HTTPClient: &http.Client{},
}
}
func NewYandexGPTClientConfigWithAPIKey(
apiKey string,
) *YandexGPTClientConfig {
return &YandexGPTClientConfig{
ApiKey: apiKey,
HTTPClient: &http.Client{},
}
}
func NewYandexGPTClientConfigWithOAuthToken(
oauthToken string,
) *YandexGPTClientConfig {
return &YandexGPTClientConfig{
OAuthToken: oauthToken,
HTTPClient: &http.Client{},
}
}
// Setter for IAM token in config.
//
// Use it for manually updating token in config.
func (c *YandexGPTClientConfig) SetIAMToken(iamToken string) {
c.IAMToken = iamToken
}