lokalise

package module
v3.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: BSD-3-Clause Imports: 10 Imported by: 1

README

Lokalise API v2 official Golang client library

GoDoc Build status Test Coverage

Index

Getting Started

Usage

import "github.com/lokalise/go-lokalise-api/v3"	// with go modules enabled (GO111MODULE=on or outside GOPATH)
import "github.com/lokalise/go-lokalise-api" // with go modules disabled

Initializing the client


token := os.Getenv("lokalise_token")
client, err := lokalise.New(token)

General options

You can set global API parameters with the ClientOption functions during the initialization. The following functions are available:

  • WithBaseURL
  • WithRetryCount
  • WithRetryTimeout
  • WithConnectionTimeout
  • WithDebug
  • WithPageLimit

Usage:

Api, err := lokalise.New(
    "token-string",
    lokalise.WithDebug(true),
    ...
)

Objects and models

Individual objects are represented as instances of according structs. Different objects are used for creating and updating in most cases.

Here are some object types:

  • Create/Update request objects, i.e. NewKey, NewContributor etc

  • Response objects: single/multiple, i.e. KeyResponse/KeysResponse and special , i.e. DeleteKeyResponse. There is no separate ErrorResponse - errors are encapsulated into concrete method's response.

  • List options that are used for sending certain options and pagination, i.e. KeyListOptions.

Request options and pagination

Some resources, such as Projects, Keys, Files, Tasks, Screenshots, Translations have optional parameters for List method (Keys also have an option for Retrieve). These parameters should be set before calling.

All request options could be set inline and separately:


// separately:
keys := client.Keys()
keys.SetListOptions(lokalise.KeyListOptions{
    IncludeTranslations: 1,
    IncludeComments: 1,
})

resp, err := keys.List("{PROJECT_ID}")

// inline:
client.Keys().WithListOptions(lokalise.KeyListOptions{Limit: 3}).List("{PROJECT_ID}")

There are two parameters, used for pagination: Limit and Page.

t := Api.Teams()
t.SetPageOptions(lokalise.PageOptions{
    Page:  2,
    Limit: 10,
})

resp, err := t.List()

Queued Processes

Some resource actions, such as Files.upload, are subject to intensive processing before request fulfills. These processes got optimised by becoming asynchronous. The initial request only queues the data for processing and retrieves to queued process identifier. Additional request to QueuedProcesses resource could be executed to obtain the current processing result.

Example with Files.upload:

projectId := "aaaabbbb.cccc"
uploadOpts := lokalise.FileUpload{
    Filename: "test.html",
    LangISO:  "en"
}

f := Api.Files()
resp, err = f.Upload(projectId, uploadOpts)

The successful response will contain process ID, which can be used to obtain the final result:

projectId := "aaaabbbb.cccc"
processId := "ddddeeeeeffff"

q := Api.QueuedProcesses()
resp, err := q.Retrieve(projectId, processId)

Rate limits

Access to all endpoints is limited to 6 requests per second from 14 September, 2021. This limit is applied per API token and per IP address. If you exceed the limit, a 429 HTTP status code will be returned and the corresponding exception will be raised that you should handle properly. To handle such errors, we recommend an exponential backoff mechanism with a limited number of retries.

Only one concurrent request per token is allowed.

Available resources

Comments

List project comments
projectId := "aaaabbbb.cccc"
c := Api.Comments()
c.SetPageOptions(lokalise.PageOptions{Page: 1, Limit: 20})
resp, err := c.ListProject(projectId)

List key comments
projectId := "aaaabbbb.cccc"
keyId := 26835183
c := Api.Comments()
c.SetPageOptions(lokalise.PageOptions{Page: 1, Limit: 20})
resp, err := c.ListByKey(projectId, keyId)
Create
c := lokalise.NewComment{Comment: "My new comment"}
resp, err := Api.Comments().Create(projectId, keyId, []lokalise.NewComment{c})
Retrieve
...
commentId := 26835183
resp, err := Api.Comments().Retrieve(projectId, keyId, commentId)
Delete
...
resp, err := Api.Comments().Delete(projectId, keyId, commentId)

Contributors

List all contributors
projectId := "aaaabbbb.cccc"
pageOpts := lokalise.PageOptions{Page: 1, Limit: 20}

c := Api.Contributors()
c.SetPageOptions(pageOpts)
c.List(projectId)
Create contributors
contributorCreate := lokalise.NewContributor{
    Email:    "some@ema.il",
    Fullname: "New contributor",
    Permission: lokalise.Permission{
        IsAdmin:     true,
        IsReviewer:  true,
        Languages:   []lokalise.Language{{LangISO: "en", IsWritable: true}},
        AdminRights: []string{"upload", "download"},
    },
}
resp, err := Api.Contributors().Create(projectId, []lokalise.NewContributor{contributorCreate})
Retrieve contributor
userId := 47913 
resp, err := Api.Contributors().Retrieve(projectId, userId)
Update contributor
...
permissionUpdate := lokalise.Permission{
    IsReviewer: true,
    IsAdmin: false,
    AdminRights: []string{"keys", "upload", "download"},
}
resp, err := Api.Contributors().Update(projectId, userId, permissionUpdate)

Documentation

Overview

Package lokalise provides functions to access the Lokalise web API.

Usage:

import "github.com/lokalise/go-lokalise-api/v2"	// with go modules enabled (GO111MODULE=on or outside GOPATH)
import "github.com/lokalise/go-lokalise-api" // with go modules disabled

Initializing the client

token := os.Getenv("lokalise_token")
client, err := lokalise.New(token)

General options

You can set global API parameters with the ClientOption functions during the initialization. The following functions are available:

* WithBaseURL

* WithRetryCount

* WithRetryTimeout

* WithConnectionTimeout

* WithDebug

* WithPageLimit

Usage:

Api, err := lokalise.New(
	"token-string",
	lokalise.WithDebug(true),
	...
)

Objects and models

Individual objects are represented as instances of according structs. Different objects are used for creating and updating in most cases.

Here are some object types:

* Create/Update request objects, i.e. NewKey, NewContributor etc

* Response objects: single/multiple, i.e. KeyResponse/KeysResponse and special , i.e. DeleteKeyResponse. There is no separate ErrorResponse - errors are encapsulated into concrete method's response.

* List options that are used for sending certain options and pagination, i.e. KeyListOptions.

Request options and pagination

Some resources, such as Projects, Keys, Files, Tasks, Screenshots, Translations have optional parameters for List method (Keys also have an option for Retrieve). These parameters should be set before calling.

All request options could be set inline and separately:

// separately:
keys := client.Keys()
keys.SetListOptions(lokalise.KeyListOptions{
	IncludeTranslations: 1,
	IncludeComments: 1,
})

resp, err := keys.List("{PROJECT_ID}")

// inline:
client.Keys().WithListOptions(lokalise.KeyListOptions{Limit: 3}).List("{PROJECT_ID}")

There are two parameters, used for pagination: Limit and Page.

t := Api.Teams()
t.SetPageOptions(lokalise.PageOptions{
	Page:  2,
	Limit: 10,
})

resp, err := t.List()

Index

Constants

View Source
const (
	StatusCompleted  TaskStatus = "completed"
	StatusInProgress TaskStatus = "in progress"
	StatusCreated    TaskStatus = "created"
	StatusQueued     TaskStatus = "queued"

	TaskTypeTranslation TaskType = "translation"
	TaskTypeReview      TaskType = "review"

	LanguageStatusCompleted  LanguageStatus = "completed"
	LanguageStatusInProgress LanguageStatus = "in progress"
	LanguageStatusCreated    LanguageStatus = "created"
)

noinspection GoUnusedConst

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

Types

type Api

type Api struct {
	Branches             func() *BranchService
	Comments             func() *CommentService
	Contributors         func() *ContributorService
	Files                func() *FileService
	Keys                 func() *KeyService
	Languages            func() *LanguageService
	Orders               func() *OrderService
	PaymentCards         func() *PaymentCardService
	Projects             func() *ProjectService
	QueuedProcesses      func() *QueuedProcessService
	Screenshots          func() *ScreenshotService
	Segments             func() *SegmentationService
	Snapshots            func() *SnapshotService
	Tasks                func() *TaskService
	Teams                func() *TeamService
	TeamUserGroups       func() *TeamUserGroupService
	TeamUsers            func() *TeamUserService
	TranslationProviders func() *TranslationProviderService
	Translations         func() *TranslationService
	TranslationStatuses  func() *TranslationStatusService
	Webhooks             func() *WebhookService
	// contains filtered or unexported fields
}

func New

func New(apiToken string, options ...ClientOption) (*Api, error)

type BaseService

type BaseService struct {
	PageOptions
	// contains filtered or unexported fields
}

func (*BaseService) Ctx

func (s *BaseService) Ctx() context.Context

func (*BaseService) PageOpts

func (s *BaseService) PageOpts() PageOptions

func (*BaseService) SetContext

func (s *BaseService) SetContext(c context.Context)

func (*BaseService) SetPageOptions

