sdk

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2025 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizationTag

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

func NewAuthorizationTag

func NewAuthorizationTag(httpClient *http.Client, parser *sdkgen.Parser) *AuthorizationTag

func (*AuthorizationTag) GetWhoami

func (client *AuthorizationTag) GetWhoami() (*BackendUser, error)

GetWhoami

func (*AuthorizationTag) Revoke

func (client *AuthorizationTag) Revoke() (*CommonMessage, error)

Revoke

type BackendApp

type BackendApp struct {
	Id         int             `json:"id"`
	UserId     int             `json:"userId"`
	Status     int             `json:"status"`
	Name       string          `json:"name"`
	Url        string          `json:"url"`
	Parameters string          `json:"parameters"`
	AppKey     string          `json:"appKey"`
	AppSecret  string          `json:"appSecret"`
	Metadata   *CommonMetadata `json:"metadata"`
	Date       string          `json:"date"`
	Scopes     []string        `json:"scopes"`
	Tokens     []BackendToken  `json:"tokens"`
}

type BackendToken added in v0.2.0

type BackendToken struct {
	Id     int      `json:"id"`
	Status int      `json:"status"`
	Name   string   `json:"name"`
	Scopes []string `json:"scopes"`
	Ip     string   `json:"ip"`
	Expire string   `json:"expire"`
	Date   string   `json:"date"`
}

type BackendUser

type BackendUser struct {
	Id       int             `json:"id"`
	RoleId   int             `json:"roleId"`
	PlanId   int             `json:"planId"`
	Status   int             `json:"status"`
	Name     string          `json:"name"`
	Email    string          `json:"email"`
	Points   int             `json:"points"`
	Scopes   []string        `json:"scopes"`
	Apps     []BackendApp    `json:"apps"`
	Metadata *CommonMetadata `json:"metadata"`
	Date     string          `json:"date"`
}

type Client

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

func Build

func Build(clientId string, clientSecret string, tokenStore sdkgen.TokenStoreInterface, scopes []string) (*Client, error)

func BuildAnonymous added in v0.2.0

func BuildAnonymous() (*Client, error)

func NewClient

func NewClient(baseUrl string, credentials sdkgen.CredentialsInterface) (*Client, error)

func (*Client) Authorization

func (client *Client) Authorization() *AuthorizationTag

func (*Client) Commit

func (client *Client) Commit() *CommitTag

func (*Client) Document

func (client *Client) Document() *DocumentTag

func (*Client) Explore

func (client *Client) Explore() *ExploreTag

func (*Client) Issue

func (client *Client) Issue() *IssueTag

func (*Client) Meta

func (client *Client) Meta() *MetaTag

func (*Client) PullRequest

func (client *Client) PullRequest() *PullRequestTag

func (*Client) Star

func (client *Client) Star() *StarTag

func (*Client) Tag

func (client *Client) Tag() *TagTag

func (*Client) Trigger

func (client *Client) Trigger() *TriggerTag

type Collection

type Collection[T any] struct {
	TotalResults int `json:"totalResults"`
	StartIndex   int `json:"startIndex"`
	ItemsPerPage int `json:"itemsPerPage"`
	Entry        []T `json:"entry"`
}

type Comment

type Comment struct {
	Id         int               `json:"id"`
	User       *User             `json:"user"`
	Status     int               `json:"status"`
	Reaction   *CommentReactions `json:"reaction"`
	Comment    string            `json:"comment"`
	UpdateDate string            `json:"updateDate"`
	InsertDate string            `json:"insertDate"`
}

type CommentCollection

type CommentCollection struct {
	TotalResults int       `json:"totalResults"`
	StartIndex   int       `json:"startIndex"`
	ItemsPerPage int       `json:"itemsPerPage"`
	Entry        []Comment `json:"entry"`
}

type CommentCreate

type CommentCreate struct {
	Id         int               `json:"id"`
	User       *User             `json:"user"`
	Status     int               `json:"status"`
	Reaction   *CommentReactions `json:"reaction"`
	Comment    string            `json:"comment"`
	UpdateDate string            `json:"updateDate"`
	InsertDate string            `json:"insertDate"`
}

type CommentReactions

