Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Link header pagination #321

Merged
merged 8 commits into from
Jan 6, 2022

Conversation

smaeda-ks
Copy link
Contributor

@smaeda-ks smaeda-ks commented Dec 9, 2021

client example:

	paginator := client.NewListACLEntriesPaginator(
		&fastly.ListACLEntriesInput{
			ServiceID: serviceID,
			ACLID:     "your_acl_id",
			PerPage:   50,
		},
	)

	var es []*fastly.ACLEntry
	for paginator.HasNext() {
		data, err := paginator.GetNext()
		if err != nil {
			break
		}
		es = append(es, data...)
	}

Adding NewListACLEntriesPaginator and NewListDictionaryItemsPaginator.

@smaeda-ks smaeda-ks force-pushed the smaeda-ks/link-header-paginator branch from 2298c2b to 341b20f Compare December 21, 2021 08:50
@smaeda-ks smaeda-ks changed the title [WIP] Add support for Link header pagination Add support for Link header pagination Dec 22, 2021
@smaeda-ks smaeda-ks force-pushed the smaeda-ks/link-header-paginator branch 2 times, most recently from 7fdcf35 to d209ee3 Compare December 22, 2021 03:18
@smaeda-ks smaeda-ks force-pushed the smaeda-ks/link-header-paginator branch from d209ee3 to c1ccea3 Compare December 22, 2021 03:20
@smaeda-ks smaeda-ks marked this pull request as ready for review December 22, 2021 03:21
@smaeda-ks
Copy link
Contributor Author

@Integralist let me know if you have any questions.

Copy link
Collaborator

@Integralist Integralist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but have a couple of suggestions.

Out of interest, do you happen to know how to get the generated documentation to display an example snippet like in your PR description (not sure if that's done by adding the snippet into a code comment above the code function)?

fastly/dictionary_item.go Outdated Show resolved Hide resolved
fastly/acl_entry.go Outdated Show resolved Hide resolved
fastly/acl_entry.go Outdated Show resolved Hide resolved
fastly/acl_entry.go Outdated Show resolved Hide resolved
fastly/dictionary_item.go Outdated Show resolved Hide resolved
@smaeda-ks
Copy link
Contributor Author

smaeda-ks commented Jan 5, 2022

@Integralist Thanks. Applied all suggestions and added code examples. Tested this locally using godoc. This should work.
ref. https://go.dev/blog/examples

Screen Shot 2022-01-06 at 3 44 48

@Integralist Integralist merged commit b6bdca8 into fastly:main Jan 6, 2022
@Integralist Integralist added bug enhancement New feature or request and removed bug labels Jan 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants