<commit_before>package activitystreams

import "fmt"

type (
	BaseObject struct {
		Context []string `json:"@context,omitempty"`
		Type    string   `json:"type"`
		ID      string   `json:"id"`
	}

	PublicKey struct {
		ID           string `json:"id"`
		Owner        string `json:"owner"`
		PublicKeyPEM string `json:"publicKeyPem"`
		privateKey   []byte
	}

	Image struct {
		Type      string `json:"type"`
		MediaType string `json:"mediaType"`
		URL       string `json:"url"`
	}
)

type OrderedCollection struct {
	BaseObject
	TotalItems int    `json:"totalItems"`
	First      string `json:"first"`
	Last       string `json:"last,omitempty"`
}

func NewOrderedCollection(accountRoot string, items int) *OrderedCollection {
	oc := OrderedCollection{
		BaseObject: BaseObject{
			Context: []string{
				"https://www.w3.org/ns/activitystreams",
			},
			ID:   accountRoot + "/outbox",
			Type: "OrderedCollection",
		},
		First:      accountRoot + "/outbox?page=1",
		TotalItems: items,
	}
	return &oc
}

type OrderedCollectionPage struct {
	BaseObject
	TotalItems   int        `json:"totalItems"`
	PartOf       string     `json:"partOf"`
	Next         string     `json:"next,omitempty"`
	Prev         string     `json:"prev,omitempty"`
	OrderedItems []Activity `json:"orderedItems"`
}

func NewOrderedCollectionPage(accountRoot string, items, page int) *OrderedCollectionPage {
	ocp := OrderedCollectionPage{
		BaseObject: BaseObject{
			Context: []string{
				"https://www.w3.org/ns/activitystreams",
			},
			ID:   fmt.Sprintf("%s/outbox?page=%d", accountRoot, page),
			Type: "OrderedCollectionPage",
		},
		TotalItems: items,
		PartOf:     accountRoot + "/outbox",
		Next:       fmt.Sprintf("%s/outbox?page=%d", accountRoot, page+1),
	}
	return &ocp
}
<commit_msg>Make OrderedCollection{Page} funcs generalized for any collection<commit_after>package activitystreams

import "fmt"

type (
	BaseObject struct {
		Context []string `json:"@context,omitempty"`
		Type    string   `json:"type"`
		ID      string   `json:"id"`
	}

	PublicKey struct {
		ID           string `json:"id"`
		Owner        string `json:"owner"`
		PublicKeyPEM string `json:"publicKeyPem"`
		privateKey   []byte
	}

	Image struct {
		Type      string `json:"type"`
		MediaType string `json:"mediaType"`
		URL       string `json:"url"`
	}
)

type OrderedCollection struct {
	BaseObject
	TotalItems int    `json:"totalItems"`
	First      string `json:"first"`
	Last       string `json:"last,omitempty"`
}

func NewOrderedCollection(accountRoot, collType string, items int) *OrderedCollection {
	oc := OrderedCollection{
		BaseObject: BaseObject{
			Context: []string{
				"https://www.w3.org/ns/activitystreams",
			},
			ID:   accountRoot + "/" + collType,
			Type: "OrderedCollection",
		},
		First:      accountRoot + "/" + collType + "?page=1",
		TotalItems: items,
	}
	return &oc
}

type OrderedCollectionPage struct {
	BaseObject
	TotalItems   int        `json:"totalItems"`
	PartOf       string     `json:"partOf"`
	Next         string     `json:"next,omitempty"`
	Prev         string     `json:"prev,omitempty"`
	OrderedItems []Activity `json:"orderedItems"`
}

func NewOrderedCollectionPage(accountRoot, collType string, items, page int) *OrderedCollectionPage {
	ocp := OrderedCollectionPage{
		BaseObject: BaseObject{
			Context: []string{
				"https://www.w3.org/ns/activitystreams",
			},
			ID:   fmt.Sprintf("%s/%s?page=%d", accountRoot, collType, page),
			Type: "OrderedCollectionPage",
		},
		TotalItems: items,
		PartOf:     accountRoot + "/" + collType,
		Next:       fmt.Sprintf("%s/%s?page=%d", accountRoot, collType, page+1),
	}
	return &ocp
}

{'fraction_non_alphanumeric': 0.13413963716327654, 'fraction_numerical': 0.0021990104452996153, 'mean_word_length': 3.531755915317559, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4403885', 'n_tokens_mistral': 1258, 'n_tokens_neox': 1170, 'n_words': 267}