func (s *BaseService) SetPageOptions(opts PageOptions)

type Branch

type Branch struct {
	WithCreationTime
	WithCreationUser

	BranchID int64  `json:"branch_id"`
	Name     string `json:"name"`
}

type BranchService

type BranchService struct {
	BaseService
}

BranchService handles communication with the branch related methods of the Lokalise API.

Lokalise API docs: https://lokalise.com/api2docs/curl/#resource-branches

func (*BranchService) Create

func (c *BranchService) Create(projectID string, name string) (r CreateBranchResponse, err error)

Create creates a branch in the project. Requires admin right.

Lokalise API docs: https://lokalise.com/api2docs/curl/#transition-create-a-branch-post

func (*BranchService) Delete

func (c *BranchService) Delete(projectID string, ID int64) (r DeleteBranchResponse, err error)

Delete deletes a configured branch in the project. Requires admin right.

Lokalise API docs: https://lokalise.com/api2docs/curl/#transition-delete-a-branch-delete

func (*BranchService) List

func (c *BranchService) List(projectID string) (r ListBranchesResponse, err error)

List retrieves a list of branches

Lokalise API docs: https://lokalise.com/api2docs/curl/#transition-list-all-branches-get

type BulkUpdateKey

type BulkUpdateKey struct {
	KeyID int64 `json:"key_id"`
	NewKey
}

BulkUpdateKey Separate struct for bulk updating

func (BulkUpdateKey) MarshalJSON added in v3.4.0

func (k BulkUpdateKey) MarshalJSON() ([]byte, error)

MarshalJSON Preserve fields for BulkUpdateKey when custom marshaling of anonymous fields are used

type BulkUpdateKeysRequest

type BulkUpdateKeysRequest struct {
	Keys []BulkUpdateKey `json:"keys"`
	KeyRequestOptions
}

type ClientOption

type ClientOption func(*Api) error

func WithBaseURL

func WithBaseURL(url string) ClientOption

WithBaseURL returns a ClientOption setting the base URL of the client. This should only be used for testing different API versions or for using a mocked backend in tests. noinspection GoUnusedExportedFunction

func WithConnectionTimeout

func WithConnectionTimeout(t time.Duration) ClientOption

func WithDebug

func WithDebug(dbg bool) ClientOption

func WithPageLimit

func WithPageLimit(limit uint) ClientOption

func WithRetryCount

func WithRetryCount(count int) ClientOption

WithRetryCount returns a client ClientOption setting the retry count of outgoing requests. if count is zero retries are disabled.

func WithRetryTimeout

func WithRetryTimeout(t time.Duration) ClientOption

Sets default wait time to sleep before retrying request. Default is 100 milliseconds. noinspection GoUnusedExportedFunction

type Comment

type Comment struct {
	CommentID    int64  `json:"comment_id"`
	KeyID        int64  `json:"key_id"`
	Comment      string `json:"comment"`
	AddedBy      int64  `json:"added_by"`
	AddedByEmail string `json:"added_by_email"`
	AddedAt      string `json:"added_at"`
	AddedAtTs    int64  `json:"added_at_timestamp"`
}

type CommentResponse

type CommentResponse struct {
	WithProjectID
	Comment Comment `json:"comment"`
}

type CommentService

type CommentService struct {
	BaseService
}

The Comment service

func (*CommentService) Create

func (c *CommentService) Create(projectID string, keyID int64, comments []NewComment) (r ListCommentsResponse, err error)

Adds a set of comments to the key

func (*CommentService) Delete

func (c *CommentService) Delete(projectID string, keyID, commentID int64) (r DeleteCommentResponse, err error)

Deletes a comment from the project. Authenticated user can only delete own comments

func (*CommentService) ListByKey

func (c *CommentService) ListByKey(projectID string, keyID int64) (r ListCommentsResponse, err error)

Retrieves a list of all comments for a key

func (*CommentService) ListProject

func (c *CommentService) ListProject(projectID string) (r ListCommentsResponse, err error)

Retrieves a list of all comments in the project

func (*CommentService) Retrieve

func (c *CommentService) Retrieve(projectID string, keyID, commentID int64) (r CommentResponse, err error)

Retrieves a Comment

type Contributor

type Contributor struct {
	WithCreationTime
	WithUserID

	Email    string `json:"email"`
	Fullname string `json:"fullname"`
	Permission
}

type ContributorResponse

type ContributorResponse struct {
	WithProjectID
	Contributor Contributor `json:"contributor"`
}

type ContributorService

type ContributorService struct {
	BaseService
}

func (*ContributorService) Create

func (c *ContributorService) Create(projectID string, cs []NewContributor) (r ContributorsResponse, err error)

func (*ContributorService) Delete

func (c *ContributorService) Delete(projectID string, userID int64) (r DeleteContributorResponse, err error)

func (*ContributorService) List

func (c *ContributorService) List(projectID string) (r ContributorsResponse, err error)

func (*ContributorService) Retrieve

func (c *ContributorService) Retrieve(projectID string, userID int64) (r ContributorResponse, err error)

func (*ContributorService) Update

func (c *ContributorService) Update(projectID string, userID int64, p Permission) (r ContributorResponse, err error)

type ContributorsResponse

type ContributorsResponse struct {
	Paged
	WithProjectID
	Contributors []Contributor `json:"contributors"`
}

type CreateBranchRequest

type CreateBranchRequest struct {
	Name string `json:"name"`
}

type CreateBranchResponse

type CreateBranchResponse struct {
	WithProjectID
	Branch Branch `json:"branch"`
}

type CreateGroupResponse

type CreateGroupResponse struct {
	WithTeamID
	Group TeamUserGroup `json:"group"`
}

type CreateKeysRequest

type CreateKeysRequest struct {
	Keys []NewKey `json:"keys"`
	KeyRequestOptions
}

type CreateLanguageResponse

type CreateLanguageResponse struct {
	WithProjectID
	Languages []Language `json:"languages"`
}

type CreateOrder

type CreateOrder struct {
	ProjectID         string   `json:"project_id"`
	CardID            int64    `json:"card_id"`
	Briefing          string   `json:"briefing"`
	SourceLangISO     string   `json:"source_language_iso"`
	TargetLangISOs    []string `json:"target_language_isos"`
	Keys              []int    `json:"keys"`
	ProviderSlug      string   `json:"provider_slug"`
	TranslationTierID int64    `json:"translation_tier"`
	DryRun            bool     `json:"dry_run,omitempty"`
	TranslationStyle  string   `json:"translation_style,omitempty"`
}

type CreatePaymentCard

type CreatePaymentCard struct {
	Number   string `json:"number"`
	CVC      string `json:"cvc"`
	ExpMonth int64  `json:"exp_month"`
	ExpYear  int64  `json:"exp_year"`
}

type CreateSnapshotResponse

type CreateSnapshotResponse struct {
	WithProjectID
	Snapshot Snapshot `json:"snapshot"`
}

type CreateTask

type CreateTask struct {
	Title     string           `json:"title"`
	Languages []CreateTaskLang `json:"languages"`

	Description        string   `json:"description,omitempty"`
	DueDate            string   `json:"due_date,omitempty"`
	Keys               []int64  `json:"keys,omitempty"`
	AutoCloseLanguages *bool    `json:"auto_close_languages,omitempty"`
	AutoCloseTask      *bool    `json:"auto_close_task,omitempty"`
	AutoCloseItems     *bool    `json:"auto_close_items,omitempty"`
	InitialTMLeverage  bool     `json:"initial_tm_leverage,omitempty"`
	TaskType           TaskType `json:"task_type,omitempty"`
	ParentTaskID       int64    `json:"parent_task_id,omitempty"`
	ClosingTags        []string `json:"closing_tags,omitempty"`
	LockTranslations   bool     `json:"do_lock_translations,omitempty"`

	CustomTranslationStatusIDs []int64 `json:"custom_translation_status_ids,omitempty"`
}

type CreateTaskLang

type CreateTaskLang struct {
	LanguageISO   string  `json:"language_iso,omitempty"`
	Users         []int64 `json:"users,omitempty"`
	Groups        []int64 `json:"groups,omitempty"`
	CloseLanguage bool    `json:"close_language,omitempty"` // only for updating
}

type CreateWebhook

type CreateWebhook struct {
	URL          string      `json:"url"`
	Events       []string    `json:"events"`
	EventLangMap []EventLang `json:"event_lang_map,omitempty"`
	Branch       string      `json:"branch,omitempty"`
}

type DeleteBranchResponse

type DeleteBranchResponse struct {
	WithProjectID
	BranchDeleted bool `json:"branch_deleted"`
}

type DeleteCommentResponse

type DeleteCommentResponse struct {
	WithProjectID
	IsDeleted bool `json:"comment_deleted"`
}

type DeleteContributorResponse

type DeleteContributorResponse struct {
	WithProjectID
	IsDeleted bool `json:"contributor_deleted"`
}

type DeleteGroupResponse

type DeleteGroupResponse struct {
	WithTeamID
	IsDeleted bool `json:"group_deleted"`
}

