Documentation
¶
Overview ¶
Package newapi provides a Go SDK for the New API documentation surface.
In addition to the typed helper methods in this package, the client also exposes generated operation trees that mirror the official API reference.
Index ¶
- Variables
- type APIError
- type Auth
- type CallConfig
- type Client
- func (c *Client) AdminCreateRedemptions(name string, quota int, count int, expiredTime int64) ([]string, error)
- func (c *Client) AdminCreateRedemptionsContext(ctx context.Context, input CreateRedemptionsRequest) ([]string, error)
- func (c *Client) AdminCreateUser(username, password, displayName string) error
- func (c *Client) AdminCreateUserAndGet(username, password, displayName string) (*User, error)
- func (c *Client) AdminCreateUserAndGetContext(ctx context.Context, username, password, displayName string) (*User, error)
- func (c *Client) AdminCreateUserContext(ctx context.Context, input CreateUserRequest) error
- func (c *Client) AdminGetLogs(params url.Values) (*LogPageInfo, error)
- func (c *Client) AdminGetLogsContext(ctx context.Context, params url.Values) (*LogPageInfo, error)
- func (c *Client) AdminGetUser(userID int) (*User, error)
- func (c *Client) AdminGetUserContext(ctx context.Context, userID int) (*User, error)
- func (c *Client) AdminManageUser(userID int, action string) error
- func (c *Client) AdminManageUserContext(ctx context.Context, userID int, action string) error
- func (c *Client) AdminSearchUser(keyword string) (*User, error)
- func (c *Client) AdminSearchUserContext(ctx context.Context, keyword string) (*User, error)
- func (c *Client) AdminUpdateUser(userID int, username, displayName, group, remark string, quota int) error
- func (c *Client) AdminUpdateUserContext(ctx context.Context, input UpdateUserRequest) error
- func (c *Client) CreateTokenWithToken(rawToken string, userID int, name string, unlimitedQuota bool) error
- func (c *Client) CreateTokenWithTokenContext(ctx context.Context, rawToken string, userID int, name string, ...) (*Token, error)
- func (c *Client) GetUserWithToken(rawToken string, userID int) (*User, error)
- func (c *Client) GetUserWithTokenContext(ctx context.Context, rawToken string, userID int) (*User, error)
- func (c *Client) ListTokensWithToken(rawToken string, userID, page, pageSize int) ([]Token, error)
- func (c *Client) ListTokensWithTokenContext(ctx context.Context, rawToken string, userID, page, pageSize int) ([]Token, error)
- func (c *Client) UserCreateToken(accessToken string, userID int, name string, unlimitedQuota bool) (*Token, error)
- func (c *Client) UserCreateTokenContext(ctx context.Context, accessToken string, userID int, input CreateTokenRequest) (*Token, error)
- func (c *Client) UserDeleteToken(accessToken string, userID int, tokenID int) error
- func (c *Client) UserDeleteTokenContext(ctx context.Context, accessToken string, userID int, tokenID int) error
- func (c *Client) UserGenerateAccessToken(sessionCookie string, userID int) (string, error)
- func (c *Client) UserGenerateAccessTokenContext(ctx context.Context, sessionCookie string, userID int) (string, error)
- func (c *Client) UserGetSelf(accessToken string, userID int) (*User, error)
- func (c *Client) UserGetSelfContext(ctx context.Context, accessToken string, userID int) (*User, error)
- func (c *Client) UserListModels(accessToken string, userID int) ([]Model, error)
- func (c *Client) UserListModelsContext(ctx context.Context, accessToken string, userID int) ([]Model, error)
- func (c *Client) UserListTokens(accessToken string, userID int, page, pageSize int) ([]Token, error)
- func (c *Client) UserListTokensPage(accessToken string, userID int, page, pageSize int) (*TokenPageInfo, error)
- func (c *Client) UserListTokensPageContext(ctx context.Context, accessToken string, userID int, page, pageSize int) (*TokenPageInfo, error)
- func (c *Client) UserLogin(username, password string) (string, error)
- func (c *Client) UserLoginContext(ctx context.Context, username, password string) (string, error)
- func (c *Client) UserRedeemRedemption(accessToken string, userID int, key string) (int, error)
- func (c *Client) UserRedeemRedemptionContext(ctx context.Context, accessToken string, userID int, key string) (int, error)
- type CreateRedemptionsRequest
- type CreateTokenRequest
- type CreateUserRequest
- type Log
- type LogPageInfo
- type Model
- type Operation
- type Option
- type RawResponse
- type Session
- type Token
- type TokenPageInfo
- type UpdateUserRequest
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var ( WithHTTPClient = core.WithHTTPClient WithTimeout = core.WithTimeout WithAdminAuth = core.WithAdminAuth WithDefaultAuth = core.WithDefaultAuth WithBearerToken = core.WithBearerToken WithSessionCookie = core.WithSessionCookie WithDefaultUserID = core.WithDefaultUserID WithUserAgent = core.WithUserAgent )
View Source
var ErrNotFound = core.ErrNotFound
Functions ¶
This section is empty.
Types ¶
type CallConfig ¶
type CallConfig = core.CallConfig
type Client ¶
func (*Client) AdminCreateRedemptions ¶
func (*Client) AdminCreateRedemptionsContext ¶
func (*Client) AdminCreateUser ¶
func (*Client) AdminCreateUserAndGet ¶
func (*Client) AdminCreateUserAndGetContext ¶
func (*Client) AdminCreateUserContext ¶
func (c *Client) AdminCreateUserContext(ctx context.Context, input CreateUserRequest) error
func (*Client) AdminGetLogs ¶
func (c *Client) AdminGetLogs(params url.Values) (*LogPageInfo, error)
func (*Client) AdminGetLogsContext ¶
func (*Client) AdminGetUserContext ¶
func (*Client) AdminManageUserContext ¶
func (*Client) AdminSearchUserContext ¶
func (*Client) AdminUpdateUser ¶
func (*Client) AdminUpdateUserContext ¶
func (c *Client) AdminUpdateUserContext(ctx context.Context, input UpdateUserRequest) error
func (*Client) CreateTokenWithToken ¶
func (*Client) CreateTokenWithTokenContext ¶
func (*Client) GetUserWithToken ¶
func (*Client) GetUserWithTokenContext ¶
func (*Client) ListTokensWithToken ¶
func (*Client) ListTokensWithTokenContext ¶
func (*Client) UserCreateToken ¶
func (*Client) UserCreateTokenContext ¶
func (*Client) UserDeleteToken ¶
func (*Client) UserDeleteTokenContext ¶
func (*Client) UserGenerateAccessToken ¶
func (*Client) UserGenerateAccessTokenContext ¶
func (*Client) UserGetSelf ¶
func (*Client) UserGetSelfContext ¶
func (*Client) UserListModels ¶
func (*Client) UserListModelsContext ¶
func (*Client) UserListTokens ¶
func (*Client) UserListTokensPage ¶
func (*Client) UserListTokensPageContext ¶
func (*Client) UserLoginContext ¶
func (*Client) UserRedeemRedemption ¶
type CreateTokenRequest ¶
type CreateUserRequest ¶
type Log ¶
type Log struct {
ID int `json:"id"`
CreatedAt int64 `json:"created_at"`
Type int `json:"type"`
Content string `json:"content"`
Username string `json:"username"`
TokenName string `json:"token_name"`
ModelName string `json:"model_name"`
Quota int `json:"quota"`
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
UseTime int `json:"use_time"`
IsStream bool `json:"is_stream"`
ChannelID int `json:"channel"`
TokenID int `json:"token_id"`
Group string `json:"group"`
RequestID string `json:"request_id,omitempty"`
}
type LogPageInfo ¶
type RawResponse ¶
type RawResponse = core.RawResponse
type TokenPageInfo ¶
type UpdateUserRequest ¶
type User ¶
type User struct {
ID int `json:"id"`
Username string `json:"username"`
DisplayName string `json:"display_name"`
AccessToken string `json:"access_token"`
Quota int `json:"quota"`
UsedQuota int `json:"used_quota"`
Group string `json:"group"`
Status int `json:"status"`
Remark string `json:"remark,omitempty"`
}
Directories
¶
| Path | Synopsis |
|---|---|
|
Code generated by go run ./tools/generate-operations; DO NOT EDIT.
|
Code generated by go run ./tools/generate-operations; DO NOT EDIT. |
|
Code generated by go run ./tools/generate-operations; DO NOT EDIT.
|
Code generated by go run ./tools/generate-operations; DO NOT EDIT. |
Click to show internal directories.
Click to hide internal directories.