Skip to content

Commit

Permalink
add pagination example
Browse files Browse the repository at this point in the history
  • Loading branch information
jasdel committed Apr 23, 2020
1 parent 8657b0a commit 8ec2341
Show file tree
Hide file tree
Showing 3 changed files with 212 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func ExampleNewClient_customOptions() {
}

client := lexruntime.NewClient(cfg, func(o *lexruntime.ClientOptions) {
o.EndpointResolver
o.RegionID = "us-west-2"
})
res, err := client.GetSession(context.TODO(), &lexruntime.GetSessionInput{
BotAlias: aws.String("botAlias"),
Expand Down
176 changes: 176 additions & 0 deletions service/smithyprototype/lexruntimeservice/api_op_ListSessons.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package lexruntimeservice_test

import (
"context"
"fmt"
"log"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/smithyprototype/lexruntimeservice"
lexruntime "github.com/aws/aws-sdk-go-v2/service/smithyprototype/lexruntimeservice"
)

func ExampleListSessions_pagination() {
cfg, err := external.LoadDefaultAWSConfig()
if err != nil {
log.Fatalf("unable to load configuration, %v", err)
}

client := lexruntimeservice.NewClient(cfg)

// Create a paginator with the client and input parameters.
p := lexruntime.NewListSessionsPaginator(client, &lexruntime.ListSessions{
BotAlias: aws.String("botAlias"),
BotName: aws.String("botName"),
UserId: aws.String("userID"),
})

for p.HasMorePages() {
o, err := p.NextPage(context.TODO())
if err != nil {
log.Fatalf("failed to get next page, %v", err)
}
fmt.Println("Page:", o)
}
}

0 comments on commit 8ec2341

Please sign in to comment.