type DeleteKeyResponse

type DeleteKeyResponse struct {
	WithProjectID
	IsRemoved      bool  `json:"key_removed"`
	NumberOfLocked int64 `json:"keys_locked"`
}

type DeleteKeysResponse

type DeleteKeysResponse struct {
	WithProjectID
	AreRemoved     bool  `json:"keys_removed"`
	NumberOfLocked int64 `json:"keys_locked"`
}

type DeleteLanguageResponse

type DeleteLanguageResponse struct {
	WithProjectID
	LanguageDeleted bool `json:"language_deleted"`
}

type DeletePaymentCardResponse

type DeletePaymentCardResponse struct {
	CardID  int64 `json:"card_id"`
	Deleted bool  `json:"card_deleted"`
}

type DeleteProjectResponse

type DeleteProjectResponse struct {
	WithProjectID
	Deleted bool `json:"project_deleted"`
}

type DeleteScreenshotResponse

type DeleteScreenshotResponse struct {
	WithProjectID
	Deleted bool `json:"screenshot_deleted"`
}

type DeleteSnapshotResponse

type DeleteSnapshotResponse struct {
	WithProjectID
	SnapshotDeleted bool `json:"snapshot_deleted"`
}

type DeleteTaskResponse

type DeleteTaskResponse struct {
	WithProjectID
	Deleted bool `json:"task_deleted"`
}

type DeleteTeamUserResponse

type DeleteTeamUserResponse struct {
	WithTeamID
	Deleted bool `json:"team_user_deleted"`
}

type DeleteTranslationStatusResponse

type DeleteTranslationStatusResponse struct {
	WithProjectID
	Deleted bool `json:"deleted"`
}

type DeleteWebhookResponse

type DeleteWebhookResponse struct {
	WithProjectID
	Deleted bool `json:"webhook_deleted"`
}

type Error

type Error struct {
	Code    int    `json:"code,omitempty"`
	Message string `json:"message,omitempty"`
}

Error is an API error.

func (Error) Error

func (r Error) Error() string

type ErrorKeys

type ErrorKeys struct {
	Error
	Key struct {
		KeyName string `json:"key_name"`
	} `json:"key"`
}

ErrorKeys is error for key create/update API

type EventLang

type EventLang struct {
	Event        string   `json:"event"`
	LangISOCodes []string `json:"lang_iso_codes"`
}

type File

type File struct {
	Filename string `json:"filename"`
	KeyCount int64  `json:"key_count"`
}

type FileDownload

type FileDownload struct {
	Format                     string            `json:"format"`
	OriginalFilenames          *bool             `json:"original_filenames,omitempty"`
	BundleStructure            string            `json:"bundle_structure,omitempty"`
	DirectoryPrefix            *string           `json:"directory_prefix,omitempty"`
	AllPlatforms               bool              `json:"all_platforms,omitempty"`
	FilterLangs                []string          `json:"filter_langs,omitempty"`
	FilterData                 []string          `json:"filter_data,omitempty"`
	FilterFilenames            []string          `json:"filter_filenames,omitempty"`
	AddNewlineEOF              bool              `json:"add_newline_eof,omitempty"`
	CustomTranslationStatusIDs []string          `json:"custom_translation_status_ids,omitempty"`
	IncludeTags                []string          `json:"include_tags,omitempty"`
	ExcludeTags                []string          `json:"exclude_tags,omitempty"`
	ExportSort                 string            `json:"export_sort,omitempty"`
	ExportEmptyAs              string            `json:"export_empty_as,omitempty"`
	IncludeComments            bool              `json:"include_comments,omitempty"`
	IncludeDescription         *bool             `json:"include_description,omitempty"`
	IncludeProjectIDs          []string          `json:"include_pids,omitempty"`
	Triggers                   []string          `json:"triggers,omitempty"`
	FilterRepositories         []string          `json:"filter_repositories,omitempty"`
	ReplaceBreaks              *bool             `json:"replace_breaks,omitempty"`
	DisableReferences          bool              `json:"disable_references,omitempty"`
	PluralFormat               string            `json:"plural_format,omitempty"`
	PlaceholderFormat          string            `json:"placeholder_format,omitempty"`
	WebhookURL                 string            `json:"webhook_url,omitempty"`
	LanguageMapping            []LanguageMapping `json:"language_mapping,omitempty"`
	ICUNumeric                 bool              `json:"icu_numeric,omitempty"`
	EscapePercent              bool              `json:"escape_percent,omitempty"`
	Indentation                string            `json:"indentation,omitempty"`
	YAMLIncludeRoot            bool              `json:"yaml_include_root,omitempty"`
	JSONUnescapedSlashes       bool              `json:"json_unescaped_slashes,omitempty"`
	JavaPropertiesEncoding     string            `json:"java_properties_encoding,omitempty"`
	JavaPropertiesSeparator    string            `json:"java_properties_separator,omitempty"`
	BundleDescription          string            `json:"bundle_description,omitempty"`
}

type FileDownloadResponse

type FileDownloadResponse struct {
	WithProjectID
	BundleURL string `json:"bundle_url"`
}

type FileListOptions

type FileListOptions struct {
	Limit    uint   `url:"limit,omitempty"`
	Page     uint   `url:"page,omitempty"`
	Filename string `url:"filter_filename,omitempty"`
}

func (FileListOptions) Apply

func (options FileListOptions) Apply(req *resty.Request)

type FileService

type FileService struct {
	BaseService
	// contains filtered or unexported fields
}

func (*FileService) Download

func (c *FileService) Download(projectID string, downloadOptions FileDownload) (r FileDownloadResponse, err error)

func (*FileService) List

func (c *FileService) List(projectID string) (r FilesResponse, err error)

func (*FileService) ListOpts

func (c *FileService) ListOpts() FileListOptions

func (*FileService) SetListOptions

func (c *FileService) SetListOptions(o FileListOptions)

func (*FileService) Upload

func (c *FileService) Upload(projectID string, file FileUpload) (r FileUploadResponse, err error)

func (*FileService) WithListOptions

func (c *FileService) WithListOptions(o FileListOptions) *FileService

type FileUpload

type FileUpload struct {
	Data     string   `json:"data"`
	Filename string   `json:"filename"`
	LangISO  string   `json:"lang_iso"`
	Tags     []string `json:"tags,omitempty"`

	ConvertPlaceholders                 *bool   `json:"convert_placeholders,omitempty"`
	DetectICUPlurals                    bool    `json:"detect_icu_plurals,omitempty"`
	TagInsertedKeys                     *bool   `json:"tag_inserted_keys,omitempty"`
	TagUpdatedKeys                      *bool   `json:"tag_updated_keys,omitempty"`
	TagSkippedKeys                      bool    `json:"tag_skipped_keys,omitempty"`
	ReplaceModified                     bool    `json:"replace_modified,omitempty"`
	SlashNToLinebreak                   *bool   `json:"slashn_to_linebreak,omitempty"`
	KeysToValues                        bool    `json:"keys_to_values,omitempty"`
	DistinguishByFile                   bool    `json:"distinguish_by_file,omitempty"`
	ApplyTM                             bool    `json:"apply_tm,omitempty"`
	HiddenFromContributors              bool    `json:"hidden_from_contributors,omitempty"`
	CleanupMode                         bool    `json:"cleanup_mode,omitempty"`
	CustomTranslationStatusIds          []int64 `json:"custom_translation_status_ids,omitempty"`
	CustomTranslationStatusInsertedKeys *bool   `json:"custom_translation_status_inserted_keys,omitempty"`
	CustomTranslationStatusUpdatedKeys  *bool   `json:"custom_translation_status_updated_keys,omitempty"`
	CustomTranslationStatusSkippedKeys  *bool   `json:"custom_translation_status_skipped_keys,omitempty"`
	Queue                               bool    `json:"queue"`
	SkipDetectLangIso                   bool    `json:"skip_detect_lang_iso,omitempty"`
	UseAutomations                      *bool   `json:"use_automations,omitempty"`
}

type FileUploadResponse

type FileUploadResponse struct {
	WithProjectID
	Process QueuedProcess `json:"process"`
}

type FilesResponse

type FilesResponse struct {
	Paged
	WithProjectID
	Files []File `json:"files"`
}

type Key

type Key struct {
	WithCreationTime

	KeyID   int64           `json:"key_id"`
	KeyName PlatformStrings `json:"key_name"`

	Filenames    PlatformStrings `json:"filenames"`
	Description  string          `json:"description"`
	Platforms    []string        `json:"platforms"`
	Tags         []string        `json:"tags"`
	Comments     []Comment       `json:"comments"`
	Screenshots  []Screenshot    `json:"screenshots"`
	Translations []Translation   `json:"translations"`

	IsPlural         bool   `json:"is_plural"`
	PluralName       string `json:"plural_name,omitempty"`
	IsHidden         bool   `json:"is_hidden"`
	IsArchived       bool   `json:"is_archived"`
	Context          string `json:"context,omitempty"`
	BaseWords        int    `json:"base_words"`
	CharLimit        int    `json:"char_limit"`
	CustomAttributes string `json:"custom_attributes,omitempty"`

	ModifiedAt   string `json:"modified_at,omitempty"`
	ModifiedAtTs int64  `json:"modified_at_timestamp,omitempty"`
}

The Key object

type KeyListOptions

type KeyListOptions struct {
	// page options
	Page  uint `url:"page,omitempty"`
	Limit uint `url:"limit,omitempty"`

	// Possible values are 1 and 0.
	DisableReferences   uint8 `url:"disable_references,omitempty"`
	IncludeComments     uint8 `url:"include_comments,omitempty"`
	IncludeScreenshots  uint8 `url:"include_screenshots,omitempty"`
	IncludeTranslations uint8 `url:"include_translations,omitempty"`

	FilterTranslationLangIDs string `url:"filter_translation_lang_ids,omitempty"`
	FilterTags               string `url:"filter_tags,omitempty"`
	FilterFilenames          string `url:"filter_filenames,omitempty"`
	FilterKeys               string `url:"filter_keys,omitempty"`
	FilterKeyIDs             string `url:"filter_key_ids,omitempty"`
	FilterPlatforms          string `url:"filter_platforms,omitempty"`
	FilterUntranslated       string `url:"filter_untranslated,omitempty"`
	FilterQAIssues           string `url:"filter_qa_issues,omitempty"`
}

List options

func (KeyListOptions) Apply

func (options KeyListOptions) Apply(req *resty.Request)

type KeyRequestOption

type KeyRequestOption func(options *KeyRequestOptions)

func WithAutomations

func WithAutomations(UseAutomations bool) KeyRequestOption

type KeyRequestOptions

type KeyRequestOptions struct {
	UseAutomations *bool `json:"use_automations,omitempty"`
}

‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ Service request/response objects _____________________________________________________________________________________________________________________

type KeyResponse

type KeyResponse struct {
	WithProjectID
	Key Key `json:"key"`
}

type KeyRetrieveOptions

type KeyRetrieveOptions struct {
	DisableReferences uint8 `url:"disable_references,omitempty"`
}

Retrieve options

func (KeyRetrieveOptions) Apply

func (options KeyRetrieveOptions) Apply(req *resty.Request)

type KeyService

type KeyService struct {
	BaseService
	// contains filtered or unexported fields
}

The Key service

func (*KeyService) BulkDelete

func (c *KeyService) BulkDelete(projectID string, keyIDs []int64) (r DeleteKeysResponse, err error)

func (*KeyService) BulkUpdate

func (c *KeyService) BulkUpdate(projectID string, keys []BulkUpdateKey, options ...KeyRequestOption) (r KeysResponse, err error)

func (*KeyService) Create

func (c *KeyService) Create(projectID string, keys []NewKey, options ...KeyRequestOption) (r KeysResponse, err error)

func (*KeyService) Delete

func (c *KeyService) Delete(projectID string, keyID int64) (r DeleteKeyResponse, err error)

func (*KeyService) List

func (c *KeyService) List(projectID string) (r KeysResponse, err error)

func (*KeyService) ListOpts

func (c *KeyService) ListOpts() KeyListOptions

func (*KeyService) Retrieve

func (c *KeyService) Retrieve(projectID string, keyID int64) (r KeyResponse, err error)

func (*KeyService) RetrieveOpts

func (c *KeyService) RetrieveOpts() KeyRetrieveOptions

func (*KeyService) SetListOptions

func (c *KeyService) SetListOptions(o KeyListOptions)

func (*KeyService) SetRetrieveOptions

func (c *KeyService) SetRetrieveOptions(o KeyRetrieveOptions)

func (*KeyService) Update

func (c *KeyService) Update(projectID string, keyID int64, key NewKey) (r KeyResponse, err error)

func (*KeyService) WithListOptions

func (c *KeyService) WithListOptions(o KeyListOptions) *KeyService

func (*KeyService) WithRetrieveOptions

func (c *KeyService) WithRetrieveOptions(o KeyRetrieveOptions) *KeyService

type KeysResponse

type KeysResponse struct {
	Paged
	WithProjectID
	Keys   []Key       `json:"keys"`
	Errors []ErrorKeys `json:"error,omitempty"`
}

type Language

type Language struct {
	LangID      int64    `json:"lang_id,omitempty"`
	LangISO     string   `json:"lang_iso"`
	LangName    string   `json:"lang_name,omitempty"`
	IsRTL       bool     `json:"is_rtl,omitempty"`
	IsWritable  bool     `json:"is_writable"`
	PluralForms []string `json:"plural_forms,omitempty"`
}

type LanguageMapping

type LanguageMapping struct {
	OriginalLangISO string `json:"original_language_iso"`
	CustomLangISO   string `json:"custom_language_iso"`
}

type LanguageService

type LanguageService struct {
	BaseService
}

func (*LanguageService) Create

func (c *LanguageService) Create(projectID string, languages []NewLanguage) (r CreateLanguageResponse, err error)

func (*LanguageService) Delete

func (c *LanguageService) Delete(projectID string, ID int64) (r DeleteLanguageResponse, err error)

func (*LanguageService) ListProject

func (c *LanguageService) ListProject(projectID string) (r ListLanguagesResponse, err error)

func (*LanguageService) ListSystem

func (c *LanguageService) ListSystem() (r ListLanguagesResponse, err error)

func (*LanguageService) Retrieve

func (c *LanguageService) Retrieve(projectID string, ID int64) (r RetrieveLanguageResponse, err error)

func (*LanguageService) Update

func (c *LanguageService) Update(projectID string, ID int64, language UpdateLanguage) (r UpdateLanguageResponse, err error)

type LanguageStatistics

type LanguageStatistics struct {
	LanguageID  int64  `json:"language_id"`
	LanguageISO string `json:"language_iso"`
	Progress    int64  `json:"progress"`
	WordsToDo   int64  `json:"words_to_do"`
}

type LanguageStatus

type LanguageStatus string

type ListBranchesResponse

type ListBranchesResponse struct {
	Paged
	WithProjectID
	Branches []Branch `json:"branches"`
}

type ListColorsTranslationStatusResponse

type ListColorsTranslationStatusResponse struct {
	Colors []string `json:"colors"`
}

type ListCommentsResponse

type ListCommentsResponse struct {
	Paged
	WithProjectID
	Comments []Comment `json:"comments"`
}

type ListLanguagesResponse

type ListLanguagesResponse struct {
	Paged
	WithProjectID
	Languages []Language `json:"languages"`
}

type ListSnapshotsResponse

type ListSnapshotsResponse struct {
	Paged
	WithProjectID
	Snapshots []Snapshot `json:"snapshots"`
}

type NewComment

type NewComment struct {
	Comment string `json:"comment"`
}

type NewContributor

type NewContributor struct {
	Email    string `json:"email"`
	Fullname string `json:"fullname,omitempty"`
	Permission
}

type NewGroup

type NewGroup struct {
	Name        string            `json:"name"`
	IsAdmin     bool              `json:"is_admin"`
	IsReviewer  bool              `json:"is_reviewer"`
	AdminRights []string          `json:"admin_rights,omitempty"`
	Languages   NewGroupLanguages `json:"languages,omitempty"`
}

type NewGroupLanguages

type NewGroupLanguages struct {
	Reference     []int64 `json:"reference"`
	Contributable []int64 `json:"contributable"`
}

‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ Service request/response objects _____________________________________________________________________________________________________________________

type NewKey

type NewKey struct {
	// KeyName could be string or PlatformStrings
	KeyName      interface{}      `json:"key_name,omitempty"` // could be empty in case of updating
	Description  string           `json:"description,omitempty"`
	Platforms    []string         `json:"platforms,omitempty"` // could be empty in case of updating
	Filenames    *PlatformStrings `json:"filenames,omitempty"`
	Tags         []string         `json:"tags"`
	MergeTags    bool             `json:"merge_tags,omitempty"`
	Comments     []NewComment     `json:"comments,omitempty"`
	Screenshots  []NewScreenshot  `json:"screenshots,omitempty"`
	Translations []NewTranslation `json:"translations,omitempty"`

	IsPlural         bool   `json:"is_plural,omitempty"`
	PluralName       string `json:"plural_name,omitempty"`
	IsHidden         bool   `json:"is_hidden,omitempty"`
	IsArchived       bool   `json:"is_archived,omitempty"`
	Context          string `json:"context,omitempty"`
	BaseWords        int    `json:"base_words,omitempty"`
	CharLimit        int    `json:"char_limit,omitempty"`
	CustomAttributes string `json:"custom_attributes,omitempty"`
}

func (NewKey) MarshalJSON added in v3.4.0

func (k NewKey) MarshalJSON() ([]byte, error)

MarshalJSON Remove null tags array, preserve empty array in json

type NewLanguage

type NewLanguage struct {
	LangISO           string   `json:"lang_iso"`
	CustomISO         string   `json:"custom_iso,omitempty"`
	CustomName        string   `json:"custom_name,omitempty"`
	CustomPluralForms []string `json:"custom_plural_forms,omitempty"`
}

