ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.555.3

This commit is contained in:
speakeasybot
2025-06-05 00:12:09 +00:00
parent d9f461ec33
commit 8c4caee48d
149 changed files with 3663 additions and 2976 deletions

99
log.go
View File

@@ -6,6 +6,7 @@ import (
"bytes"
"context"
"fmt"
"github.com/LukeHagar/plexgo/internal/config"
"github.com/LukeHagar/plexgo/internal/hooks"
"github.com/LukeHagar/plexgo/internal/utils"
"github.com/LukeHagar/plexgo/models/operations"
@@ -17,12 +18,16 @@ import (
// Log - Submit logs to the Log Handler for Plex Media Server
type Log struct {
sdkConfiguration sdkConfiguration
rootSDK *PlexAPI
sdkConfiguration config.SDKConfiguration
hooks *hooks.Hooks
}
func newLog(sdkConfig sdkConfiguration) *Log {
func newLog(rootSDK *PlexAPI, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Log {
return &Log{
rootSDK: rootSDK,
sdkConfiguration: sdkConfig,
hooks: hooks,
}
}
@@ -59,11 +64,13 @@ func (s *Log) LogLine(ctx context.Context, level operations.Level, message strin
}
hookCtx := hooks.HookContext{
BaseURL: baseURL,
Context: ctx,
OperationID: "logLine",
OAuth2Scopes: []string{},
SecuritySource: s.sdkConfiguration.Security,
SDK: s.rootSDK,
SDKConfiguration: s.sdkConfiguration,
BaseURL: baseURL,
Context: ctx,
OperationID: "logLine",
OAuth2Scopes: []string{},
SecuritySource: s.sdkConfiguration.Security,
}
timeout := o.Timeout
@@ -116,15 +123,17 @@ func (s *Log) LogLine(ctx context.Context, level operations.Level, message strin
"504",
},
}, func() (*http.Response, error) {
if req.Body != nil {
if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil {
copyBody, err := req.GetBody()
if err != nil {
return nil, err
}
req.Body = copyBody
}
req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
if err != nil {
if retry.IsPermanentError(err) || retry.IsTemporaryError(err) {
return nil, err
@@ -141,7 +150,7 @@ func (s *Log) LogLine(ctx context.Context, level operations.Level, message strin
err = fmt.Errorf("error sending request: no response")
}
_, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err)
_, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err)
}
return httpRes, err
})
@@ -149,13 +158,13 @@ func (s *Log) LogLine(ctx context.Context, level operations.Level, message strin
if err != nil {
return nil, err
} else {
httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
if err != nil {
return nil, err
}
}
} else {
req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
if err != nil {
return nil, err
}
@@ -168,17 +177,17 @@ func (s *Log) LogLine(ctx context.Context, level operations.Level, message strin
err = fmt.Errorf("error sending request: no response")
}
_, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err)
_, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err)
return nil, err
} else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) {
_httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil)
_httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil)
if err != nil {
return nil, err
} else if _httpRes != nil {
httpRes = _httpRes
}
} else {
httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
if err != nil {
return nil, err
}
@@ -308,11 +317,13 @@ func (s *Log) LogMultiLine(ctx context.Context, request string, opts ...operatio
}
hookCtx := hooks.HookContext{
BaseURL: baseURL,
Context: ctx,
OperationID: "logMultiLine",
OAuth2Scopes: []string{},
SecuritySource: s.sdkConfiguration.Security,
SDK: s.rootSDK,
SDKConfiguration: s.sdkConfiguration,
BaseURL: baseURL,
Context: ctx,
OperationID: "logMultiLine",
OAuth2Scopes: []string{},
SecuritySource: s.sdkConfiguration.Security,
}
bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "string", `request:"mediaType=text/plain"`)
if err != nil {
@@ -368,15 +379,17 @@ func (s *Log) LogMultiLine(ctx context.Context, request string, opts ...operatio
"504",
},
}, func() (*http.Response, error) {
if req.Body != nil {
if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil {
copyBody, err := req.GetBody()
if err != nil {
return nil, err
}
req.Body = copyBody
}
req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
if err != nil {
if retry.IsPermanentError(err) || retry.IsTemporaryError(err) {
return nil, err
@@ -393,7 +406,7 @@ func (s *Log) LogMultiLine(ctx context.Context, request string, opts ...operatio
err = fmt.Errorf("error sending request: no response")
}
_, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err)
_, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err)
}
return httpRes, err
})
@@ -401,13 +414,13 @@ func (s *Log) LogMultiLine(ctx context.Context, request string, opts ...operatio
if err != nil {
return nil, err
} else {
httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
if err != nil {
return nil, err
}
}
} else {
req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
if err != nil {
return nil, err
}
@@ -420,17 +433,17 @@ func (s *Log) LogMultiLine(ctx context.Context, request string, opts ...operatio
err = fmt.Errorf("error sending request: no response")
}
_, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err)
_, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err)
return nil, err
} else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) {
_httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil)
_httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil)
if err != nil {
return nil, err
} else if _httpRes != nil {
httpRes = _httpRes
}
} else {
httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
if err != nil {
return nil, err
}
@@ -540,11 +553,13 @@ func (s *Log) EnablePaperTrail(ctx context.Context, opts ...operations.Option) (
}
hookCtx := hooks.HookContext{
BaseURL: baseURL,
Context: ctx,
OperationID: "enablePaperTrail",
OAuth2Scopes: []string{},
SecuritySource: s.sdkConfiguration.Security,
SDK: s.rootSDK,
SDKConfiguration: s.sdkConfiguration,
BaseURL: baseURL,
Context: ctx,
OperationID: "enablePaperTrail",
OAuth2Scopes: []string{},
SecuritySource: s.sdkConfiguration.Security,
}
timeout := o.Timeout
@@ -593,15 +608,17 @@ func (s *Log) EnablePaperTrail(ctx context.Context, opts ...operations.Option) (
"504",
},
}, func() (*http.Response, error) {
if req.Body != nil {
if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil {
copyBody, err := req.GetBody()
if err != nil {
return nil, err
}
req.Body = copyBody
}
req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
if err != nil {
if retry.IsPermanentError(err) || retry.IsTemporaryError(err) {
return nil, err
@@ -618,7 +635,7 @@ func (s *Log) EnablePaperTrail(ctx context.Context, opts ...operations.Option) (
err = fmt.Errorf("error sending request: no response")
}
_, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err)
_, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err)
}
return httpRes, err
})
@@ -626,13 +643,13 @@ func (s *Log) EnablePaperTrail(ctx context.Context, opts ...operations.Option) (
if err != nil {
return nil, err
} else {
httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
if err != nil {
return nil, err
}
}
} else {
req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
if err != nil {
return nil, err
}
@@ -645,17 +662,17 @@ func (s *Log) EnablePaperTrail(ctx context.Context, opts ...operations.Option) (
err = fmt.Errorf("error sending request: no response")
}
_, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err)
_, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err)
return nil, err
} else if utils.MatchStatusCodes([]string{"400", "401", "403", "4XX", "5XX"}, httpRes.StatusCode) {
_httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil)
_httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil)
if err != nil {
return nil, err
} else if _httpRes != nil {
httpRes = _httpRes
}
} else {
httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
if err != nil {
return nil, err
}