type CommentReactions struct {
	Like     int `json:"like"`
	Dislike  int `json:"dislike"`
	Laugh    int `json:"laugh"`
	Hooray   int `json:"hooray"`
	Confused int `json:"confused"`
	Heart    int `json:"heart"`
	Rocket   int `json:"rocket"`
	Eyes     int `json:"eyes"`
}

type Commit

type Commit struct {
	Id         int             `json:"id"`
	Document   *Document       `json:"document"`
	User       *User           `json:"user"`
	Previous   *CommitPrevious `json:"previous"`
	Message    string          `json:"message"`
	CommitHash string          `json:"commitHash"`
	Spec       any             `json:"spec"`
	InsertDate string          `json:"insertDate"`
}

type CommitCollection

type CommitCollection struct {
	TotalResults int      `json:"totalResults"`
	StartIndex   int      `json:"startIndex"`
	ItemsPerPage int      `json:"itemsPerPage"`
	Entry        []Commit `json:"entry"`
}

type CommitPrevious

type CommitPrevious struct {
	Id         int    `json:"id"`
	Message    string `json:"message"`
	CommitHash string `json:"commitHash"`
	Spec       any    `json:"spec"`
	InsertDate string `json:"insertDate"`
}

type CommitTag

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

func NewCommitTag

func NewCommitTag(httpClient *http.Client, parser *sdkgen.Parser) *CommitTag

func (*CommitTag) Get

func (client *CommitTag) Get(user string, document string, id string) (*Commit, error)

Get Returns a commit

func (*CommitTag) GetAll

func (client *CommitTag) GetAll(user string, document string, startIndex int, count int, search string) (*CommitCollection, error)

GetAll Returns all commits for a document

type CommonMessage

type CommonMessage struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
	Id      string `json:"id"`
}

Common error message

type CommonMessageException

type CommonMessageException struct {
	Payload  CommonMessage
	Previous error
}

func (*CommonMessageException) Error

func (e *CommonMessageException) Error() string

type CommonMetadata

type CommonMetadata = map[string]string

type Document

type Document struct {
	Id              int       `json:"id"`
	User            *User     `json:"user"`
	Source          *Document `json:"source"`
	Status          int       `json:"status"`
	Stars           int       `json:"stars"`
	Name            string    `json:"name"`
	Description     string    `json:"description"`
	Private         bool      `json:"private"`
	BaseVersion     string    `json:"baseVersion"`
	DevelopmentMode bool      `json:"developmentMode"`
	Homepage        string    `json:"homepage"`
	Spec            any       `json:"spec"`
	UpdateDate      string    `json:"updateDate"`
	InsertDate      string    `json:"insertDate"`
}

type DocumentCollection

type DocumentCollection struct {
	TotalResults int        `json:"totalResults"`
	StartIndex   int        `json:"startIndex"`
	ItemsPerPage int        `json:"itemsPerPage"`
	Entry        []Document `json:"entry"`
}

type DocumentCreate

type DocumentCreate struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Private     bool   `json:"private"`
	BaseVersion string `json:"baseVersion"`
	Homepage    string `json:"homepage"`
}

type DocumentExportRequest

type DocumentExportRequest struct {
	Version   string `json:"version"`
	Format    string `json:"format"`
	Namespace string `json:"namespace"`
}

type DocumentExportResponse

type DocumentExportResponse struct {
	Href string `json:"href"`
}

type DocumentMeta

type DocumentMeta struct {
	Description     string `json:"description"`
	Private         bool   `json:"private"`
	BaseVersion     string `json:"baseVersion"`
	DevelopmentMode bool   `json:"developmentMode"`
	Homepage        string `json:"homepage"`
}

type DocumentPreview

type DocumentPreview struct {
	Tags         []Tag                `json:"tags"`
	Repositories []DocumentRepository `json:"repositories"`
	Types        []string             `json:"types"`
}

type DocumentRepository added in v0.2.0

type DocumentRepository struct {
	Name string `json:"name"`
	Href string `json:"href"`
}

type DocumentTag

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

func NewDocumentTag

func NewDocumentTag(httpClient *http.Client, parser *sdkgen.Parser) *DocumentTag

func (*DocumentTag) Create

func (client *DocumentTag) Create(user string, payload DocumentCreate) (*Message, error)

Create Creates a new document

func (*DocumentTag) Delete

func (client *DocumentTag) Delete(user string, document string) (*Message, error)

