tokportal

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 18 Imported by: 0

README

tokportal-go

Go Reference license

TokPortal is the managed social infrastructure API: real TikTok, Instagram and YouTube accounts created, warmed and operated by human account managers in 16+ countries — exposed as a REST API and an MCP server. No OAuth per account, no 25-posts/day cap, no app review.

Docs https://developers.tokportal.com · API base https://app.tokportal.com/api/ext · OpenAPI https://developers.tokportal.com/openapi.json · MCP remote https://app.tokportal.com/api/ext/mcp · Get an API key https://app.tokportal.com/developer/api-keys · llms.txt https://developers.tokportal.com/llms.txt


github.com/tokportal/tokportal-go is the official Go SDK for the TokPortal API (Go 1.22+, standard library only). Every public operation is available as a typed resource method.

Install

go get github.com/tokportal/tokportal-go

30-second quickstart

package main

import (
	"context"
	"errors"
	"log"
	"os"

	tokportal "github.com/tokportal/tokportal-go"
)

func main() {
	client, err := tokportal.NewClient(os.Getenv("TOKPORTAL_API_KEY"))
	if err != nil {
		log.Fatal(err)
	}

	bundle, err := client.Bundles.Create(context.Background(), tokportal.CreateBundleRequest{
		BundleType:     tokportal.BundleTypeAccountAndVideos,
		Platform:       tokportal.PlatformTiktok,
		Country:        "USA",
		Title:          "US launch",
		VideosQuantity: 5,
	})
	if err != nil {
		log.Fatal(err)
	}

	log.Printf("%+v", bundle)

	csv, err := client.Analytics.ExportVideos(context.Background(), tokportal.Query{
		"account": []string{"saved-account-id"},
	})
	if err != nil {
		log.Fatal(err)
	}

	log.Printf("%s", csv)
}

Manage TokPortal Coverage from the latest atomic quote. A zero-credit quote is valid and still requires an explicit reactivation call:

coverage, err := client.Accounts.Coverage(context.Background(), "saved-account-id")
// Read data.reactivation_quote from coverage, then confirm the exact snapshot.
ctx := tokportal.WithIdempotencyKey(context.Background(), "coverage-reactivate-saved-account-id-v4")
reactivated, err := client.Accounts.ReactivateCoverage(ctx, "saved-account-id", tokportal.ManagedAccountSubscriptionReactivationRequest{
	ExpectedCredits:          50,
	ExpectedCurrentPeriodEnd: "2026-09-09T11:00:00.000Z",
	ExpectedLockVersion:      4,
})
_, _ = coverage, reactivated

Credential reveal and verification-code access use the same irreversible two-step policy flow. First call RevealCredentials or VerificationCode without acceptance to receive HTTP 428 and error.details.policy_version. After showing those terms to the account owner, retry with that exact version. The accepted request may debit credits and permanently detach the account, so these helpers reject a context created with WithIdempotencyKey. Secret-bearing responses are never stored for replay. After an uncertain transport result, reconcile the safe account state before deciding whether to call the endpoint again without a key:

If an accepted call returns HTTP 409 with CREDENTIAL_REVEAL_QUOTE_CHANGED, no charge or reveal occurred. Read the current policy and expected_credit_cost from APIError.Details, show the new terms to the owner, obtain fresh consent, and retry with the new version. Never retry a 409 automatically.

var apiError tokportal.APIError
_, err = client.Accounts.RevealCredentials(context.Background(), "saved-account-id")
if !errors.As(err, &apiError) || apiError.StatusCode != 428 {
	log.Fatal(err)
}
policyVersion, ok := apiError.Details["policy_version"].(string)
if !ok || policyVersion == "" {
	log.Fatal("TokPortal did not return a policy version")
}
// Show the returned policy terms to the account owner and obtain consent here.
credentials, err := client.Accounts.RevealCredentialsWithAcceptance(context.Background(), "saved-account-id", tokportal.CredentialRevealAcceptance{
	AcknowledgeSupportForfeit: true,
	PolicyVersion:            policyVersion,
})
_ = credentials

The same no-replay rule applies to Webhooks.Create, Uploads.Image, Uploads.Video, and Analytics.CreateReport because they return a signing secret, signed upload capability, or report access token. These helpers and DoOperation reject a context carrying WithIdempotencyKey for all six sensitive operation IDs.

Discover and operate webhooks without dropping to raw HTTP:

catalog, err := client.Webhooks.Events(context.Background())
endpoints, err := client.Webhooks.List(context.Background(), tokportal.Query{
	"event": "bundle.published",
})
retry, err := client.Webhooks.RetryDelivery(
	context.Background(),
	endpoints["data"].([]any)[0].(map[string]any)["id"].(string),
	"delivery-id",
)
_, _, _ = catalog, endpoints, retry

Every OpenAPI operation is also reachable through the generated operation map:

sameRetry, err := client.DoOperation(context.Background(), "retryWebhookDelivery", tokportal.OperationRequest{
	Path: map[string]string{
		"id":          endpoints["data"].([]any)[0].(map[string]any)["id"].(string),
		"delivery_id": "delivery-id",
	},
})
_ = sameRetry

csvAgain, err := client.DoTextOperation(context.Background(), "exportAnalyticsVideos", tokportal.OperationRequest{
	Query: tokportal.Query{"account": []string{"saved-account-id"}},
})
_ = csvAgain

Use WithIdempotencyKey for safe retries on mutating requests:

ctx := tokportal.WithIdempotencyKey(context.Background(), "bundle-create-123")
bundle, err := client.Bundles.Create(ctx, tokportal.CreateBundleRequest{
	BundleType:     tokportal.BundleTypeAccountAndVideos,
	Country:        "USA",
	VideosQuantity: 5,
})
bundle, err := client.Bundles.Create(context.Background(), tokportal.CreateBundleRequest{
	BundleType:     tokportal.BundleTypeAccountAndVideos,
	Country:        "USA",
	VideosQuantity: 5,
})
if err != nil {
	var apiErr tokportal.APIError
	if errors.As(err, &apiErr) {
		log.Printf("status=%d code=%s request_id=%s", apiErr.StatusCode, apiErr.Code, apiErr.RequestID)
		if apiErr.Retryable() {
			waitSeconds := apiErr.RetryAfterSeconds
			if waitSeconds == 0 {
				waitSeconds = 1
			}
			// Retry with backoff.
		}
		if apiErr.RateLimit != nil {
			log.Printf("rate_limit_remaining=%d reset=%d", apiErr.RateLimit.Remaining, apiErr.RateLimit.Reset)
		}
	}
	log.Fatal(err)
}
_ = bundle

The SDK is generated from the TokPortal public OpenAPI/schema layer and uses X-API-Key authentication.

It sends X-TokPortal-Client: tokportal-go/0.1.0 on API requests for observability and support diagnostics.

Verify signed webhook deliveries with the exact raw request body:

valid := tokportal.VerifyWebhookSignature(
	rawBody,
	r.Header.Get("TokPortal-Signature"),
	os.Getenv("TOKPORTAL_WEBHOOK_SECRET"),
	5*time.Minute,
)

Source of truth

This package is generated from the TokPortal public OpenAPI schema (https://developers.tokportal.com/openapi.json) in the private TokPortal monorepo. Generated files (generated.go) are overwritten on every release — do not edit them by hand. See CONTRIBUTING.md for what we accept as PRs and SECURITY.md for vulnerability reporting.

MIT © TokPortal

Documentation

Index

Constants

View Source
const BaseURL = "https://app.tokportal.com/api/ext"
View Source
const ClientHeader = "tokportal-go/" + SDKVersion
View Source
const SDKVersion = "0.1.0"

Variables

View Source
var OperationDefinitions = map[string]OperationDefinition{
	"getCurrentUser": {
		OperationID:         "getCurrentUser",
		Method:              "GET",
		Path:                "/me",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"updateCurrentUserSettings": {
		OperationID:         "updateCurrentUserSettings",
		Method:              "PATCH",
		Path:                "/me",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"getAccountManagedSubscription": {
		OperationID:         "getAccountManagedSubscription",
		Method:              "GET",
		Path:                "/accounts/{id}/managed-subscription",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"reactivateAccountManagedSubscription": {
		OperationID:         "reactivateAccountManagedSubscription",
		Method:              "POST",
		Path:                "/accounts/{id}/managed-subscription/reactivate",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"cancelAccountManagedSubscription": {
		OperationID:         "cancelAccountManagedSubscription",
		Method:              "POST",
		Path:                "/accounts/{id}/managed-subscription/cancel",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"listCountries": {
		OperationID:         "listCountries",
		Method:              "GET",
		Path:                "/countries",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"listPlatforms": {
		OperationID:         "listPlatforms",
		Method:              "GET",
		Path:                "/platforms",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"getCreditCosts": {
		OperationID:         "getCreditCosts",
		Method:              "GET",
		Path:                "/credit-costs",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"getCreditBalance": {
		OperationID:         "getCreditBalance",
		Method:              "GET",
		Path:                "/credits/balance",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"listCreditTransactions": {
		OperationID:         "listCreditTransactions",
		Method:              "GET",
		Path:                "/credits/history",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{},
		QueryParams:         []string{"page", "per_page", "date_from", "date_to"},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"listBundles": {
		OperationID:         "listBundles",
		Method:              "GET",
		Path:                "/bundles",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{},
		QueryParams:         []string{"page", "per_page", "status", "bundle_type", "platform", "external_ref", "account_status"},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"createBundle": {
		OperationID:         "createBundle",
		Method:              "POST",
		Path:                "/bundles",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"createBundlesBulk": {
		OperationID:         "createBundlesBulk",
		Method:              "POST",
		Path:                "/bundles/bulk",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"getBundle": {
		OperationID:         "getBundle",
		Method:              "GET",
		Path:                "/bundles/{id}",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"updateBundle": {
		OperationID:         "updateBundle",
		Method:              "PATCH",
		Path:                "/bundles/{id}",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"publishBundle": {
		OperationID:         "publishBundle",
		Method:              "POST",
		Path:                "/bundles/{id}/publish",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"getBundlePublishReadiness": {
		OperationID:         "getBundlePublishReadiness",
		Method:              "GET",
		Path:                "/bundles/{id}/publish-readiness",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"unpublishBundle": {
		OperationID:         "unpublishBundle",
		Method:              "POST",
		Path:                "/bundles/{id}/unpublish",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"addVideoSlots": {
		OperationID:         "addVideoSlots",
		Method:              "POST",
		Path:                "/bundles/{id}/add-video-slots",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"addEditSlots": {
		OperationID:         "addEditSlots",
		Method:              "POST",
		Path:                "/bundles/{id}/add-edit-slots",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"getBundleAccount": {
		OperationID:         "getBundleAccount",
		Method:              "GET",
		Path:                "/bundles/{id}/account",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"configureBundleAccount": {
		OperationID:         "configureBundleAccount",
		Method:              "PUT",
		Path:                "/bundles/{id}/account",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"requestBundleAccountCorrections": {
		OperationID:         "requestBundleAccountCorrections",
		Method:              "POST",
		Path:                "/bundles/{id}/account/corrections",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"finalizeBundleAccount": {
		OperationID:         "finalizeBundleAccount",
		Method:              "POST",
		Path:                "/bundles/{id}/account/finalize",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"listBundleVideos": {
		OperationID:         "listBundleVideos",
		Method:              "GET",
		Path:                "/bundles/{id}/videos",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"getBundleVideo": {
		OperationID:         "getBundleVideo",
		Method:              "GET",
		Path:                "/bundles/{id}/videos/{position}",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{"id", "position"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"configureBundleVideo": {
		OperationID:         "configureBundleVideo",
		Method:              "PUT",
		Path:                "/bundles/{id}/videos/{position}",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id", "position"},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"patchBundleVideo": {
		OperationID:         "patchBundleVideo",
		Method:              "PATCH",
		Path:                "/bundles/{id}/videos/{position}",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id", "position"},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"batchConfigureBundleVideos": {
		OperationID:         "batchConfigureBundleVideos",
		Method:              "PUT",
		Path:                "/bundles/{id}/videos/batch",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"publishAllBundleVideos": {
		OperationID:         "publishAllBundleVideos",
		Method:              "POST",
		Path:                "/bundles/{id}/videos/publish-all",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"importBundleVideosCsv": {
		OperationID:         "importBundleVideosCsv",
		Method:              "POST",
		Path:                "/bundles/{id}/videos/import-csv",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "multipart/form-data",
		SuccessContentTypes: []string{"application/json"},
	},
	"publishBundleVideo": {
		OperationID:         "publishBundleVideo",
		Method:              "POST",
		Path:                "/bundles/{id}/videos/{position}/publish",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id", "position"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"resetBundleVideo": {
		OperationID:         "resetBundleVideo",
		Method:              "POST",
		Path:                "/bundles/{id}/videos/{position}/reset",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id", "position"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"unscheduleBundleVideo": {
		OperationID:         "unscheduleBundleVideo",
		Method:              "POST",
		Path:                "/bundles/{id}/videos/{position}/unschedule",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id", "position"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"finalizeBundleVideo": {
		OperationID:         "finalizeBundleVideo",
		Method:              "POST",
		Path:                "/bundles/{id}/videos/{position}/finalize",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id", "position"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"requestBundleVideoCorrections": {
		OperationID:         "requestBundleVideoCorrections",
		Method:              "POST",
		Path:                "/bundles/{id}/videos/{position}/corrections",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id", "position"},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"fixBundleVideoDownload": {
		OperationID:         "fixBundleVideoDownload",
		Method:              "POST",
		Path:                "/bundles/{id}/videos/{position}/fix-download",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id", "position"},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"listAccounts": {
		OperationID:         "listAccounts",
		Method:              "GET",
		Path:                "/accounts",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{},
		QueryParams:         []string{"page", "per_page", "platform", "country", "banned"},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"listAccountBans": {
		OperationID:         "listAccountBans",
		Method:              "GET",
		Path:                "/account-bans",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{},
		QueryParams:         []string{"page", "per_page", "status", "resolution", "account_id", "since", "include_screenshots"},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"getAccount": {
		OperationID:         "getAccount",
		Method:              "GET",
		Path:                "/accounts/{id}",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"updateAccountCommentingProfile": {
		OperationID:         "updateAccountCommentingProfile",
		Method:              "PATCH",
		Path:                "/accounts/{id}/commenting-profile",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"listAccountBundles": {
		OperationID:         "listAccountBundles",
		Method:              "GET",
		Path:                "/accounts/{id}/bundles",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{"id"},
		QueryParams:         []string{"page", "per_page", "status"},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"retrieveAccountVerificationCode": {
		OperationID:         "retrieveAccountVerificationCode",
		Method:              "POST",
		Path:                "/accounts/{id}/verification-code",
		IdempotencyPolicy:   "reject-sensitive-response",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"revealAccountCredentials": {
		OperationID:         "revealAccountCredentials",
		Method:              "POST",
		Path:                "/accounts/{id}/reveal-credentials",
		IdempotencyPolicy:   "reject-sensitive-response",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"canRefreshAccountAnalytics": {
		OperationID:         "canRefreshAccountAnalytics",
		Method:              "GET",
		Path:                "/accounts/{id}/analytics/can-refresh",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"refreshAccountAnalytics": {
		OperationID:         "refreshAccountAnalytics",
		Method:              "POST",
		Path:                "/accounts/{id}/analytics/refresh",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"getAccountEditRequest": {
		OperationID:         "getAccountEditRequest",
		Method:              "GET",
		Path:                "/accounts/{id}/edit-request",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"createAccountEditRequest": {
		OperationID:         "createAccountEditRequest",
		Method:              "POST",
		Path:                "/accounts/{id}/edit-request",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"rewarmAccount": {
		OperationID:         "rewarmAccount",
		Method:              "POST",
		Path:                "/accounts/{id}/rewarm",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"configureBundleWarmingTerms": {
		OperationID:         "configureBundleWarmingTerms",
		Method:              "PUT",
		Path:                "/bundles/{id}/warming-terms",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"listAccountWarmingSessions": {
		OperationID:         "listAccountWarmingSessions",
		Method:              "GET",
		Path:                "/accounts/{id}/warming-sessions",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"getWarmingSession": {
		OperationID:         "getWarmingSession",
		Method:              "GET",
		Path:                "/warming-sessions/{id}",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"generateWarmingTerms": {
		OperationID:         "generateWarmingTerms",
		Method:              "POST",
		Path:                "/warming/generate-terms",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"listWebhookEvents": {
		OperationID:         "listWebhookEvents",
		Method:              "GET",
		Path:                "/webhooks/events",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"listWebhookEndpoints": {
		OperationID:         "listWebhookEndpoints",
		Method:              "GET",
		Path:                "/webhooks",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{},
		QueryParams:         []string{"page", "per_page", "enabled", "event"},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"createWebhookEndpoint": {
		OperationID:         "createWebhookEndpoint",
		Method:              "POST",
		Path:                "/webhooks",
		IdempotencyPolicy:   "reject-sensitive-response",
		PathParams:          []string{},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"getWebhookEndpoint": {
		OperationID:         "getWebhookEndpoint",
		Method:              "GET",
		Path:                "/webhooks/{id}",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"updateWebhookEndpoint": {
		OperationID:         "updateWebhookEndpoint",
		Method:              "PATCH",
		Path:                "/webhooks/{id}",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"deleteWebhookEndpoint": {
		OperationID:         "deleteWebhookEndpoint",
		Method:              "DELETE",
		Path:                "/webhooks/{id}",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{},
	},
	"listWebhookDeliveries": {
		OperationID:         "listWebhookDeliveries",
		Method:              "GET",
		Path:                "/webhooks/{id}/deliveries",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{"id"},
		QueryParams:         []string{"page", "per_page", "event_type", "success"},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"retryWebhookDelivery": {
		OperationID:         "retryWebhookDelivery",
		Method:              "POST",
		Path:                "/webhooks/{id}/deliveries/{delivery_id}/retry",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id", "delivery_id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"testWebhookEndpoint": {
		OperationID:         "testWebhookEndpoint",
		Method:              "POST",
		Path:                "/webhooks/{id}/test",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"uploadVideo": {
		OperationID:         "uploadVideo",
		Method:              "POST",
		Path:                "/upload/video",
		IdempotencyPolicy:   "reject-sensitive-response",
		PathParams:          []string{},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"uploadVideoDirect": {
		OperationID:         "uploadVideoDirect",
		Method:              "POST",
		Path:                "/upload/video/direct",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "multipart/form-data",
		SuccessContentTypes: []string{"application/json"},
	},
	"uploadImage": {
		OperationID:         "uploadImage",
		Method:              "POST",
		Path:                "/upload/image",
		IdempotencyPolicy:   "reject-sensitive-response",
		PathParams:          []string{},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"uploadImageDirect": {
		OperationID:         "uploadImageDirect",
		Method:              "POST",
		Path:                "/upload/image/direct",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "multipart/form-data",
		SuccessContentTypes: []string{"application/json"},
	},
	"uploadImageFromUrl": {
		OperationID:         "uploadImageFromUrl",
		Method:              "POST",
		Path:                "/upload/image/from-url",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"getAnalyticsDashboard": {
		OperationID:         "getAnalyticsDashboard",
		Method:              "GET",
		Path:                "/analytics",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{},
		QueryParams:         []string{"workspace", "platform", "country", "account", "from", "to"},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"getAnalyticsContract": {
		OperationID:         "getAnalyticsContract",
		Method:              "GET",
		Path:                "/analytics/contract",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"exportAnalyticsVideos": {
		OperationID:         "exportAnalyticsVideos",
		Method:              "GET",
		Path:                "/analytics/export/videos",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{},
		QueryParams:         []string{"account", "workspace", "platform", "country", "q", "from", "to"},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"text/csv"},
	},
	"createAnalyticsReport": {
		OperationID:         "createAnalyticsReport",
		Method:              "POST",
		Path:                "/analytics/export/reports",
		IdempotencyPolicy:   "reject-sensitive-response",
		PathParams:          []string{},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"exportAnalyticsReportHtml": {
		OperationID:         "exportAnalyticsReportHtml",
		Method:              "POST",
		Path:                "/analytics/export/reports/html",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"text/html"},
	},
	"getAnalyticsSeries": {
		OperationID:         "getAnalyticsSeries",
		Method:              "GET",
		Path:                "/analytics/series",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{},
		QueryParams:         []string{"metric", "granularity", "mode", "account", "from", "to"},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"getAnalyticsAccount": {
		OperationID:         "getAnalyticsAccount",
		Method:              "GET",
		Path:                "/analytics/accounts/{id}",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"refreshAnalyticsAccount": {
		OperationID:         "refreshAnalyticsAccount",
		Method:              "POST",
		Path:                "/analytics/accounts/{id}/refresh",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"listAnalyticsAccountRawSnapshots": {
		OperationID:         "listAnalyticsAccountRawSnapshots",
		Method:              "GET",
		Path:                "/analytics/accounts/{id}/raw",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{"id"},
		QueryParams:         []string{"source", "limit", "from", "to"},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"getAccountAnalytics": {
		OperationID:         "getAccountAnalytics",
		Method:              "GET",
		Path:                "/accounts/{id}/analytics",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"listAccountVideoAnalytics": {
		OperationID:         "listAccountVideoAnalytics",
		Method:              "GET",
		Path:                "/accounts/{id}/analytics/videos",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{"id"},
		QueryParams:         []string{"page", "per_page", "sort_by", "sort_order"},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"getVideoAnalytics": {
		OperationID:         "getVideoAnalytics",
		Method:              "GET",
		Path:                "/videos/{id}/analytics",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"createVideoAdCodeRequest": {
		OperationID:         "createVideoAdCodeRequest",
		Method:              "POST",
		Path:                "/videos/{id}/ad-code-request",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"getVideoAdCodeRequest": {
		OperationID:         "getVideoAdCodeRequest",
		Method:              "GET",
		Path:                "/videos/{id}/ad-code-request",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"getCommentPulse": {
		OperationID:         "getCommentPulse",
		Method:              "GET",
		Path:                "/analytics/comments",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{},
		QueryParams:         []string{"platform", "country", "account", "post", "limit", "postLimit", "from", "to"},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"listAnalyticsAccountComments": {
		OperationID:         "listAnalyticsAccountComments",
		Method:              "GET",
		Path:                "/analytics/accounts/{id}/comments",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{"id"},
		QueryParams:         []string{"trackedPostId", "postId", "limit"},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"listAnalyticsPostRawSnapshots": {
		OperationID:         "listAnalyticsPostRawSnapshots",
		Method:              "GET",
		Path:                "/analytics/posts/{id}/raw",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{"id"},
		QueryParams:         []string{"source", "limit", "from", "to"},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"listCommentTasks": {
		OperationID:         "listCommentTasks",
		Method:              "GET",
		Path:                "/comments",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{},
		QueryParams:         []string{"page", "per_page", "status", "saved_account_id"},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"createCommentTasks": {
		OperationID:         "createCommentTasks",
		Method:              "POST",
		Path:                "/comments",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"getCommentTask": {
		OperationID:         "getCommentTask",
		Method:              "GET",
		Path:                "/comments/{id}",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"deleteCommentTask": {
		OperationID:         "deleteCommentTask",
		Method:              "DELETE",
		Path:                "/comments/{id}",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"approveCommentTask": {
		OperationID:         "approveCommentTask",
		Method:              "POST",
		Path:                "/comments/{id}/approve",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
	"disputeCommentTask": {
		OperationID:         "disputeCommentTask",
		Method:              "POST",
		Path:                "/comments/{id}/dispute",
		IdempotencyPolicy:   "standard",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         true,
		RequestContentType:  "application/json",
		SuccessContentTypes: []string{"application/json"},
	},
	"listCommentTaskVerifications": {
		OperationID:         "listCommentTaskVerifications",
		Method:              "GET",
		Path:                "/comments/{id}/verifications",
		IdempotencyPolicy:   "not-applicable",
		PathParams:          []string{"id"},
		QueryParams:         []string{},
		HasJSONBody:         false,
		RequestContentType:  "",
		SuccessContentTypes: []string{"application/json"},
	},
}
View Source
var OperationIDs = []string{
	"getCurrentUser",
	"updateCurrentUserSettings",
	"getAccountManagedSubscription",
	"reactivateAccountManagedSubscription",
	"cancelAccountManagedSubscription",
	"listCountries",
	"listPlatforms",
	"getCreditCosts",
	"getCreditBalance",
	"listCreditTransactions",
	"listBundles",
	"createBundle",
	"createBundlesBulk",
	"getBundle",
	"updateBundle",
	"publishBundle",
	"getBundlePublishReadiness",
	"unpublishBundle",
	"addVideoSlots",
	"addEditSlots",
	"getBundleAccount",
	"configureBundleAccount",
	"requestBundleAccountCorrections",
	"finalizeBundleAccount",
	"listBundleVideos",
	"getBundleVideo",
	"configureBundleVideo",
	"patchBundleVideo",
	"batchConfigureBundleVideos",
	"publishAllBundleVideos",
	"importBundleVideosCsv",
	"publishBundleVideo",
	"resetBundleVideo",
	"unscheduleBundleVideo",
	"finalizeBundleVideo",
	"requestBundleVideoCorrections",
	"fixBundleVideoDownload",
	"listAccounts",
	"listAccountBans",
	"getAccount",
	"updateAccountCommentingProfile",
	"listAccountBundles",
	"retrieveAccountVerificationCode",
	"revealAccountCredentials",
	"canRefreshAccountAnalytics",
	"refreshAccountAnalytics",
	"getAccountEditRequest",
	"createAccountEditRequest",
	"rewarmAccount",
	"configureBundleWarmingTerms",
	"listAccountWarmingSessions",
	"getWarmingSession",
	"generateWarmingTerms",
	"listWebhookEvents",
	"listWebhookEndpoints",
	"createWebhookEndpoint",
	"getWebhookEndpoint",
	"updateWebhookEndpoint",
	"deleteWebhookEndpoint",
	"listWebhookDeliveries",
	"retryWebhookDelivery",
	"testWebhookEndpoint",
	"uploadVideo",
	"uploadVideoDirect",
	"uploadImage",
	"uploadImageDirect",
	"uploadImageFromUrl",
	"getAnalyticsDashboard",
	"getAnalyticsContract",
	"exportAnalyticsVideos",
	"createAnalyticsReport",
	"exportAnalyticsReportHtml",
	"getAnalyticsSeries",
	"getAnalyticsAccount",
	"refreshAnalyticsAccount",
	"listAnalyticsAccountRawSnapshots",
	"getAccountAnalytics",
	"listAccountVideoAnalytics",
	"getVideoAnalytics",
	"createVideoAdCodeRequest",
	"getVideoAdCodeRequest",
	"getCommentPulse",
	"listAnalyticsAccountComments",
	"listAnalyticsPostRawSnapshots",
	"listCommentTasks",
	"createCommentTasks",
	"getCommentTask",
	"deleteCommentTask",
	"approveCommentTask",
	"disputeCommentTask",
	"listCommentTaskVerifications",
}

Functions

func IsRetryable

func IsRetryable(err error) bool

func VerifyWebhookSignature

func VerifyWebhookSignature(rawBody []byte, signatureHeader string, signingSecret string, tolerance time.Duration) bool

func WithIdempotencyKey

func WithIdempotencyKey(ctx context.Context, key string) context.Context

Types

type APIError

type APIError struct {
	StatusCode        int
	Code              string
	Message           string
	Details           map[string]any
	RequestID         string
	RawBody           string
	RetryAfterSeconds int
	RateLimit         *RateLimit
}

func (APIError) Error

func (error APIError) Error() string

func (APIError) Retryable

func (error APIError) Retryable() bool

type AccountCorrectionsRequest

type AccountCorrectionsRequest struct {
	Comment string         `json:"comment"`
	Fields  map[string]any `json:"fields,omitempty"`
}

type AccountEditRequest

type AccountEditRequest struct {
	RequestedUsername          string `json:"requested_username"`
	RequestedVisibleName       string `json:"requested_visible_name"`
	RequestedBiography         string `json:"requested_biography,omitempty"`
	RequestedProfilePictureUrl string `json:"requested_profile_picture_url,omitempty"`
	RequestedLinkInBio         string `json:"requested_link_in_bio,omitempty"`
}

type AccountsService

type AccountsService struct {
	// contains filtered or unexported fields
}

func (*AccountsService) Bundles

func (service *AccountsService) Bundles(ctx context.Context, id string, query Query) (Response, error)

func (*AccountsService) CanRefreshAnalytics

func (service *AccountsService) CanRefreshAnalytics(ctx context.Context, id string) (Response, error)

func (*AccountsService) Coverage

func (service *AccountsService) Coverage(ctx context.Context, id string) (Response, error)

func (*AccountsService) CreateEditRequest

func (service *AccountsService) CreateEditRequest(ctx context.Context, id string, body AccountEditRequest) (Response, error)

func (*AccountsService) Get

func (service *AccountsService) Get(ctx context.Context, id string) (Response, error)

func (*AccountsService) GetEditRequest

func (service *AccountsService) GetEditRequest(ctx context.Context, id string) (Response, error)

func (*AccountsService) List

func (service *AccountsService) List(ctx context.Context, query Query) (Response, error)

func (*AccountsService) PauseCoverage

func (service *AccountsService) PauseCoverage(ctx context.Context, id string) (Response, error)

func (*AccountsService) ReactivateCoverage

func (*AccountsService) RefreshAnalytics

func (service *AccountsService) RefreshAnalytics(ctx context.Context, id string, body RefreshAnalyticsRequest) (Response, error)

func (*AccountsService) RevealCredentials

func (service *AccountsService) RevealCredentials(ctx context.Context, id string) (Response, error)

func (*AccountsService) RevealCredentialsWithAcceptance

func (service *AccountsService) RevealCredentialsWithAcceptance(ctx context.Context, id string, body CredentialRevealAcceptance) (Response, error)

func (*AccountsService) VerificationCode

func (service *AccountsService) VerificationCode(ctx context.Context, id string) (Response, error)

func (*AccountsService) VerificationCodeWithAcceptance

func (service *AccountsService) VerificationCodeWithAcceptance(ctx context.Context, id string, body CredentialRevealAcceptance) (Response, error)

type AnalyticsService

type AnalyticsService struct {
	// contains filtered or unexported fields
}

func (*AnalyticsService) Account

func (service *AnalyticsService) Account(ctx context.Context, id string) (Response, error)

func (*AnalyticsService) AccountComments

func (service *AnalyticsService) AccountComments(ctx context.Context, id string, query Query) (Response, error)

func (*AnalyticsService) AccountCompatibility

func (service *AnalyticsService) AccountCompatibility(ctx context.Context, id string) (Response, error)

func (*AnalyticsService) AccountRaw

func (service *AnalyticsService) AccountRaw(ctx context.Context, id string, query Query) (Response, error)

func (*AnalyticsService) AccountVideos

func (service *AnalyticsService) AccountVideos(ctx context.Context, id string, query Query) (Response, error)

func (*AnalyticsService) CommentPulse

func (service *AnalyticsService) CommentPulse(ctx context.Context, query Query) (Response, error)

func (*AnalyticsService) Contract

func (service *AnalyticsService) Contract(ctx context.Context) (Response, error)

func (*AnalyticsService) CreateReport

func (service *AnalyticsService) CreateReport(ctx context.Context, body CreateAnalyticsReportRequest) (Response, error)

func (*AnalyticsService) Dashboard

func (service *AnalyticsService) Dashboard(ctx context.Context, query Query) (Response, error)

func (*AnalyticsService) ExportReportHTML

func (service *AnalyticsService) ExportReportHTML(ctx context.Context, body CreateAnalyticsReportRequest) (string, error)

func (*AnalyticsService) ExportVideos

func (service *AnalyticsService) ExportVideos(ctx context.Context, query Query) (string, error)

func (*AnalyticsService) PostRaw

func (service *AnalyticsService) PostRaw(ctx context.Context, id string, query Query) (Response, error)

func (*AnalyticsService) RefreshAccount

func (service *AnalyticsService) RefreshAccount(ctx context.Context, id string, body RefreshAnalyticsRequest) (Response, error)

func (*AnalyticsService) Series

func (service *AnalyticsService) Series(ctx context.Context, query Query) (Response, error)

func (*AnalyticsService) Video

func (service *AnalyticsService) Video(ctx context.Context, id string) (Response, error)

type BatchConfigureVideoItem

type BatchConfigureVideoItem struct {
	Position int `json:"position"`
	ConfigureVideoRequest
}

type BatchConfigureVideosRequest

type BatchConfigureVideosRequest struct {
	Videos      []BatchConfigureVideoItem `json:"videos"`
	AutoPublish bool                      `json:"auto_publish,omitempty"`
}

type BundleType

type BundleType string
const (
	BundleTypeAccountOnly      BundleType = "account_only"
	BundleTypeAccountAndVideos BundleType = "account_and_videos"
	BundleTypeVideosOnly       BundleType = "videos_only"
)

type BundlesService

type BundlesService struct {
	// contains filtered or unexported fields
}

func (*BundlesService) AddEditSlots

func (service *BundlesService) AddEditSlots(ctx context.Context, id string, quantity int) (Response, error)

func (*BundlesService) AddVideoSlots

func (service *BundlesService) AddVideoSlots(ctx context.Context, id string, quantity int) (Response, error)

func (*BundlesService) BatchConfigureVideos

func (service *BundlesService) BatchConfigureVideos(ctx context.Context, id string, body BatchConfigureVideosRequest) (Response, error)

func (*BundlesService) BulkCreate

func (service *BundlesService) BulkCreate(ctx context.Context, body CreateBulkBundlesRequest) (Response, error)

func (*BundlesService) ConfigureAccount

func (service *BundlesService) ConfigureAccount(ctx context.Context, id string, body ConfigureAccountRequest) (Response, error)

func (*BundlesService) ConfigureVideo

func (service *BundlesService) ConfigureVideo(ctx context.Context, id string, position int, body ConfigureVideoRequest) (Response, error)

func (*BundlesService) Create

func (service *BundlesService) Create(ctx context.Context, body CreateBundleRequest) (Response, error)

func (*BundlesService) FinalizeAccount

func (service *BundlesService) FinalizeAccount(ctx context.Context, id string) (Response, error)

func (*BundlesService) FinalizeVideo

func (service *BundlesService) FinalizeVideo(ctx context.Context, id string, position int) (Response, error)

func (*BundlesService) FixVideoDownload

func (service *BundlesService) FixVideoDownload(ctx context.Context, id string, position int, body FixVideoDownloadRequest) (Response, error)

func (*BundlesService) Get

func (service *BundlesService) Get(ctx context.Context, id string) (Response, error)

func (*BundlesService) GetAccount

func (service *BundlesService) GetAccount(ctx context.Context, id string) (Response, error)

func (*BundlesService) GetVideo

func (service *BundlesService) GetVideo(ctx context.Context, id string, position int) (Response, error)

func (*BundlesService) List

func (service *BundlesService) List(ctx context.Context, query Query) (Response, error)

func (*BundlesService) ListVideos

func (service *BundlesService) ListVideos(ctx context.Context, id string) (Response, error)

func (*BundlesService) PatchVideo

func (service *BundlesService) PatchVideo(ctx context.Context, id string, position int, body PatchVideoRequest) (Response, error)

func (*BundlesService) Publish

func (service *BundlesService) Publish(ctx context.Context, id string) (Response, error)

func (*BundlesService) PublishAllVideos

func (service *BundlesService) PublishAllVideos(ctx context.Context, id string) (Response, error)

func (*BundlesService) PublishVideo

func (service *BundlesService) PublishVideo(ctx context.Context, id string, position int) (Response, error)

func (*BundlesService) Readiness

func (service *BundlesService) Readiness(ctx context.Context, id string) (Response, error)

func (*BundlesService) RequestAccountCorrections

func (service *BundlesService) RequestAccountCorrections(ctx context.Context, id string, body AccountCorrectionsRequest) (Response, error)

func (*BundlesService) RequestVideoCorrections

func (service *BundlesService) RequestVideoCorrections(ctx context.Context, id string, position int, body VideoCorrectionsRequest) (Response, error)

func (*BundlesService) ResetVideo

func (service *BundlesService) ResetVideo(ctx context.Context, id string, position int) (Response, error)

func (*BundlesService) Unpublish

func (service *BundlesService) Unpublish(ctx context.Context, id string) (Response, error)

func (*BundlesService) UnscheduleVideo

func (service *BundlesService) UnscheduleVideo(ctx context.Context, id string, position int) (Response, error)

func (*BundlesService) Update

func (service *BundlesService) Update(ctx context.Context, id string, body PatchBundleRequest) (Response, error)

type Client

type Client struct {
	Bundles   *BundlesService
	Credits   *CreditsService
	Accounts  *AccountsService
	Analytics *AnalyticsService
	Uploads   *UploadsService
	Comments  *CommentsService
	Webhooks  *WebhooksService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(apiKey string, options ...Option) (*Client, error)

func (*Client) Countries

func (client *Client) Countries(ctx context.Context) (Response, error)

func (*Client) CreditCosts

func (client *Client) CreditCosts(ctx context.Context) (Response, error)

func (*Client) DoOperation

func (client *Client) DoOperation(ctx context.Context, operationID string, input OperationRequest) (Response, error)

func (*Client) DoTextOperation

func (client *Client) DoTextOperation(ctx context.Context, operationID string, input OperationRequest) (string, error)

func (*Client) Me

func (client *Client) Me(ctx context.Context) (Response, error)

func (*Client) Platforms

func (client *Client) Platforms(ctx context.Context) (Response, error)

type CommentTaskInput

type CommentTaskInput struct {
	SavedAccountID string  `json:"saved_account_id"`
	TargetVideoURL string  `json:"target_video_url"`
	CommentText    string  `json:"comment_text"`
	BriefID        *string `json:"brief_id,omitempty"`
}

type CommentsService

type CommentsService struct {
	// contains filtered or unexported fields
}

func (*CommentsService) Approve

func (service *CommentsService) Approve(ctx context.Context, id string) (Response, error)

func (*CommentsService) Create

func (*CommentsService) Delete

func (service *CommentsService) Delete(ctx context.Context, id string) (Response, error)

func (*CommentsService) Dispute

func (service *CommentsService) Dispute(ctx context.Context, id string, reason string) (Response, error)

func (*CommentsService) Get

func (service *CommentsService) Get(ctx context.Context, id string) (Response, error)

func (*CommentsService) List

func (service *CommentsService) List(ctx context.Context, query Query) (Response, error)

func (*CommentsService) Verifications

func (service *CommentsService) Verifications(ctx context.Context, id string) (Response, error)

type ConfigureAccountRequest

type ConfigureAccountRequest struct {
	Username                 string   `json:"username"`
	VisibleName              string   `json:"visible_name"`
	Biography                string   `json:"biography,omitempty"`
	ProfilePictureUrl        string   `json:"profile_picture_url,omitempty"`
	LinkInBio                string   `json:"link_in_bio,omitempty"`
	NicheWarmingInstructions string   `json:"niche_warming_instructions,omitempty"`
	AdvancedWarmingTerms     []string `json:"advanced_warming_terms,omitempty"`
}

type ConfigureVideoRequest

type ConfigureVideoRequest struct {
	VideoType              string   `json:"video_type"`
	Description            string   `json:"description,omitempty"`
	TargetPublishDate      string   `json:"target_publish_date"`
	Name                   string   `json:"name,omitempty"`
	VideoUrl               string   `json:"video_url,omitempty"`
	CarouselImages         []string `json:"carousel_images,omitempty"`
	CarouselTitle          string   `json:"carousel_title,omitempty"`
	StoryImageUrl          string   `json:"story_image_url,omitempty"`
	StoryRepostUrl         string   `json:"story_repost_url,omitempty"`
	TiktokSoundUrl         string   `json:"tiktok_sound_url,omitempty"`
	VolumeOriginalSound    *int     `json:"volume_original_sound,omitempty"`
	VolumeAddedSound       *int     `json:"volume_added_sound,omitempty"`
	EditingInstructions    string   `json:"editing_instructions,omitempty"`
	ExternalRef            string   `json:"external_ref,omitempty"`
	InstagramContentType   string   `json:"instagram_content_type,omitempty"`
	InstagramLocation      string   `json:"instagram_location,omitempty"`
	InstagramCollaborators []string `json:"instagram_collaborators,omitempty"`
	InstagramAudioName     string   `json:"instagram_audio_name,omitempty"`
	InstagramAddToStory    bool     `json:"instagram_add_to_story,omitempty"`
	AiContentDisclaimer    bool     `json:"ai_content_disclaimer,omitempty"`
	DiscloseAsAds          bool     `json:"disclose_as_ads,omitempty"`
	InstantRepostAsStory   bool     `json:"instant_repost_as_story,omitempty"`
	YoutubeTitle           string   `json:"youtube_title,omitempty"`
	YoutubeTags            []string `json:"youtube_tags,omitempty"`
	YoutubeCategory        string   `json:"youtube_category,omitempty"`
	YoutubeVisibility      string   `json:"youtube_visibility,omitempty"`
	YoutubeSoundUrl        string   `json:"youtube_sound_url,omitempty"`
	AutoPublish            bool     `json:"auto_publish,omitempty"`
}

type CreateAnalyticsReportRequest

type CreateAnalyticsReportRequest struct {
	Title       *string    `json:"title,omitempty"`
	Template    *string    `json:"template,omitempty"`
	BrandName   *string    `json:"brandName,omitempty"`
	BrandAccent *string    `json:"brandAccent,omitempty"`
	AccountIds  []string   `json:"accountIds,omitempty"`
	WorkspaceId *string    `json:"workspaceId,omitempty"`
	Platforms   []Platform `json:"platforms,omitempty"`
	Countries   []string   `json:"countries,omitempty"`
	Query       *string    `json:"query,omitempty"`
	From        *string    `json:"from,omitempty"`
	To          *string    `json:"to,omitempty"`
}

type CreateBulkBundlesRequest

type CreateBulkBundlesRequest struct {
	Platforms                 []Platform `json:"platforms"`
	Country                   string     `json:"country"`
	AccountsCount             int        `json:"accounts_count"`
	UploadAccountsCount       int        `json:"upload_accounts_count,omitempty"`
	VideosPerAccount          int        `json:"videos_per_account,omitempty"`
	WantsNicheWarming         bool       `json:"wants_niche_warming,omitempty"`
	WantsDeepWarming          bool       `json:"wants_deep_warming,omitempty"`
	WantsAdvancedWarming      bool       `json:"wants_advanced_warming,omitempty"`
	AdvancedWarmingTerms      []string   `json:"advanced_warming_terms,omitempty"`
	AdvancedWarmingTermsCount int        `json:"advanced_warming_terms_count,omitempty"`
	NicheWarmingInstructions  string     `json:"niche_warming_instructions,omitempty"`
	AutoFinalizeVideos        bool       `json:"auto_finalize_videos,omitempty"`
	ExternalRef               string     `json:"external_ref,omitempty"`
}

type CreateBundleRequest

type CreateBundleRequest struct {
	BundleType                BundleType `json:"bundle_type"`
	Platform                  Platform   `json:"platform,omitempty"`
	Country                   string     `json:"country,omitempty"`
	Title                     string     `json:"title,omitempty"`
	VideosQuantity            int        `json:"videos_quantity,omitempty"`
	EditsQuantity             int        `json:"edits_quantity,omitempty"`
	WantsNicheWarming         bool       `json:"wants_niche_warming,omitempty"`
	WantsDeepWarming          bool       `json:"wants_deep_warming,omitempty"`
	WantsAdvancedWarming      bool       `json:"wants_advanced_warming,omitempty"`
	AdvancedWarmingTerms      []string   `json:"advanced_warming_terms,omitempty"`
	AdvancedWarmingTermsCount int        `json:"advanced_warming_terms_count,omitempty"`
	NicheWarmingInstructions  string     `json:"niche_warming_instructions,omitempty"`
	AutoFinalizeVideos        bool       `json:"auto_finalize_videos,omitempty"`
	AccountId                 string     `json:"account_id,omitempty"`
	ExternalRef               string     `json:"external_ref,omitempty"`
}

type CreateCommentTasksRequest

type CreateCommentTasksRequest struct {
	SavedAccountID string             `json:"saved_account_id,omitempty"`
	TargetVideoURL string             `json:"target_video_url,omitempty"`
	CommentText    string             `json:"comment_text,omitempty"`
	BriefID        *string            `json:"brief_id,omitempty"`
	Tasks          []CommentTaskInput `json:"tasks,omitempty"`
}

type CreateWebhookEndpointRequest

type CreateWebhookEndpointRequest struct {
	Url         string   `json:"url"`
	Events      []string `json:"events"`
	Description string   `json:"description,omitempty"`
	Enabled     bool     `json:"enabled,omitempty"`
}

type CredentialRevealAcceptance

type CredentialRevealAcceptance struct {
	AcknowledgeSupportForfeit bool   `json:"acknowledge_support_forfeit"`
	PolicyVersion             string `json:"policy_version"`
}

type CreditsService

type CreditsService struct {
	// contains filtered or unexported fields
}

func (*CreditsService) Balance

func (service *CreditsService) Balance(ctx context.Context) (Response, error)

func (*CreditsService) History

func (service *CreditsService) History(ctx context.Context, query Query) (Response, error)

type DisputeCommentRequest

type DisputeCommentRequest struct {
	Reason string `json:"reason"`
}

type FixVideoDownloadRequest

type FixVideoDownloadRequest struct {
	VideoUrl       string   `json:"video_url,omitempty"`
	CarouselImages []string `json:"carousel_images,omitempty"`
}

type ManagedAccountSubscriptionReactivationRequest

type ManagedAccountSubscriptionReactivationRequest struct {
	ExpectedCredits          int    `json:"expected_credits"`
	ExpectedCurrentPeriodEnd string `json:"expected_current_period_end"`
	ExpectedLockVersion      int    `json:"expected_lock_version"`
}

type OperationDefinition

type OperationDefinition struct {
	OperationID         string
	Method              string
	Path                string
	IdempotencyPolicy   string
	PathParams          []string
	QueryParams         []string
	HasJSONBody         bool
	RequestContentType  string
	SuccessContentTypes []string
}

type OperationRequest

type OperationRequest struct {
	Path        map[string]string
	Query       Query
	Body        any
	Form        map[string]string
	FilePath    string
	FileField   string
	ContentType string
}

type Option

type Option func(*Client)

func WithBaseURL

func WithBaseURL(baseURL string) Option

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) Option

type PatchBundleRequest

type PatchBundleRequest struct {
	AutoFinalizeVideos bool    `json:"auto_finalize_videos,omitempty"`
	ExternalRef        *string `json:"external_ref,omitempty"`
	Title              *string `json:"title,omitempty"`
}

type PatchVideoRequest

type PatchVideoRequest struct {
	ExternalRef            *string `json:"external_ref,omitempty"`
	Name                   *string `json:"name,omitempty"`
	Description            *string `json:"description,omitempty"`
	TargetPublishDate      *string `json:"target_publish_date,omitempty"`
	TargetPublishStartDate *string `json:"target_publish_start_date,omitempty"`
	TargetPublishEndDate   *string `json:"target_publish_end_date,omitempty"`
}

type Platform

type Platform string
const (
	PlatformTiktok    Platform = "tiktok"
	PlatformInstagram Platform = "instagram"
)

type QuantityRequest

type QuantityRequest struct {
	Quantity int `json:"quantity"`
}

type Query

type Query map[string]any

type RateLimit

type RateLimit struct {
	Limit     int
	Remaining int
	Reset     int
}

type RefreshAnalyticsRequest

type RefreshAnalyticsRequest struct {
	Force           bool `json:"force,omitempty"`
	IncludePosts    bool `json:"includePosts,omitempty"`
	IncludeComments bool `json:"includeComments,omitempty"`
	ForcePosts      bool `json:"forcePosts,omitempty"`
	BootstrapPosts  bool `json:"bootstrapPosts,omitempty"`
	PostLimit       int  `json:"postLimit,omitempty"`
}

type Response

type Response map[string]any

type UpdateWebhookEndpointRequest

type UpdateWebhookEndpointRequest struct {
	Url         string   `json:"url,omitempty"`
	Events      []string `json:"events,omitempty"`
	Description *string  `json:"description,omitempty"`
	Enabled     bool     `json:"enabled,omitempty"`
}

type UploadImageFromUrlRequest

type UploadImageFromUrlRequest struct {
	Url      string `json:"url"`
	BundleId string `json:"bundle_id"`
	Purpose  string `json:"purpose,omitempty"`
}

type UploadImageRequest

type UploadImageRequest struct {
	Filename    string `json:"filename"`
	ContentType string `json:"content_type"`
	BundleId    string `json:"bundle_id"`
	Purpose     string `json:"purpose,omitempty"`
}

type UploadVideoRequest

type UploadVideoRequest struct {
	Filename    string `json:"filename"`
	ContentType string `json:"content_type,omitempty"`
	BundleId    string `json:"bundle_id"`
}

type UploadsService

type UploadsService struct {
	// contains filtered or unexported fields
}

func (*UploadsService) Image

func (service *UploadsService) Image(ctx context.Context, body UploadImageRequest) (Response, error)

func (*UploadsService) ImageDirect

func (service *UploadsService) ImageDirect(ctx context.Context, filePath string, bundleID string, purpose string, contentType string) (Response, error)

func (*UploadsService) ImageFromURL

func (service *UploadsService) ImageFromURL(ctx context.Context, body UploadImageFromUrlRequest) (Response, error)

func (*UploadsService) Video

func (service *UploadsService) Video(ctx context.Context, body UploadVideoRequest) (Response, error)

func (*UploadsService) VideoDirect

func (service *UploadsService) VideoDirect(ctx context.Context, filePath string, bundleID string, contentType string) (Response, error)

type VideoCorrectionsRequest

type VideoCorrectionsRequest struct {
	Comment string         `json:"comment"`
	Fields  map[string]any `json:"fields,omitempty"`
}

type WebhooksService

type WebhooksService struct {
	// contains filtered or unexported fields
}

func (*WebhooksService) Create

func (*WebhooksService) Delete

func (service *WebhooksService) Delete(ctx context.Context, id string) (Response, error)

func (*WebhooksService) Deliveries

func (service *WebhooksService) Deliveries(ctx context.Context, id string, query Query) (Response, error)

func (*WebhooksService) Events

func (service *WebhooksService) Events(ctx context.Context) (Response, error)

func (*WebhooksService) Get

func (service *WebhooksService) Get(ctx context.Context, id string) (Response, error)

func (*WebhooksService) List

func (service *WebhooksService) List(ctx context.Context, query Query) (Response, error)

func (*WebhooksService) RetryDelivery

func (service *WebhooksService) RetryDelivery(ctx context.Context, id string, deliveryID string) (Response, error)

func (*WebhooksService) Test

func (service *WebhooksService) Test(ctx context.Context, id string) (Response, error)

func (*WebhooksService) Update

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL