8
8
"errors"
9
9
"fmt"
10
10
"net/http"
11
+ "slices"
11
12
12
13
"github.com/ScrapeGraphAI/scrapegraphai-go/internal/apijson"
13
14
"github.com/ScrapeGraphAI/scrapegraphai-go/internal/requestconfig"
@@ -38,15 +39,15 @@ func NewSmartscraperService(opts ...option.RequestOption) (r SmartscraperService
38
39
// Main scraping endpoint with LLM-powered content analysis. Supports various
39
40
// fetching providers, infinite scrolling, pagination, and custom output schemas.
40
41
func (r * SmartscraperService ) New (ctx context.Context , body SmartscraperNewParams , opts ... option.RequestOption ) (res * CompletedSmartscraper , err error ) {
41
- opts = append (r .Options [:] , opts ... )
42
+ opts = slices . Concat (r .Options , opts )
42
43
path := "smartscraper"
43
44
err = requestconfig .ExecuteNewRequest (ctx , http .MethodPost , path , body , & res , opts ... )
44
45
return
45
46
}
46
47
47
48
// Retrieve the status and results of a scraping operation
48
49
func (r * SmartscraperService ) Get (ctx context.Context , requestID string , opts ... option.RequestOption ) (res * SmartscraperGetResponseUnion , err error ) {
49
- opts = append (r .Options [:] , opts ... )
50
+ opts = slices . Concat (r .Options , opts )
50
51
if requestID == "" {
51
52
err = errors .New ("missing required request_id parameter" )
52
53
return
@@ -58,7 +59,7 @@ func (r *SmartscraperService) Get(ctx context.Context, requestID string, opts ..
58
59
59
60
// Retrieve the status and results of a scraping operation
60
61
func (r * SmartscraperService ) List (ctx context.Context , opts ... option.RequestOption ) (res * SmartscraperListResponseUnion , err error ) {
61
- opts = append (r .Options [:] , opts ... )
62
+ opts = slices . Concat (r .Options , opts )
62
63
path := "smartscraper"
63
64
err = requestconfig .ExecuteNewRequest (ctx , http .MethodGet , path , nil , & res , opts ... )
64
65
return
0 commit comments