type NewProject

type NewProject struct {
	WithTeamID // optional

	Name        string `json:"name"`
	Description string `json:"description,omitempty"`

	Languages   []NewLanguage `json:"languages,omitempty"`
	BaseLangISO string        `json:"base_lang_iso,omitempty"` // Default: en // Differs from Project struct!

	// Allowed values are localization_files, paged_documents
	// Default: localization_files
	ProjectType string `json:"project_type,omitempty"`
}

type NewScreenshot

type NewScreenshot struct {
	// The screenshot, base64 encoded (with leading image type `data:image/jpeg;base64,`).
	// Supported file formats are JPG and PNG.
	Body        string   `json:"data"` // maybe []byte?
	Title       string   `json:"title,omitempty"`
	Description string   `json:"description,omitempty"`
	Ocr         *bool    `json:"ocr,omitempty"`
	KeyIDs      []int64  `json:"key_ids,omitempty"`
	Tags        []string `json:"tags,omitempty"`
}

type NewTranslation

type NewTranslation struct {
	LanguageISO                    string  `json:"language_iso"`
	Translation                    string  `json:"translation"`
	IsFuzzy                        *bool   `json:"is_fuzzy,omitempty"`
	IsReviewed                     bool    `json:"is_reviewed,omitempty"`
	CustomTranslationStatusIds     []int64 `json:"custom_translation_status_ids,omitempty"`
	MergeCustomTranslationStatuses bool    `json:"merge_custom_translation_statuses,omitempty"`
}

Used for NewKey

func (NewTranslation) MarshalJSON

func (t NewTranslation) MarshalJSON() ([]byte, error)

func (*NewTranslation) UnmarshalJSON

func (t *NewTranslation) UnmarshalJSON(data []byte) error

type NewTranslationStatus

type NewTranslationStatus struct {
	Title string `json:"title"`
	Color string `json:"color"`
}

type OptionsApplier

type OptionsApplier interface {
	Apply(req *resty.Request)
}

type Order

type Order struct {
	WithProjectID
	WithCreationTime
	WithCreationUser

	OrderID             string           `json:"order_id"`
	CardID              int64            `json:"card_id"`
	Status              string           `json:"status"`
	SourceLangISO       string           `json:"source_language_iso"`
	TargetLangISOs      []string         `json:"target_language_isos"`
	Keys                []int64          `json:"keys"`
	SourceWords         map[string]int64 `json:"source_words"`
	ProviderSlug        string           `json:"provider_slug"`
	TranslationStyle    string           `json:"translation_style,omitempty"`
	TranslationTierID   int64            `json:"translation_tier"`
	TranslationTierName string           `json:"translation_tier_name"`
	Briefing            string           `json:"briefing,omitempty"`
	Total               float64          `json:"total"`
}

type OrderService

type OrderService struct {
	BaseService
}

func (*OrderService) Create

func (c *OrderService) Create(teamID int64, order CreateOrder) (r Order, err error)

func (*OrderService) List

func (c *OrderService) List(teamID int64) (r OrdersResponse, err error)

func (*OrderService) Retrieve

func (c *OrderService) Retrieve(teamID int64, orderID string) (r Order, err error)

type OrdersResponse

type OrdersResponse struct {
	Paged
	Orders []Order `json:"orders"`
}

type PageCounter

type PageCounter interface {
	NumberOfPages() int64
	CurrentPage() int64
}

type PageOptions

type PageOptions struct {
	Limit uint `url:"limit,omitempty"`
	Page  uint `url:"page,omitempty"`
}

func (PageOptions) Apply

func (options PageOptions) Apply(req *resty.Request)

type Paged

type Paged struct {
	TotalCount int64 `json:"-"`
	PageCount  int64 `json:"-"`
	Limit      int64 `json:"-"`
	Page       int64 `json:"-"`
}

func (Paged) CurrentPage

func (p Paged) CurrentPage() int64

func (Paged) NumberOfPages

func (p Paged) NumberOfPages() int64

type PaymentCard

type PaymentCard struct {
	WithCreationTime
	CardId int64  `json:"card_id"`
	Last4  string `json:"last4"`
	Brand  string `json:"brand"`
}

type PaymentCardResponse

type PaymentCardResponse struct {
	WithUserID
	Card PaymentCard `json:"payment_card"`
}

type PaymentCardService

type PaymentCardService struct {
	BaseService
}

func (*PaymentCardService) Create

func (c *PaymentCardService) Create(card CreatePaymentCard) (r PaymentCard, err error)

func (*PaymentCardService) Delete

func (c *PaymentCardService) Delete(cardID int64) (r DeletePaymentCardResponse, err error)

func (*PaymentCardService) List

func (c *PaymentCardService) List() (r PaymentCardsResponse, err error)

func (*PaymentCardService) Retrieve

func (c *PaymentCardService) Retrieve(cardID int64) (r PaymentCardResponse, err error)

type PaymentCardsResponse

type PaymentCardsResponse struct {
	Paged
	WithUserID
	Cards []PaymentCard `json:"payment_cards"`
}

type Permission

type Permission struct {
	IsAdmin    bool       `json:"is_admin"`
	IsReviewer bool       `json:"is_reviewer"`
	Languages  []Language `json:"languages,omitempty"`

	// Possible values are upload, activity, download, settings, statistics, keys, screenshots, contributors, languages
	AdminRights []string `json:"admin_rights,omitempty"` // todo make admin rights as constants available in the lib
}

type PlatformStrings

type PlatformStrings struct {
	Ios     string `json:"ios,omitempty"`
	Android string `json:"android,omitempty"`
	Web     string `json:"web,omitempty"`
	Other   string `json:"other,omitempty"`
}

type Project

type Project struct {
	WithProjectID
	WithTeamID
	WithCreationTime
	WithCreationUser

	Name        string `json:"name"`
	Description string `json:"description"`
	Type        string `json:"project_type,omitempty"`

	BaseLangID  int64  `json:"base_language_id"`
	BaseLangISO string `json:"base_language_iso"`

	Settings   *ProjectSettings   `json:"settings"`
	Statistics *ProjectStatistics `json:"statistics"`
}

type ProjectListOptions

type ProjectListOptions struct {
	// page options
	Page  uint `url:"page,omitempty"`
	Limit uint `url:"limit,omitempty"`

	FilterTeamID int64  `url:"filter_team_id,omitempty"`
	FilterNames  string `url:"filter_names,omitempty"`

	// Possible values are 1 and 0, default 1
	IncludeStat     string `url:"include_statistics,omitempty"`
	IncludeSettings string `url:"include_settings,omitempty"`
}

List options

func (ProjectListOptions) Apply

func (options ProjectListOptions) Apply(req *resty.Request)

type ProjectService

type ProjectService struct {
	BaseService
	// contains filtered or unexported fields
}

The Project service

func (*ProjectService) Create

func (c *ProjectService) Create(project NewProject) (r Project, err error)

Creates a new project in the specified team. Requires Admin role in the team.

func (*ProjectService) Delete

func (c *ProjectService) Delete(projectID string) (r DeleteProjectResponse, err error)

func (*ProjectService) List

func (c *ProjectService) List() (r ProjectsResponse, err error)

Retrieves a list of projects available to the user

func (*ProjectService) ListOpts

func (c *ProjectService) ListOpts() ProjectListOptions

func (*ProjectService) Retrieve

func (c *ProjectService) Retrieve(projectID string) (r Project, err error)

func (*ProjectService) SetListOptions

func (c *ProjectService) SetListOptions(o ProjectListOptions)

func (*ProjectService) Truncate

func (c *ProjectService) Truncate(projectID string) (r TruncateProjectResponse, err error)

func (*ProjectService) Update

func (c *ProjectService) Update(projectID string, project UpdateProject) (r Project, err error)

func (*ProjectService) WithListOptions

func (c *ProjectService) WithListOptions(o ProjectListOptions) *ProjectService

type ProjectSettings

type ProjectSettings struct {
	PerPlatformKeyNames       bool `json:"per_platform_key_names"`
	Reviewing                 bool `json:"reviewing"`
	Upvoting                  bool `json:"upvoting"`
	AutoToggleUnverified      bool `json:"auto_toggle_unverified"`
	OfflineTranslation        bool `json:"offline_translation"`
	KeyEditing                bool `json:"key_editing"`
	InlineMachineTranslations bool `json:"inline_machine_translations"`
}

type ProjectStatistics

type ProjectStatistics struct {
	ProgressTotal int64                `json:"progress_total"`
	KeysTotal     int64                `json:"keys_total"`
	Team          int64                `json:"team"`
	BaseWords     int64                `json:"base_words"`
	QAIssuesTotal int64                `json:"qa_issues_total"`
	QAIssues      QAIssues             `json:"qa_issues"`
	Languages     []LanguageStatistics `json:"languages"`
}

type ProjectsResponse

type ProjectsResponse struct {
	Paged
	Projects []Project `json:"projects"`
}

type QAIssues

type QAIssues struct {
	NotReviewed                   int64 `json:"not_reviewed"`
	Unverified                    int64 `json:"unverified"`
	SpellingGrammar               int64 `json:"spelling_grammar"`
	InconsistentPlaceholders      int64 `json:"inconsistent_placeholders"`
	InconsistentHtml              int64 `json:"inconsistent_html"`
	DifferentNumberOfUrls         int64 `json:"different_number_of_urls"`
	DifferentUrls                 int64 `json:"different_urls"`
	LeadingWhitespace             int64 `json:"leading_whitespace"`
	TrailingWhitespace            int64 `json:"trailing_whitespace"`
	DifferentNumberOfEmailAddress int64 `json:"different_number_of_email_address"`
	DifferentEmailAddress         int64 `json:"different_email_address"`
	DifferentBrackets             int64 `json:"different_brackets"`
	DifferentNumbers              int64 `json:"different_numbers"`
	DoubleSpace                   int64 `json:"double_space"`
	SpecialPlaceholder            int64 `json:"special_placeholder"`
}

type QueuedProcess

type QueuedProcess struct {
	ID      string      `json:"process_id"`
	Type    string      `json:"type"`
	Status  string      `json:"status"`
	Message string      `json:"message"`
	Details interface{} `json:"details"`
	WithCreationUser
	WithCreationTime
}

type QueuedProcessResponse

type QueuedProcessResponse struct {
	WithProjectID
	Process QueuedProcess `json:"process"`
}

type QueuedProcessService

type QueuedProcessService struct {
	BaseService
}

func (*QueuedProcessService) List

func (c *QueuedProcessService) List(projectID string) (r QueuedProcessesResponse, err error)

func (*QueuedProcessService) Retrieve

func (c *QueuedProcessService) Retrieve(projectID string, processID string) (r QueuedProcessResponse, err error)

type QueuedProcessesResponse

type QueuedProcessesResponse struct {
	WithProjectID
	Processes []QueuedProcess `json:"processes"`
}

type Quota

type Quota struct {
	Users    int64 `json:"users"`
	Keys     int64 `json:"keys"`
	Projects int64 `json:"projects"`
	MAU      int64 `json:"mau"`
}

type RetrieveLanguageResponse

type RetrieveLanguageResponse struct {
	WithProjectID
	Language Language `json:"language"`
}

type Screenshot

type Screenshot struct {
	WithCreationTime

	ScreenshotID   int64    `json:"screenshot_id"`
	KeyIDs         []int64  `json:"key_ids"`
	URL            string   `json:"url"`
	Title          string   `json:"title"`
	Description    string   `json:"description"`
	ScreenshotTags []string `json:"tags"`
	Width          int64    `json:"width"`
	Height         int64    `json:"height"`
}

type ScreenshotListOptions

type ScreenshotListOptions struct {
	// page options
	Page  uint `url:"page,omitempty"`
	Limit uint `url:"limit,omitempty"`

	IncludeTags uint8 `json:"include_tags,omitempty"`
	ListOnly    uint8 `json:"list_only,omitempty"`
}

func (ScreenshotListOptions) Apply

func (options ScreenshotListOptions) Apply(req *resty.Request)

type ScreenshotResponse

type ScreenshotResponse struct {
	WithProjectID
	Screenshot Screenshot `json:"screenshot"`
}

type ScreenshotService

type ScreenshotService struct {
	BaseService
	// contains filtered or unexported fields
}

func (*ScreenshotService) Create

func (c *ScreenshotService) Create(projectID string, screenshots []NewScreenshot) (r ScreenshotsResponse, err error)

func (*ScreenshotService) Delete

func (c *ScreenshotService) Delete(projectID string, screenshotID int64) (r DeleteScreenshotResponse, err error)

func (*ScreenshotService) List

func (c *ScreenshotService) List(projectID string) (r ScreenshotsResponse, err error)

func (*ScreenshotService) ListOpts

func (*ScreenshotService) Retrieve

func (c *ScreenshotService) Retrieve(projectID string, screenshotID int64) (r ScreenshotResponse, err error)

func (*ScreenshotService) SetListOptions

func (c *ScreenshotService) SetListOptions(o ScreenshotListOptions)

func (*ScreenshotService) Update

func (c *ScreenshotService) Update(projectID string, screenshotID int64, opts UpdateScreenshot) (r ScreenshotResponse, err error)

func (*ScreenshotService) WithListOptions

type ScreenshotsResponse

type ScreenshotsResponse struct {
	Paged
	WithProjectID
	Screenshots []Screenshot `json:"screenshots"`
}

type Segment added in v3.4.0

type Segment struct {
	SegmentNumber             int64               `json:"segment_number"`
	LanguageIso               string              `json:"language_iso"`
	ModifiedAt                string              `json:"modified_at"`
	ModifiedAtTimestamp       int64               `json:"modified_at_timestamp"`
	ModifiedBy                int64               `json:"modified_by"`
	ModifiedByEmail           string              `json:"modified_by_email"`
	Value                     string              `json:"value"`
	IsFuzzy                   bool                `json:"is_fuzzy"`
	IsReviewed                bool                `json:"is_reviewed"`
	ReviewedBy                int64               `json:"reviewed_by"`
	Words                     int64               `json:"words"`
	CustomTranslationStatuses []TranslationStatus `json:"custom_translation_statuses"`
}

type SegmentResponse added in v3.4.0

type SegmentResponse struct {
	WithProjectID
	KeyID       int64   `json:"key_id"`
	LanguageISO string  `json:"language_iso"`
	Segment     Segment `json:"segment"`
}

type SegmentUpdateRequest added in v3.4.0

type SegmentUpdateRequest struct {
	Value                      string  `json:"value"` // could be string or json for plural keys.
	IsFuzzy                    *bool   `json:"is_fuzzy,omitempty"`
	IsReviewed                 *bool   `json:"is_reviewed,omitempty"`
	CustomTranslationStatusIds []int64 `json:"custom_translation_status_ids,omitempty"`
}

type SegmentationService added in v3.4.0

type SegmentationService struct {
	BaseService
	// contains filtered or unexported fields
}

SegmentationService supports List, Retrieve and Update commands

func (*SegmentationService) List added in v3.4.0

func (s *SegmentationService) List(projectID string, keyID int64, languageIso string) (r SegmentsResponse, err error)

func (*SegmentationService) ListOpts added in v3.4.0

func (*SegmentationService) Retrieve added in v3.4.0

func (s *SegmentationService) Retrieve(
	projectID string,
	keyID int64,
	languageIso string,
	segmentNumber int64,
) (r SegmentResponse, err error)

func (*SegmentationService) RetrieveOpts added in v3.4.0

func (s *SegmentationService) RetrieveOpts() SegmentsRetrieveOptions

func (*SegmentationService) SetListOptions added in v3.4.0

func (s *SegmentationService) SetListOptions(o SegmentsListOptions)

func (*SegmentationService) SetRetrieveOptions added in v3.4.0

func (s *SegmentationService) SetRetrieveOptions(o SegmentsRetrieveOptions)

func (*SegmentationService) Update added in v3.4.0

func (s *SegmentationService) Update(
	projectID string,
	keyID int64,
	languageIso string,
	segmentNumber int64,
	updateRequest SegmentUpdateRequest,
) (r SegmentResponse, err error)

func (*SegmentationService) WithListOptions added in v3.4.0

func (*SegmentationService) WithRetrieveOptions added in v3.4.0

type SegmentsListOptions added in v3.4.0

type SegmentsListOptions struct {
	// Possible values are 1 and 0.
	DisableReferences  uint8 `url:"disable_references,omitempty"`
	FilterIsReviewed   uint8 `url:"filter_is_reviewed,omitempty"`
	FilterUnverified   uint8 `url:"filter_unverified,omitempty"`
	FilterUntranslated uint8 `url:"filter_untranslated,omitempty"`

	FilterQAIssues string `url:"filter_qa_issues,omitempty"`
}

func (SegmentsListOptions) Apply added in v3.4.0

func (options SegmentsListOptions) Apply(req *resty.Request)

type SegmentsResponse added in v3.4.0

type SegmentsResponse struct {
	WithProjectID
	Segments []Segment   `json:"segments"`
	Errors   []ErrorKeys `json:"error,omitempty"`
}

type SegmentsRetrieveOptions added in v3.4.0

type SegmentsRetrieveOptions struct {
	DisableReferences uint8 `url:"disable_references,omitempty"`
}

func (SegmentsRetrieveOptions) Apply added in v3.4.0

func (options SegmentsRetrieveOptions) Apply(req *resty.Request)

type Snapshot

type Snapshot struct {
	WithCreationTime
	WithCreationUser

	SnapshotID int64  `json:"snapshot_id"`
	Title      string `json:"title"`
}

type SnapshotService

type SnapshotService struct {
	BaseService
}

func (*SnapshotService) Create

func (c *SnapshotService) Create(projectID string, title string) (r CreateSnapshotResponse, err error)

func (*SnapshotService) Delete

func (c *SnapshotService) Delete(projectID string, ID int64) (r DeleteSnapshotResponse, err error)

