Documentation ¶
Index ¶
- Constants
- func Delete[T any](client *resty.Client, endpoint string) error
- func GetSingle[T any](client *resty.Client, endpoint string) (*T, error)
- func Post[T any](client *resty.Client, endpoint string, body interface{}) (*T, error)
- type APIKeyActor
- type APIKeyCreated
- type APIKeyDeleted
- type APIKeyUpdated
- type Actor
- type AuditLog
- type AuditLogListParams
- type AuditLogListResponse
- type AuditProject
- type AuditUser
- type Client
- func (c *Client) ArchiveProject(id string) (*Project, error)
- func (c *Client) CreateInvite(email string, role string) (*Invite, error)
- func (c *Client) CreateProject(name string) (*Project, error)
- func (c *Client) CreateProjectServiceAccount(projectID string, name string) (*ProjectServiceAccount, error)
- func (c *Client) CreateProjectUser(projectID string, userID string, role string) (*ProjectUser, error)
- func (c *Client) DeleteInvite(id string) error
- func (c *Client) DeleteProjectApiKey(projectID string, apiKeyID string) error
- func (c *Client) DeleteProjectServiceAccount(projectID string, serviceAccountID string) error
- func (c *Client) DeleteProjectUser(projectID string, userID string) error
- func (c *Client) DeleteUser(id string) error
- func (c *Client) ListAuditLogs(params *AuditLogListParams) (*ListResponse[AuditLog], error)
- func (c *Client) ListInvites() ([]Invite, error)
- func (c *Client) ListProjectApiKeys(projectID string, limit int, after string) (*ListResponse[ProjectApiKey], error)
- func (c *Client) ListProjectServiceAccounts(projectID string, limit int, after string) (*ListResponse[ProjectServiceAccount], error)
- func (c *Client) ListProjectUsers(projectID string, limit int, after string) (*ListResponse[ProjectUser], error)
- func (c *Client) ListProjects(limit int, after string, includeArchived bool) (*ListResponse[Project], error)
- func (c *Client) ListUsers(limit int, after string) (*ListResponse[User], error)
- func (c *Client) ModifyProject(id string, name string) (*Project, error)
- func (c *Client) ModifyProjectUser(projectID string, userID string, role string) (*ProjectUser, error)
- func (c *Client) ModifyUserRole(id string, role string) error
- func (c *Client) RetrieveInvite(id string) (*Invite, error)
- func (c *Client) RetrieveProject(id string) (*Project, error)
- func (c *Client) RetrieveProjectApiKey(projectID string, apiKeyID string) (*ProjectApiKey, error)
- func (c *Client) RetrieveProjectServiceAccount(projectID string, serviceAccountID string) (*ProjectServiceAccount, error)
- func (c *Client) RetrieveProjectUser(projectID string, userID string) (*ProjectUser, error)
- func (c *Client) RetrieveUser(id string) (*User, error)
- type EffectiveAt
- type Invite
- type InviteAccepted
- type InviteDeleted
- type InviteSent
- type ListResponse
- type LoginFailed
- type LoginSucceeded
- type LogoutFailed
- type OrganizationUpdated
- type Owner
- type OwnerType
- type Project
- type ProjectApiKey
- type ProjectArchived
- type ProjectCreated
- type ProjectServiceAccount
- type ProjectServiceAccountAPIKey
- type ProjectUpdated
- type ProjectUser
- type RateLimitDeleted
- type RateLimitUpdated
- type RoleType
- type ServiceAccountCreated
- type ServiceAccountDeleted
- type ServiceAccountUpdated
- type Session
- type UnixSeconds
- type User
- type UserAdded
- type UserDeleted
- type UserUpdated
Constants ¶
const AuditLogsListEndpoint = "/organization/audit_logs"
const DefaultBaseURL = "https://api.openai.com/v1"
const InviteListEndpoint = "/organization/invites"
const ProjectApiKeysListEndpoint = "/organization/projects/%s/api_keys"
const ProjectServiceAccountsListEndpoint = "/organization/projects/%s/service_accounts"
const ProjectUsersListEndpoint = "/organization/projects/%s/users"
const ProjectsListEndpoint = "/organization/projects"
const UsersListEndpoint = "/organization/users"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIKeyActor ¶ added in v0.2.11
APIKeyActor represents API key information in the actor field
type APIKeyCreated ¶
type APIKeyCreated struct { ID string `json:"id"` Data struct { Scopes []string `json:"scopes"` } `json:"data"` }
Event types and their corresponding payload structures
type APIKeyDeleted ¶
type APIKeyDeleted struct {
ID string `json:"id"`
}
type APIKeyUpdated ¶ added in v0.2.11
type Actor ¶
type Actor struct { Type string `json:"type"` // "session" or "api_key" Session *Session `json:"session,omitempty"` APIKey *APIKeyActor `json:"api_key,omitempty"` }
Actor represents the entity performing the action
type AuditLog ¶
type AuditLog struct { ID string `json:"id"` Type string `json:"type"` EffectiveAt UnixSeconds `json:"effective_at"` Project *AuditProject `json:"project,omitempty"` Actor Actor `json:"actor"` Details interface{} `json:"-"` // This will be unmarshaled based on Type }
AuditLog represents the main audit log object
func (*AuditLog) UnmarshalJSON ¶ added in v0.2.11
Add UnmarshalJSON to AuditLog to handle the event-specific details
type AuditLogListParams ¶
type AuditLogListParams struct { EffectiveAt *EffectiveAt `json:"effective_at,omitempty"` ProjectIDs []string `json:"project_ids,omitempty"` EventTypes []string `json:"event_types,omitempty"` ActorIDs []string `json:"actor_ids,omitempty"` ActorEmails []string `json:"actor_emails,omitempty"` ResourceIDs []string `json:"resource_ids,omitempty"` Limit int `json:"limit,omitempty"` After string `json:"after,omitempty"` Before string `json:"before,omitempty"` }
AuditLogListParams represents the query parameters for listing audit logs
type AuditLogListResponse ¶ added in v0.2.11
type AuditLogListResponse struct { Object string `json:"object"` Data []AuditLog `json:"data"` FirstID string `json:"first_id"` LastID string `json:"last_id"` HasMore bool `json:"has_more"` }
AuditLogListResponse represents the paginated response from the audit logs endpoint
type AuditProject ¶ added in v0.2.11
AuditProject represents project information in audit logs
type Client ¶
type Client struct { BaseURL string // contains filtered or unexported fields }
func (*Client) CreateInvite ¶
func (*Client) CreateProjectServiceAccount ¶
func (c *Client) CreateProjectServiceAccount(projectID string, name string) (*ProjectServiceAccount, error)
func (*Client) CreateProjectUser ¶
func (*Client) DeleteInvite ¶
func (*Client) DeleteProjectApiKey ¶
func (*Client) DeleteProjectServiceAccount ¶
func (*Client) DeleteProjectUser ¶
func (*Client) DeleteUser ¶
func (*Client) ListAuditLogs ¶
func (c *Client) ListAuditLogs(params *AuditLogListParams) (*ListResponse[AuditLog], error)
func (*Client) ListInvites ¶
func (*Client) ListProjectApiKeys ¶
func (c *Client) ListProjectApiKeys(projectID string, limit int, after string) (*ListResponse[ProjectApiKey], error)
func (*Client) ListProjectServiceAccounts ¶
func (c *Client) ListProjectServiceAccounts(projectID string, limit int, after string) (*ListResponse[ProjectServiceAccount], error)
func (*Client) ListProjectUsers ¶
func (c *Client) ListProjectUsers(projectID string, limit int, after string) (*ListResponse[ProjectUser], error)
func (*Client) ListProjects ¶
func (*Client) ModifyProject ¶
func (*Client) ModifyProjectUser ¶
func (*Client) RetrieveProjectApiKey ¶
func (c *Client) RetrieveProjectApiKey(projectID string, apiKeyID string) (*ProjectApiKey, error)
func (*Client) RetrieveProjectServiceAccount ¶
func (c *Client) RetrieveProjectServiceAccount(projectID string, serviceAccountID string) (*ProjectServiceAccount, error)
func (*Client) RetrieveProjectUser ¶
func (c *Client) RetrieveProjectUser(projectID string, userID string) (*ProjectUser, error)
type EffectiveAt ¶ added in v0.2.14
type Invite ¶
type Invite struct { ObjectType string `json:"object"` ID string `json:"id"` Email string `json:"email"` Role string `json:"role"` Status string `json:"status"` CreatedAt UnixSeconds `json:"created_at"` ExpiresAt UnixSeconds `json:"expires_at"` AcceptedAt *UnixSeconds `json:"accepted_at,omitempty"` }
type InviteAccepted ¶ added in v0.2.11
type InviteAccepted struct {
ID string `json:"id"`
}
type InviteDeleted ¶ added in v0.2.11
type InviteDeleted struct {
ID string `json:"id"`
}
type InviteSent ¶
type ListResponse ¶
type ListResponse[T any] struct { Object string `json:"object"` Data []T `json:"data"` FirstID string `json:"first_id"` LastID string `json:"last_id"` HasMore bool `json:"has_more"` }
Common response type for paginated lists
type LoginFailed ¶ added in v0.2.11
type LoginSucceeded ¶
type LogoutFailed ¶ added in v0.2.11
type OrganizationUpdated ¶
type Owner ¶
type Owner struct { Object string `json:"object"` ID string `json:"id"` Name string `json:"name"` Type OwnerType `json:"type"` User *User `json:"user,omitempty"` SA *ProjectServiceAccount `json:"service_account,omitempty"` }
Common owner types
type Project ¶
type Project struct { Object string `json:"object"` ID string `json:"id"` Name string `json:"name"` CreatedAt UnixSeconds `json:"created_at"` ArchivedAt *UnixSeconds `json:"archived_at,omitempty"` Status string `json:"status"` }
type ProjectApiKey ¶
type ProjectArchived ¶ added in v0.2.11
type ProjectArchived struct {
ID string `json:"id"`
}
ProjectArchived represents the details for project.archived events
type ProjectCreated ¶ added in v0.2.11
type ProjectCreated struct { ID string `json:"id"` Data struct { Name string `json:"name"` Title string `json:"title"` } `json:"data"` }
ProjectCreated represents the details for project.created events
type ProjectServiceAccount ¶
type ProjectServiceAccount struct { Object string `json:"object"` ID string `json:"id"` Name string `json:"name"` Role string `json:"role"` CreatedAt UnixSeconds `json:"created_at"` APIKey *ProjectServiceAccountAPIKey `json:"api_key,omitempty"` }
type ProjectServiceAccountAPIKey ¶ added in v0.2.6
type ProjectServiceAccountAPIKey struct { Object string `json:"object"` Value string `json:"value"` Name *string `json:"name"` CreatedAt UnixSeconds `json:"created_at"` ID string `json:"id"` }
type ProjectUpdated ¶ added in v0.2.11
type ProjectUpdated struct { ID string `json:"id"` ChangesRequested struct { Title string `json:"title"` } `json:"changes_requested"` }
ProjectUpdated represents the details for project.updated events
type ProjectUser ¶
type RateLimitDeleted ¶ added in v0.2.11
type RateLimitDeleted struct {
ID string `json:"id"`
}
RateLimitDeleted represents the details for rate_limit.deleted events
type RateLimitUpdated ¶ added in v0.2.11
type RateLimitUpdated struct { ID string `json:"id"` ChangesRequested struct { MaxRequestsPer1Minute int `json:"max_requests_per_1_minute,omitempty"` MaxTokensPer1Minute int `json:"max_tokens_per_1_minute,omitempty"` MaxImagesPer1Minute int `json:"max_images_per_1_minute,omitempty"` MaxAudioMegabytesPer1Minute int `json:"max_audio_megabytes_per_1_minute,omitempty"` MaxRequestsPer1Day int `json:"max_requests_per_1_day,omitempty"` Batch1DayMaxInputTokens int `json:"batch_1_day_max_input_tokens,omitempty"` } `json:"changes_requested"` }
RateLimitUpdated represents the details for rate_limit.updated events
type ServiceAccountCreated ¶ added in v0.2.11
type ServiceAccountCreated struct { ID string `json:"id"` Data struct { Role string `json:"role"` // Either "owner" or "member" } `json:"data"` }
ServiceAccountCreated represents the details for service_account.created events
type ServiceAccountDeleted ¶ added in v0.2.11
type ServiceAccountDeleted struct {
ID string `json:"id"`
}
ServiceAccountDeleted represents the details for service_account.deleted events
type ServiceAccountUpdated ¶ added in v0.2.11
type ServiceAccountUpdated struct { ID string `json:"id"` ChangesRequested struct { Role string `json:"role"` // Either "owner" or "member" } `json:"changes_requested"` }
ServiceAccountUpdated represents the details for service_account.updated events
type Session ¶ added in v0.2.11
type Session struct { User AuditUser `json:"user"` IPAddress string `json:"ip_address"` UserAgent string `json:"user_agent"` }
Session represents user session information
type UnixSeconds ¶
Common time handling
func (UnixSeconds) MarshalJSON ¶
func (us UnixSeconds) MarshalJSON() ([]byte, error)
func (UnixSeconds) String ¶
func (ct UnixSeconds) String() string
func (UnixSeconds) Time ¶
func (ct UnixSeconds) Time() time.Time
func (*UnixSeconds) UnmarshalJSON ¶
func (us *UnixSeconds) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler interface
type User ¶
type User struct { Object string `json:"object"` ID string `json:"id"` Name string `json:"name"` Email string `json:"email"` Role string `json:"role"` AddedAt UnixSeconds `json:"added_at"` }
User represents a user in the OpenAI organization
type UserAdded ¶ added in v0.2.11
type UserAdded struct { ID string `json:"id"` Data struct { Role string `json:"role"` // Either "owner" or "member" } `json:"data"` }
UserAdded represents the details for user.added events
type UserDeleted ¶ added in v0.2.11
type UserDeleted struct {
ID string `json:"id"`
}
UserDeleted represents the details for user.deleted events
type UserUpdated ¶ added in v0.2.11
type UserUpdated struct { ID string `json:"id"` ChangesRequested struct { Role string `json:"role"` // Either "owner" or "member" } `json:"changes_requested"` }
UserUpdated represents the details for user.updated events