Delete Removes a document

func (*DocumentTag) Export

func (client *DocumentTag) Export(user string, document string, payload DocumentExportRequest) (*DocumentExportResponse, error)

Export Export this document

func (*DocumentTag) Fork

func (client *DocumentTag) Fork(user string, document string) (*Message, error)

Fork Fork this document

func (*DocumentTag) Get

func (client *DocumentTag) Get(user string, document string, version string) (*Document, error)

Get Returns a document

func (*DocumentTag) GetAll

func (client *DocumentTag) GetAll(user string, startIndex int, count int, search string) (*DocumentCollection, error)

GetAll Returns all documents

func (*DocumentTag) Import

func (client *DocumentTag) Import(user string, document string, payload Passthru) (*Message, error)

Import Import a TypeAPI specification to this document

func (*DocumentTag) Meta

func (client *DocumentTag) Meta(user string, document string, payload DocumentMeta) (*Message, error)

Meta Updates the meta data of an document

func (*DocumentTag) Reset

func (client *DocumentTag) Reset(user string, document string, payload Passthru) (*Message, error)

Reset Resets your document to the latest source

func (*DocumentTag) Revert

func (client *DocumentTag) Revert(user string, document string, id string, payload Passthru) (*Message, error)

Revert Reverts your document to this commit

func (*DocumentTag) ShowPreview

func (client *DocumentTag) ShowPreview(user string, document string, version string) (*DocumentPreview, error)

ShowPreview Returns a document preview

func (*DocumentTag) Star

func (client *DocumentTag) Star(user string, document string, payload Passthru) (*Message, error)

Star Stars this document

func (*DocumentTag) Update

func (client *DocumentTag) Update(user string, document string, payload DocumentUpdate) (*Message, error)

Update Updates a document

type DocumentUpdate

type DocumentUpdate struct {
	Spec any `json:"spec"`
}

type ExploreTag

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

func NewExploreTag

func NewExploreTag(httpClient *http.Client, parser *sdkgen.Parser) *ExploreTag

func (*ExploreTag) GetAll

func (client *ExploreTag) GetAll(startIndex int, count int, search string) (*DocumentCollection, error)

GetAll Returns trending documents

type Issue

type Issue struct {
	Id         int       `json:"id"`
	User       *User     `json:"user"`
	Document   *Document `json:"document"`
	Status     int       `json:"status"`
	Title      string    `json:"title"`
	UpdateDate string    `json:"updateDate"`
	InsertDate string    `json:"insertDate"`
}

type IssueCollection

type IssueCollection struct {
	TotalResults int     `json:"totalResults"`
	StartIndex   int     `json:"startIndex"`
	ItemsPerPage int     `json:"itemsPerPage"`
	Entry        []Issue `json:"entry"`
}

type IssueCreate

type IssueCreate struct {
	Title       string `json:"title"`
	Description string `json:"description"`
}

type IssueTag

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

func NewIssueTag

func NewIssueTag(httpClient *http.Client, parser *sdkgen.Parser) *IssueTag

func (*IssueTag) Create

func (client *IssueTag) Create(user string, document string, payload IssueCreate) (*Message, error)

Create Creates a new issue

func (*IssueTag) CreateComment

func (client *IssueTag) CreateComment(user string, document string, id string, payload CommentCreate) (*Message, error)

CreateComment Creates a new issue comment

func (*IssueTag) Delete

func (client *IssueTag) Delete(user string, document string, id string) (*Message, error)

Delete Removes an issue

func (*IssueTag) Get

func (client *IssueTag) Get(user string, document string, id string) (*Issue, error)

Get Returns an issue

func (*IssueTag) GetAll

func (client *IssueTag) GetAll(user string, document string, status int, startIndex int, count int, search string) (*IssueCollection, error)

GetAll Returns all issues

func (*IssueTag) GetAllComments

func (client *IssueTag) GetAllComments(user string, document string, id string, startIndex int, count int, search string) (*CommentCollection, error)

GetAllComments Shows all issue comments

func (*IssueTag) ReactComment

func (client *IssueTag) ReactComment(user string, document string, id string, comment string, reaction string, payload Passthru) (*Message, error)

ReactComment Reacts to a comment

type Message

type Message struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
}

type MessageException

type MessageException struct {
	Payload  Message
	Previous error
}

func (*MessageException) Error

func (e *MessageException) Error() string

type MetaTag

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

func NewMetaTag

func NewMetaTag(httpClient *http.Client, parser *sdkgen.Parser) *MetaTag

func (*MetaTag) GetAbout

func (client *MetaTag) GetAbout() (*SystemAbout, error)

GetAbout

type Passthru

type Passthru = map[string]any

No schema information available

type PullRequest

type PullRequest struct {
	Id         int       `json:"id"`
	Status     int       `json:"status"`
	Source     *Document `json:"source"`
	Target     *Document `json:"target"`
	User       *User     `json:"user"`
	Title      string    `json:"title"`
	UpdateDate string    `json:"updateDate"`
	InsertDate string    `json:"insertDate"`
}

type PullRequestCollection

type PullRequestCollection struct {
	TotalResults int           `json:"totalResults"`
	StartIndex   int           `json:"startIndex"`
	ItemsPerPage int           `json:"itemsPerPage"`
	Entry        []PullRequest `json:"entry"`
}

type PullRequestCreate

type PullRequestCreate struct {
	Title       string `json:"title"`
	Description string `json:"description"`
}

type PullRequestTag

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

func NewPullRequestTag

func NewPullRequestTag(httpClient *http.Client, parser *sdkgen.Parser) *PullRequestTag

func (*PullRequestTag) Create

func (client *PullRequestTag) Create(user string, document string, payload PullRequestCreate) (*Message, error)

Create Creates a new pull request

func (*PullRequestTag) CreateComment

func (client *PullRequestTag) CreateComment(user string, document string, id string, payload CommentCreate) (*Message, error)

CreateComment Creates a new pull request comment

func (*PullRequestTag) Delete

func (client *PullRequestTag) Delete(user string, document string, id string) (*Message, error)

Delete Removes a pull request

func (*PullRequestTag) Get

func (client *PullRequestTag) Get(user string, document string, id string) (*PullRequest, error)

Get Returns a pull request

func (*PullRequestTag) GetAll

func (client *PullRequestTag) GetAll(user string, document string, status int, startIndex int, count int, search string) (*PullRequestCollection, error)

GetAll Returns all pull requests

func (*PullRequestTag) GetAllComments

func (client *PullRequestTag) GetAllComments(user string, document string, id string, startIndex int, count int, search string) (*CommentCollection, error)

GetAllComments Shows all pull request comments

func (*PullRequestTag) ReactComment

func (client *PullRequestTag) ReactComment(user string, document string, id string, comment string, reaction string, payload Passthru) (*Message, error)

ReactComment Reacts to a comment

func (*PullRequestTag) Update

func (client *PullRequestTag) Update(user string, document string, id string, payload Passthru) (*Message, error)

Update Merges a pull request

type StarTag

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

func NewStarTag

func NewStarTag(httpClient *http.Client, parser *sdkgen.Parser) *StarTag

func (*StarTag) GetAll

func (client *StarTag) GetAll(startIndex int, count int, search string) (*DocumentCollection, error)

GetAll Returns all stared documents for the current user

type SystemAbout

type SystemAbout struct {
	ApiVersion      string            `json:"apiVersion"`
	Title           string            `json:"title"`
	Description     string            `json:"description"`
	TermsOfService  string            `json:"termsOfService"`
	ContactName     string            `json:"contactName"`
	ContactUrl      string            `json:"contactUrl"`
	ContactEmail    string            `json:"contactEmail"`
	LicenseName     string            `json:"licenseName"`
	LicenseUrl      string            `json:"licenseUrl"`
	PaymentCurrency string            `json:"paymentCurrency"`
	Categories      []string          `json:"categories"`
	Scopes          []string          `json:"scopes"`
	Apps            *SystemAboutApps  `json:"apps"`
	Links           []SystemAboutLink `json:"links"`
}

type SystemAboutApps

type SystemAboutApps = map[string]string
type SystemAboutLink struct {
	Rel  string `json:"rel"`
	Href string `json:"href"`
}

type Tag

type Tag struct {
	Id         string    `json:"id"`
	Document   *Document `json:"document"`
	User       *User     `json:"user"`
	Version    string    `json:"version"`
	Changelog  string    `json:"changelog"`
	Spec       any       `json:"spec"`
	InsertDate string    `json:"insertDate"`
}