func (*SnapshotService) List

func (c *SnapshotService) List(projectID string) (r ListSnapshotsResponse, err error)

func (*SnapshotService) Restore

func (c *SnapshotService) Restore(projectID string, ID int64) (r Project, err error)

type Task

type Task struct {
	WithCreationTime
	WithCreationUser

	TaskID                     int64          `json:"task_id"`
	Title                      string         `json:"title"`
	Description                string         `json:"description"`
	Status                     TaskStatus     `json:"status"`
	Progress                   int            `json:"progress"`
	DueDate                    string         `json:"due_date"`
	KeysCount                  int64          `json:"keys_count"`
	WordsCount                 int64          `json:"words_count"`
	CanBeParent                bool           `json:"can_be_parent"`
	TaskType                   TaskType       `json:"task_type"`
	ParentTaskID               int64          `json:"parent_task_id"`
	ClosingTags                []string       `json:"closing_tags"`
	LockTranslations           bool           `json:"do_lock_translations"`
	Languages                  []TaskLanguage `json:"languages"`
	AutoCloseLanguages         bool           `json:"auto_close_languages"`
	AutoCloseTask              bool           `json:"auto_close_task"`
	AutoCloseItems             bool           `json:"auto_close_items"`
	CompletedAt                string         `json:"completed_at"`
	CompletedAtTs              int64          `json:"completed_at_timestamp"`
	CompletedBy                int64          `json:"completed_by"`
	CompletedByEmail           string         `json:"completed_by_email"`
	CustomTranslationStatusIDs []int64        `json:"custom_translation_status_ids,omitempty"`
}

type TaskGroup

type TaskGroup struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

type TaskLanguage

type TaskLanguage struct {
	LanguageISO       string           `json:"language_iso"`
	Users             []TaskUser       `json:"users"`
	Groups            []TaskGroup      `json:"groups"`
	Keys              []int64          `json:"keys"`
	Status            LanguageStatus   `json:"status"`
	Progress          int              `json:"progress"`
	InitialTMLeverage map[string]int64 `json:"initial_tm_leverage"`
	KeysCount         int64            `json:"keys_count"`
	WordsCount        int64            `json:"words_count"`
	CompletedAt       string           `json:"completed_at"`
	CompletedAtTs     int64            `json:"completed_at_timestamp"`
	CompletedBy       int64            `json:"completed_by"`
	CompletedByEmail  string           `json:"completed_by_email"`
}

type TaskListOptions

type TaskListOptions struct {
	Limit uint `url:"limit,omitempty"`
	Page  uint `url:"page,omitempty"`

	Title string `url:"filter_title,omitempty"`
}

func (TaskListOptions) Apply

func (options TaskListOptions) Apply(req *resty.Request)

type TaskResponse

type TaskResponse struct {
	WithProjectID
	Task Task `json:"task"`
}

type TaskService

type TaskService struct {
	BaseService
	// contains filtered or unexported fields
}

func (*TaskService) Create

func (c *TaskService) Create(projectID string, task CreateTask) (r TaskResponse, err error)

func (*TaskService) Delete

func (c *TaskService) Delete(projectID string, taskID int64) (r DeleteTaskResponse, err error)

func (*TaskService) List

func (c *TaskService) List(projectID string) (r TasksResponse, err error)

func (*TaskService) ListOpts

func (c *TaskService) ListOpts() TaskListOptions

func (*TaskService) Retrieve

func (c *TaskService) Retrieve(projectID string, taskID int64) (r TaskResponse, err error)

func (*TaskService) SetListOptions

func (c *TaskService) SetListOptions(o TaskListOptions)

func (*TaskService) Update

func (c *TaskService) Update(projectID string, taskID int64, task UpdateTask) (r TaskResponse, err error)

func (*TaskService) WithListOptions

func (c *TaskService) WithListOptions(o TaskListOptions) *TaskService

type TaskStatus

type TaskStatus string

type TaskType

type TaskType string

type TaskUser

type TaskUser struct {
	WithUserID
	Email    string `json:"email"`
	Fullname string `json:"fullname"`
}

type TasksResponse

type TasksResponse struct {
	Paged
	WithProjectID
	Tasks []Task `json:"tasks"`
}

type Team

type Team struct {
	WithCreationTime
	WithTeamID

	Name         string `json:"name"`
	Plan         string `json:"plan"` // e.g. "Essential", "Trial"
	QuotaUsage   Quota  `json:"quota_usage"`
	QuotaAllowed Quota  `json:"quota_allowed"`
}

type TeamService

type TeamService struct {
	BaseService
}

The Team service

func (*TeamService) List

func (c *TeamService) List() (r TeamsResponse, err error)

Lists all teams available to the user

type TeamUser

type TeamUser struct {
	WithCreationTime
	WithUserID

	Email    string       `json:"email"`
	Fullname string       `json:"fullname"`
	Role     TeamUserRole `json:"role"`
}

type TeamUserGroup

type TeamUserGroup struct {
	WithCreationTime
	WithTeamID

	GroupID     int64       `json:"group_id"`
	Name        string      `json:"name"`
	Permissions *Permission `json:"permissions"`
	Projects    []string    `json:"projects"`
	Members     []int64     `json:"members"`
}

type TeamUserGroupService

type TeamUserGroupService struct {
	BaseService
}

func (*TeamUserGroupService) AddMembers

func (c *TeamUserGroupService) AddMembers(teamID, groupID int64, users []int64) (r CreateGroupResponse, err error)

func (*TeamUserGroupService) AddProjects

func (c *TeamUserGroupService) AddProjects(teamID, groupID int64, projects []string) (r CreateGroupResponse, err error)

func (*TeamUserGroupService) Create

func (c *TeamUserGroupService) Create(teamID int64, group NewGroup) (r CreateGroupResponse, err error)

func (*TeamUserGroupService) Delete

func (c *TeamUserGroupService) Delete(teamID, groupID int64) (r DeleteGroupResponse, err error)

func (*TeamUserGroupService) List

func (c *TeamUserGroupService) List(teamID int64) (r TeamUserGroupsResponse, err error)

func (*TeamUserGroupService) RemoveMembers

func (c *TeamUserGroupService) RemoveMembers(teamID, groupID int64, users []int64) (r CreateGroupResponse, err error)

func (*TeamUserGroupService) RemoveProjects

func (c *TeamUserGroupService) RemoveProjects(teamID, groupID int64, projects []string) (r CreateGroupResponse, err error)

func (*TeamUserGroupService) Retrieve

func (c *TeamUserGroupService) Retrieve(teamID, groupID int64) (r TeamUserGroup, err error)

func (*TeamUserGroupService) Update

func (c *TeamUserGroupService) Update(teamID, groupID int64, group NewGroup) (r CreateGroupResponse, err error)

type TeamUserGroupsResponse

type TeamUserGroupsResponse struct {
	Paged
	WithTeamID
	UserGroups []TeamUserGroup `json:"user_groups"`
}

type TeamUserResponse

type TeamUserResponse struct {
	WithTeamID
	TeamUser TeamUser `json:"team_user"`
}

type TeamUserRole

type TeamUserRole string
const (
	TeamUserRoleOwner  TeamUserRole = "owner"
	TeamUserRoleAdmin  TeamUserRole = "admin"
	TeamUserRoleMember TeamUserRole = "member"
)

noinspection GoUnusedConst

type TeamUserService

type TeamUserService struct {
	BaseService
}

func (*TeamUserService) Delete

func (c *TeamUserService) Delete(teamID, userID int64) (r DeleteTeamUserResponse, err error)

func (*TeamUserService) List

func (c *TeamUserService) List(teamID int64) (r TeamUsersResponse, err error)

func (*TeamUserService) Retrieve

func (c *TeamUserService) Retrieve(teamID, userID int64) (res TeamUserResponse, err error)

func (*TeamUserService) UpdateRole

func (c *TeamUserService) UpdateRole(teamID, userID int64, role TeamUserRole) (r TeamUserResponse, err error)

type TeamUsersResponse

type TeamUsersResponse struct {
	Paged
	WithTeamID
	TeamUsers []TeamUser `json:"team_users"`
}

type TeamsResponse

type TeamsResponse struct {
	Paged
	Teams []Team `json:"teams"`
}

type Translation

type Translation struct {
	TranslationID   int64  `json:"translation_id"`
	Translation     string `json:"translation"` // could be string or json in case it includes plural forms and is_plural is true.
	KeyID           int64  `json:"key_id"`
	LanguageISO     string `json:"language_iso"`
	ModifiedAt      string `json:"modified_at"`
	ModifiedAtTs    int64  `json:"modified_at_timestamp"`
	ModifiedBy      int64  `json:"modified_by"`
	ModifiedByEmail string `json:"modified_by_email"`
	IsFuzzy         bool   `json:"is_fuzzy"`
	IsReviewed      bool   `json:"is_reviewed"`
	ReviewedBy      int64  `json:"reviewed_by"`
	Words           int64  `json:"words"`
	TaskID          int64  `json:"task_id"`

	CustomTranslationStatuses []TranslationStatus `json:"custom_translation_statuses"`
}

