File size: 1,826 Bytes
1089302
 
 
 
 
 
 
 
 
 
 
3e5ab39
1089302
3e5ab39
1089302
 
3e5ab39
 
 
 
1089302
3e5ab39
1089302
a64baa3
3e5ab39
a64baa3
 
 
3e5ab39
a64baa3
1089302
3e5ab39
 
1089302
 
3e5ab39
 
1089302
 
9a36c01
3e5ab39
1089302
 
 
3e5ab39
9abfbc9
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
package executor

import (
	"context"
	"net/http"

	"github.com/router-for-me/CLIProxyAPI/v6/internal/config"
	cliproxyauth "github.com/router-for-me/CLIProxyAPI/v6/sdk/cliproxy/auth"
	cliproxyexecutor "github.com/router-for-me/CLIProxyAPI/v6/sdk/cliproxy/executor"
)

// IFlowExecutor is a compatibility wrapper delegating to IFlowExecutorRefactored.
type IFlowExecutor struct {
	ref *IFlowExecutorRefactored
}

// NewIFlowExecutor creates a legacy-compatible IFlow executor wrapper.
func NewIFlowExecutor(cfg *config.Config) *IFlowExecutor {
	return &IFlowExecutor{ref: NewIFlowExecutorRefactored(cfg)}
}

func (e *IFlowExecutor) Identifier() string { return e.ref.Identifier() }

func (e *IFlowExecutor) PrepareRequest(req *http.Request, auth *cliproxyauth.Auth) error {
	return e.ref.PrepareRequest(req, auth)
}

func (e *IFlowExecutor) HttpRequest(ctx context.Context, auth *cliproxyauth.Auth, req *http.Request) (*http.Response, error) {
	return e.ref.HttpRequest(ctx, auth, req)
}

func (e *IFlowExecutor) Execute(ctx context.Context, auth *cliproxyauth.Auth, req cliproxyexecutor.Request, opts cliproxyexecutor.Options) (cliproxyexecutor.Response, error) {
	return e.ref.Execute(ctx, auth, req, opts)
}

func (e *IFlowExecutor) ExecuteStream(ctx context.Context, auth *cliproxyauth.Auth, req cliproxyexecutor.Request, opts cliproxyexecutor.Options) (*cliproxyexecutor.StreamResult, error) {
	return e.ref.ExecuteStream(ctx, auth, req, opts)
}

func (e *IFlowExecutor) CountTokens(ctx context.Context, auth *cliproxyauth.Auth, req cliproxyexecutor.Request, opts cliproxyexecutor.Options) (cliproxyexecutor.Response, error) {
	return e.ref.CountTokens(ctx, auth, req, opts)
}

func (e *IFlowExecutor) Refresh(ctx context.Context, auth *cliproxyauth.Auth) (*cliproxyauth.Auth, error) {
	return e.ref.Refresh(ctx, auth)
}