type TagChangelog

type TagChangelog struct {
	Master    any      `json:"master"`
	Tag       any      `json:"tag"`
	Version   string   `json:"version"`
	Changelog []string `json:"changelog"`
}

type TagCollection

type TagCollection struct {
	TotalResults int   `json:"totalResults"`
	StartIndex   int   `json:"startIndex"`
	ItemsPerPage int   `json:"itemsPerPage"`
	Entry        []Tag `json:"entry"`
}

type TagTag

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

func NewTagTag

func NewTagTag(httpClient *http.Client, parser *sdkgen.Parser) *TagTag

func (*TagTag) Changelog

func (client *TagTag) Changelog(user string, document string, payload Passthru) (*TagChangelog, error)

Changelog Generates the changelog for the current release

func (*TagTag) Create

func (client *TagTag) Create(user string, document string, payload Passthru) (*Message, error)

Create Creates a new tag

func (*TagTag) Delete added in v0.2.0

func (client *TagTag) Delete(user string, document string, id string) (*Message, error)

Delete Removes a tag

func (*TagTag) Get

func (client *TagTag) Get(user string, document string, id string) (*Tag, error)

Get Returns a tag

func (*TagTag) GetAll

func (client *TagTag) GetAll(user string, document string, startIndex int, count int, search string) (*TagCollection, error)

GetAll Returns all tags for a document

func (*TagTag) Trigger added in v0.2.0

func (client *TagTag) Trigger(user string, document string, id string, payload Passthru) (*Message, error)

Trigger Triggers a tag

type Trigger

type Trigger struct {
	Id         int            `json:"id"`
	User       *User          `json:"user"`
	Document   *Document      `json:"document"`
	Type       string         `json:"type"`
	Config     *TriggerConfig `json:"config"`
	UpdateDate string         `json:"updateDate"`
	InsertDate string         `json:"insertDate"`
}

type TriggerCollection

type TriggerCollection struct {
	TotalResults int       `json:"totalResults"`
	StartIndex   int       `json:"startIndex"`
	ItemsPerPage int       `json:"itemsPerPage"`
	Entry        []Trigger `json:"entry"`
}

type TriggerConfig

type TriggerConfig = map[string]string

type TriggerCreate

type TriggerCreate struct {
	Id         int            `json:"id"`
	User       *User          `json:"user"`
	Document   *Document      `json:"document"`
	Type       string         `json:"type"`
	Config     *TriggerConfig `json:"config"`
	UpdateDate string         `json:"updateDate"`
	InsertDate string         `json:"insertDate"`
}

type TriggerTag

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

func NewTriggerTag

func NewTriggerTag(httpClient *http.Client, parser *sdkgen.Parser) *TriggerTag

func (*TriggerTag) Create

func (client *TriggerTag) Create(user string, document string, payload TriggerCreate) (*Message, error)

Create Creates a new trigger

func (*TriggerTag) Delete

func (client *TriggerTag) Delete(user string, document string, id string) (*Message, error)

Delete Removes a trigger

func (*TriggerTag) Execute

func (client *TriggerTag) Execute(user string, document string, id string, payload Passthru) (*Message, error)

Execute Executes a trigger

func (*TriggerTag) Get

func (client *TriggerTag) Get(user string, document string, id string) (*Trigger, error)

Get Returns a trigger

func (*TriggerTag) GetAll

func (client *TriggerTag) GetAll(user string, document string, startIndex int, count int, search string) (*TriggerCollection, error)

GetAll Returns all configured triggers

func (*TriggerTag) Update added in v0.2.0

func (client *TriggerTag) Update(user string, document string, id string, payload TriggerUpdate) (*Message, error)

Update Updates a trigger

type TriggerUpdate added in v0.2.0

type TriggerUpdate struct {
	Id         int            `json:"id"`
	User       *User          `json:"user"`
	Document   *Document      `json:"document"`
	Type       string         `json:"type"`
	Config     *TriggerConfig `json:"config"`
	UpdateDate string         `json:"updateDate"`
	InsertDate string         `json:"insertDate"`
}

type User

type User struct {
	Id   int    `json:"id"`
	Name string `json:"name"`
}

Jump to

Keyboard shortcuts

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