mirror of
https://github.com/LukeHagar/plexgo.git
synced 2025-12-06 04:20:46 +00:00
ci: regenerated with OpenAPI Doc 0.0.3, Speakeasy CLI 1.193.4
This commit is contained in:
54
updater.go
54
updater.go
@@ -30,7 +30,11 @@ func newUpdater(sdkConfig sdkConfiguration) *Updater {
|
||||
// GetUpdateStatus - Querying status of updates
|
||||
// Querying status of updates
|
||||
func (s *Updater) GetUpdateStatus(ctx context.Context) (*operations.GetUpdateStatusResponse, error) {
|
||||
hookCtx := hooks.HookContext{OperationID: "getUpdateStatus"}
|
||||
hookCtx := hooks.HookContext{
|
||||
Context: ctx,
|
||||
OperationID: "getUpdateStatus",
|
||||
SecuritySource: s.sdkConfiguration.Security,
|
||||
}
|
||||
|
||||
baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails())
|
||||
opURL, err := url.JoinPath(baseURL, "/updater/status")
|
||||
@@ -45,13 +49,13 @@ func (s *Updater) GetUpdateStatus(ctx context.Context) (*operations.GetUpdateSta
|
||||
req.Header.Set("Accept", "application/json")
|
||||
req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent)
|
||||
|
||||
req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{hookCtx}, req)
|
||||
client := s.sdkConfiguration.SecurityClient
|
||||
|
||||
req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
client := s.sdkConfiguration.SecurityClient
|
||||
|
||||
httpRes, err := client.Do(req)
|
||||
if err != nil || httpRes == nil {
|
||||
if err != nil {
|
||||
@@ -60,15 +64,15 @@ func (s *Updater) GetUpdateStatus(ctx context.Context) (*operations.GetUpdateSta
|
||||
err = fmt.Errorf("error sending request: no response")
|
||||
}
|
||||
|
||||
_, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{hookCtx}, nil, err)
|
||||
_, err = s.sdkConfiguration.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{hookCtx}, httpRes, nil)
|
||||
httpRes, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{hookCtx}, httpRes)
|
||||
httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -128,7 +132,11 @@ func (s *Updater) GetUpdateStatus(ctx context.Context) (*operations.GetUpdateSta
|
||||
// CheckForUpdates - Checking for updates
|
||||
// Checking for updates
|
||||
func (s *Updater) CheckForUpdates(ctx context.Context, download *operations.Download) (*operations.CheckForUpdatesResponse, error) {
|
||||
hookCtx := hooks.HookContext{OperationID: "checkForUpdates"}
|
||||
hookCtx := hooks.HookContext{
|
||||
Context: ctx,
|
||||
OperationID: "checkForUpdates",
|
||||
SecuritySource: s.sdkConfiguration.Security,
|
||||
}
|
||||
|
||||
request := operations.CheckForUpdatesRequest{
|
||||
Download: download,
|
||||
@@ -151,13 +159,13 @@ func (s *Updater) CheckForUpdates(ctx context.Context, download *operations.Down
|
||||
return nil, fmt.Errorf("error populating query params: %w", err)
|
||||
}
|
||||
|
||||
req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{hookCtx}, req)
|
||||
client := s.sdkConfiguration.SecurityClient
|
||||
|
||||
req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
client := s.sdkConfiguration.SecurityClient
|
||||
|
||||
httpRes, err := client.Do(req)
|
||||
if err != nil || httpRes == nil {
|
||||
if err != nil {
|
||||
@@ -166,15 +174,15 @@ func (s *Updater) CheckForUpdates(ctx context.Context, download *operations.Down
|
||||
err = fmt.Errorf("error sending request: no response")
|
||||
}
|
||||
|
||||
_, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{hookCtx}, nil, err)
|
||||
_, err = s.sdkConfiguration.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{hookCtx}, httpRes, nil)
|
||||
httpRes, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{hookCtx}, httpRes)
|
||||
httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -223,7 +231,11 @@ func (s *Updater) CheckForUpdates(ctx context.Context, download *operations.Down
|
||||
// ApplyUpdates - Apply Updates
|
||||
// Note that these two parameters are effectively mutually exclusive. The `tonight` parameter takes precedence and `skip` will be ignored if `tonight` is also passed
|
||||
func (s *Updater) ApplyUpdates(ctx context.Context, tonight *operations.Tonight, skip *operations.Skip) (*operations.ApplyUpdatesResponse, error) {
|
||||
hookCtx := hooks.HookContext{OperationID: "applyUpdates"}
|
||||
hookCtx := hooks.HookContext{
|
||||
Context: ctx,
|
||||
OperationID: "applyUpdates",
|
||||
SecuritySource: s.sdkConfiguration.Security,
|
||||
}
|
||||
|
||||
request := operations.ApplyUpdatesRequest{
|
||||
Tonight: tonight,
|
||||
@@ -247,13 +259,13 @@ func (s *Updater) ApplyUpdates(ctx context.Context, tonight *operations.Tonight,
|
||||
return nil, fmt.Errorf("error populating query params: %w", err)
|
||||
}
|
||||
|
||||
req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{hookCtx}, req)
|
||||
client := s.sdkConfiguration.SecurityClient
|
||||
|
||||
req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
client := s.sdkConfiguration.SecurityClient
|
||||
|
||||
httpRes, err := client.Do(req)
|
||||
if err != nil || httpRes == nil {
|
||||
if err != nil {
|
||||
@@ -262,15 +274,15 @@ func (s *Updater) ApplyUpdates(ctx context.Context, tonight *operations.Tonight,
|
||||
err = fmt.Errorf("error sending request: no response")
|
||||
}
|
||||
|
||||
_, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{hookCtx}, nil, err)
|
||||
_, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err)
|
||||
return nil, err
|
||||
} else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "500", "5XX"}, httpRes.StatusCode) {
|
||||
httpRes, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{hookCtx}, httpRes, nil)
|
||||
httpRes, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{hookCtx}, httpRes)
|
||||
httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user