type TranslationListOptions

type TranslationListOptions struct {
	// page options
	Page  uint `url:"page,omitempty"`
	Limit uint `url:"limit,omitempty"`

	// Possible values are 1 and 0.
	DisableReferences uint8 `url:"disable_references,omitempty"`

	FilterLangID     string `url:"filter_lang_id,omitempty"`
	FilterIsReviewed uint8  `url:"filter_is_reviewed,omitempty"`
	FilterFuzzy      uint8  `url:"filter_fuzzy,omitempty"`
	FilterQAIssues   string `url:"filter_qa_issues,omitempty"`
}

func (TranslationListOptions) Apply

func (options TranslationListOptions) Apply(req *resty.Request)

type TranslationPair

type TranslationPair struct {
	TierID       int64  `json:"tier_id"`
	FromLangISO  string `json:"from_lang_iso"`
	FromLangName string `json:"from_lang_name"`
	ToLangISO    string `json:"to_lang_iso"`
	ToLangName   string `json:"to_lang_name"`
	PricePerWord string `json:"price_per_word"`
}

type TranslationProvider

type TranslationProvider struct {
	ProviderID   int64             `json:"provider_id"`
	Name         string            `json:"name"`
	Slug         string            `json:"slug"`
	PricePairMin string            `json:"price_pair_min"`
	WebsiteURL   string            `json:"website_url,omitempty"`
	Description  string            `json:"description,omitempty"`
	Tiers        []TranslationTier `json:"tiers,omitempty"`
	Pairs        []TranslationPair `json:"pairs"`
}

type TranslationProviderService

type TranslationProviderService struct {
	BaseService
}

func (*TranslationProviderService) List

func (*TranslationProviderService) Retrieve

func (c *TranslationProviderService) Retrieve(teamID, providerID int64) (r TranslationProvider, err error)

type TranslationProvidersResponse

type TranslationProvidersResponse struct {
	Paged
	TranslationProviders []TranslationProvider `json:"translation_providers"`
}

type TranslationResponse

type TranslationResponse struct {
	WithProjectID
	Translation Translation `json:"translation"`
}

type TranslationService

type TranslationService struct {
	BaseService
	// contains filtered or unexported fields
}

func (*TranslationService) List

func (c *TranslationService) List(projectID string) (r TranslationsResponse, err error)

func (*TranslationService) ListOpts

func (*TranslationService) Retrieve

func (c *TranslationService) Retrieve(projectID string, translationID int64) (r TranslationResponse, err error)

func (*TranslationService) SetListOptions

func (c *TranslationService) SetListOptions(o TranslationListOptions)

func (*TranslationService) Update

func (c *TranslationService) Update(projectID string, translationID int64, opts UpdateTranslation) (r TranslationResponse, err error)

func (*TranslationService) WithListOptions

type TranslationStatus

type TranslationStatus struct {
	StatusID int64  `json:"status_id"` // todo check with `json:"id"` for svc_translation
	Title    string `json:"title"`
	Color    string `json:"color"`
}

type TranslationStatusResponse

type TranslationStatusResponse struct {
	WithProjectID
	TranslationStatus TranslationStatus `json:"custom_translation_status"`
}

type TranslationStatusService

type TranslationStatusService struct {
	BaseService
}

func (*TranslationStatusService) Create

func (*TranslationStatusService) Delete

func (c *TranslationStatusService) Delete(projectID string, statusID int64) (r DeleteTranslationStatusResponse, err error)

func (*TranslationStatusService) List

func (*TranslationStatusService) ListColors

func (*TranslationStatusService) Retrieve

func (c *TranslationStatusService) Retrieve(projectID string, statusID int64) (r TranslationStatusResponse, err error)

func (*TranslationStatusService) Update

func (c *TranslationStatusService) Update(projectID string, statusID int64, opts UpdateTranslationStatus) (r TranslationStatusResponse, err error)

type TranslationStatusesResponse

type TranslationStatusesResponse struct {
	Paged
	WithProjectID
	TranslationStatuses []TranslationStatus `json:"custom_translation_statuses"`
}

type TranslationTier

type TranslationTier struct {
	TierID int64  `json:"tier_id"`
	Title  string `json:"title"`
}

type TranslationsResponse

type TranslationsResponse struct {
	Paged
	Translations []Translation `json:"translations"`
}

type TruncateProjectResponse

type TruncateProjectResponse struct {
	WithProjectID
	KeysDeleted bool `json:"keys_deleted"`
}

type UpdateLanguage

type UpdateLanguage struct {
	LangISO     string   `json:"lang_iso,omitempty"`
	LangName    string   `json:"lang_name,omitempty"`
	PluralForms []string `json:"plural_forms,omitempty"`
}

type UpdateLanguageResponse

type UpdateLanguageResponse struct {
	WithProjectID
	Language Language `json:"language"`
}

type UpdateProject

type UpdateProject struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

type UpdateScreenshot

type UpdateScreenshot struct {
	Title       string   `json:"title,omitempty"`
	Description string   `json:"description,omitempty"`
	KeyIDs      []int64  `json:"key_ids,omitempty"`
	Tags        []string `json:"tags,omitempty"`
}

type UpdateTask

type UpdateTask struct {
	Title              string           `json:"title,omitempty"`
	Description        string           `json:"description,omitempty"`
	DueDate            string           `json:"due_date,omitempty"`
	Languages          []CreateTaskLang `json:"languages,omitempty"`
	AutoCloseLanguages *bool            `json:"auto_close_languages,omitempty"`
	AutoCloseTask      *bool            `json:"auto_close_task,omitempty"`
	AutoCloseItems     *bool            `json:"auto_close_items,omitempty"`
	CloseTask          bool             `json:"close_task,omitempty"`
	ClosingTags        []string         `json:"closing_tags,omitempty"`
	LockTranslations   bool             `json:"do_lock_translations,omitempty"`
}

type UpdateTranslation

type UpdateTranslation struct {
	Translation                string   `json:"translation"`
	IsFuzzy                    *bool    `json:"is_fuzzy,omitempty"`
	IsReviewed                 bool     `json:"is_reviewed,omitempty"`
	CustomTranslationStatusIDs []string `json:"custom_translation_status_ids,omitempty"`
}

func (UpdateTranslation) MarshalJSON

func (t UpdateTranslation) MarshalJSON() ([]byte, error)

func (*UpdateTranslation) UnmarshalJSON

func (t *UpdateTranslation) UnmarshalJSON(data []byte) error

type UpdateTranslationStatus

type UpdateTranslationStatus struct {
	Title string `json:"title,omitempty"`
	Color string `json:"color,omitempty"`
}

type UpdateWebhook

type UpdateWebhook struct {
	URL          string      `json:"url,omitempty"`
	Events       []string    `json:"events,omitempty"`
	EventLangMap []EventLang `json:"event_lang_map,omitempty"`
	Branch       string      `json:"branch,omitempty"`
}

type Webhook

type Webhook struct {
	WebhookID    string      `json:"webhook_id"`
	URL          string      `json:"url"`
	Secret       string      `json:"secret"`
	Events       []string    `json:"events"`
	EventLangMap []EventLang `json:"event_lang_map,omitempty"`
}

type WebhookResponse

type WebhookResponse struct {
	WithProjectID
	Webhook Webhook `json:"webhook"`
}

type WebhookService

type WebhookService struct {
	BaseService
}

func (*WebhookService) Create

func (c *WebhookService) Create(projectID string, wh CreateWebhook) (r WebhookResponse, err error)

func (*WebhookService) Delete

func (c *WebhookService) Delete(projectID string, webhookID string) (r DeleteWebhookResponse, err error)

func (*WebhookService) List

func (c *WebhookService) List(projectID string) (r WebhooksResponse, err error)

func (*WebhookService) Retrieve

func (c *WebhookService) Retrieve(projectID string, webhookID string) (r WebhookResponse, err error)

func (*WebhookService) Update

func (c *WebhookService) Update(projectID string, webhookID string, opts UpdateWebhook) (r WebhookResponse, err error)

type WebhooksResponse

type WebhooksResponse struct {
	Paged
	WithProjectID
	Webhooks []Webhook `json:"webhooks"`
}

type WithCreationTime

type WithCreationTime struct {
	CreatedAt   string `json:"created_at"`
	CreatedAtTs int64  `json:"created_at_timestamp"`
}

type WithCreationUser

type WithCreationUser struct {
	CreatedBy      int64  `json:"created_by"`
	CreatedByEmail string `json:"created_by_email"`
}

type WithProjectID

type WithProjectID struct {
	ProjectID string `json:"project_id,omitempty"`
}

type WithTeamID

type WithTeamID struct {
	TeamID int64 `json:"team_id,omitempty"`
}

could be optional for some creation structs, i.e. NewProject

type WithUserID

type WithUserID struct {
	UserID int64 `json:"user_id,omitempty"`
}

Jump to

Keyboard shortcuts

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