deviantart

package module
v0.0.0-...-e0117ab Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: MIT Imports: 17 Imported by: 0

README

go-deviantart

Go Reference

[!WARNING] 🚧 The project is currently in WIP status. Not all endpoints are tests, unit-tests are missing, many TODOs, etc. Please, consider waiting for release version

DeviantArt API for Go.

Most features are implemented, and only deprecated and pointless endpoints are omitted.

Documentation

Overview

Package deviantart implements all non-deprecated API calls for DeviantArt endpoints.

Index

Constants

View Source
const (
	BasicScope       = "basic"
	BrowseMLTScope   = "browse.mlt"
	BrowseScope      = "browse"
	CollectionScope  = "collection"
	CommentPostScope = "comment.post"
	GalleryScope     = "gallery"
	MessageScope     = "message"
	PublishScope     = "publish"
	StashScope       = "stash"
	UserManageScope  = "user.manage"
	UserScope        = "user"
)
View Source
const (
	TimeRangeNow   = "now"
	TimeRangeWeek  = "1week"
	TimeRangeMonth = "1month"
	TimeRangeAll   = "alltime"
)
View Source
const (
	HiddenByOwner     = "hidden_by_owner"
	HiddenByAdmin     = "hidden_by_admin"
	HiddenByCommenter = "hidden_by_commenter"
	HiddenAsSpam      = "hidden_as_spam"
)
View Source
const (
	MatureLevelStrict   = "strict"
	MatureLevelModerate = "moderate"
)

The mature level of the submission.

View Source
const (
	MatureClassificationNudity   = "nudity"
	MatureClassificationSexual   = "sexual"
	MatureClassificationGore     = "gore"
	MatureClassificationLanguage = "language"
	MatureClassificationIdeology = "ideology"
)

The mature classification of the submission.

View Source
const (
	SharingOptionsAllow              = "allow"
	SharingOptionsHideShareButtons   = "hide_share_buttons"
	SharingOptionsHideAndMembersOnly = "hide_and_members_only"
)
View Source
const (
	ArtistLevelNone         = "None"
	ArtistLevelStudent      = "Student"
	ArtistLevelHobbyist     = "Hobbyist"
	ArtistLevelProfessional = "Professional"
)
View Source
const (
	ArtistSpecialityNone          = "None"
	ArtistSpecialityArtisanCrafts = "Artisan Crafts"
	ArtistLevelDesignInterfaces   = "Design & Interfaces"
	ArtistLevelDigitalArt         = "Digital Art"
	ArtistLevelFilmAnimation      = "Film & Animation"
	ArtistLevelLiterature         = "Literature"
	ArtistLevelPhotography        = "Photography"
	ArtistLevelTraditionalArt     = "Traditional Art"
	ArtistLevelOther              = "Other"
	ArtistLevelVaried             = "Varied"
)
View Source
const RootStackID = 0

RootStackID is an ID to list contents of a root stack.

Variables

View Source
var Countries = []Country{}/* 243 elements not displayed */

Countries is a saved list of countries.

Feel free to report the issue if country list has been changed.

Functions

This section is empty.

Types

type Authenticator

type Authenticator func(s *sling.Sling) error

Authenticator describes authentication pipeline.

func AuthorizationCode

func AuthorizationCode(clientID, clientSecret string, scopes []string, callbackURL string) Authenticator

AuthorizationCode grant is the most common OAuth2 grant type and gives access to aspects of a users account. Use this method if you need to upload images.

func ClientCredentials

func ClientCredentials(clientID, clientSecret string) Authenticator

ClientCredentials allows gives access to "public" endpoints and do not require user authorization. Use this method to access read-only endpoints.

type BrowseService

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

func (*BrowseService) DailyDeviations

func (s *BrowseService) DailyDeviations(date time.Time) (OffsetResponse[Deviation], error)

DailyDeviations fetches daily deviations.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

TODO: The endpoint returns the `has_more` field, but there is no offset or cursor pagination information. This case requires further investigation.

func (*BrowseService) DeviantsYouWatch

func (s *BrowseService) DeviantsYouWatch(page *OffsetParams) (OffsetResponse[Deviation], error)

DeviantsYouWatch fetches deviations of deviants you watch.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

func (*BrowseService) MoreLikeThisPreview

func (s *BrowseService) MoreLikeThisPreview(seed uuid.UUID) (MoreLikeThisPreviewResponse, error)

MoreLikeThisPreview fetches More Like This preview result for a seed deviation.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse
  • browse.mlt

func (*BrowseService) Newest

func (s *BrowseService) Newest(query string, page *OffsetParams) (OffsetResponse[Deviation], error)

Newest fetches newest deviations.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

func (*BrowseService) Popular

func (s *BrowseService) Popular(params *PopularParams, page *OffsetParams) (OffsetResponse[Deviation], error)

Popular fetches popular deviations.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

BUG: Query does not work properly. See: https://github.com/wix-incubator/DeviantArt-API/issues/206.

func (*BrowseService) PostsDeviantsYouWatch

func (s *BrowseService) PostsDeviantsYouWatch(page *OffsetParams) (OffsetResponse[JournalStatus], error)

PostsDeviantsYouWatch returns deviants you watch.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

func (*BrowseService) Recommended

func (s *BrowseService) Recommended(query string) (OffsetResponse[Deviation], error)

Recommended fetches recommended deviations.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

TODO: Documentation specifies the `suggested_reasons` field but is absend in all responses. This case requires further investigation.

func (*BrowseService) Tags

Tags fetches a tag.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

NOTE: This endpoint supports cursor- and offset-base pagination. But for simplicity, I'll stick to cursor params for now.

func (*BrowseService) TagsSearch

func (s *BrowseService) TagsSearch(tag string) ([]string, error)

TagsSearch autocompletes tags.

The `tag_name“ parameter should not contain spaces. If it does, spaces will be stripped and remainder will be treated as a single tag.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

func (*BrowseService) TopTopics

func (s *BrowseService) TopTopics(page *CursorParams) (CursorResponse[Topic], error)

Topics fetches top topics with example deviation for each one.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

func (*BrowseService) Topic

func (s *BrowseService) Topic(topic string, page *CursorParams) (CursorResponse[Deviation], error)

Topic fetches topic deviations.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

func (*BrowseService) Topics

func (s *BrowseService) Topics(page *CursorParams) (CursorResponse[Topic], error)

Topics fetches topics and deviations from each topic.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

func (*BrowseService) UserJournals

func (s *BrowseService) UserJournals(params *UserJournalsParams, page *OffsetParams) (OffsetResponse[Deviation], error)

UserJournals browses journals of a user.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

type Client

type Client struct {
	Browse      *BrowseService
	Collections *CollectionsService
	Comments    *CommentsService
	Deviation   *DeviationService
	Gallery     *GalleryService
	Messages    *MessagesService
	Stash       *StashService
	User        *UserService
	// contains filtered or unexported fields
}

Client provices access to DeviantArt API endpoint.

func NewClient

func NewClient(auth Authenticator) (*Client, error)

TODO: Add http.Client to args.

func (*Client) Placebo

func (c *Client) Placebo() error

Placebo call confirms access_token is valid.

type Collection

type Collection struct {
	FolderID    uuid.UUID   `json:"folderid"`
	Name        string      `json:"name"`
	Description string      `json:"folder"`
	Size        uint32      `json:"size,omitempty"`
	Thumb       *Deviation  `json:"thumb"`
	Deviations  []Deviation `json:"deviations,omitempty"`
}

type CollectionsService

type CollectionsService struct {
	*FoldersService[Collection]
	// contains filtered or unexported fields
}

func (*CollectionsService) Fave

func (s *CollectionsService) Fave(deviationID uuid.UUID, folderIDs ...uuid.UUID) (int, error)

Fave adds deviation to favourites.

You can add deviation to multiple collections at once. If you omit `folderID` parameter, it will be added to Featured collection.

Returns the total number of times this deviation was favourited after the fave event.

Users can fave their own deviations, when this happens the fave is not counted but the item is added to the requested folder.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse
  • collection

func (*CollectionsService) Unfave

func (s *CollectionsService) Unfave(deviationID uuid.UUID, folderIDs ...uuid.UUID) (int, error)

Unfave removes deviation from favourites.

You can remove deviation from multiple collections at once. If you omit `folderID` parameter, it will be removed from Featured collection.

Returns the total number of times this deviation was favourited after the unfave event.

If a user has faved their own deviation, unfave can be used to remove the deviation from a given folder. Favorite counts are not affected if the deviation is owned by the user.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse
  • collection

type Comment

type Comment struct {
	CommentID   uuid.UUID   `json:"commentid"`
	ParentID    uuid.UUID   `json:"parentid"`
	Posted      string      `json:"posted"`
	Replies     int         `json:"replies"`
	Body        string      `json:"body"`
	IsLiked     bool        `json:"is_liked"`
	IsFeatured  bool        `json:"is_featured"`
	Likes       int         `json:"likes"`
	User        User        `json:"user,omitempty"`
	TextContent *EditorText `json:"text_content,omitempty"`

	// The hidden field will be null when the comment is not hidden and one of
	// the following values when it is:
	//   - `hidden_by_owner` - The comment was hidden by the owner of the item
	//   - `hidden_by_admin` - The comment was hidden by an administrator
	//   - `hidden_by_commenter` - The comment was by the comment owner
	//   - `hidden_as_spam` - The comment was hidden because it was marked spam
	Hidden string `json:"hidden"`
}

type CommentParams

type CommentParams struct {
	// The Comment ID you are replying to.
	CommentID uuid.UUID `url:"commentid,omitempty"`

	// The comment text.
	Text string `url:"body"`
}

type CommentSiblings

type CommentSiblings struct {
	HasMore    bool      `json:"has_more"`
	NextOffset int       `json:"next_offset,omitempty"`
	HasLess    bool      `json:"has_less"`
	PrevOffset int       `json:"prev_offset,omitempty"`
	Thread     []Comment `json:"thread"`
	Context    struct {
		Parent        *Comment   `json:"parent,omitempty"`
		ItemProfile   *User      `json:"item_profile,omitempty"`
		ItemDeviation *Deviation `json:"item_deviation,omitempty"`
		ItemStatus    *Status    `json:"item_status,omitempty"`
	} `json:"context,omitempty"`
}

type CommentSiblingsParams

type CommentSiblingsParams struct {
	// Fetch the related containing item (deviation, profile user, or status).
	IncludeItem bool `url:"ext_item,omitempty"`

	// The pagination offset.
	Offset int `url:"offset,omitempty"`

	// The pagination limit.
	Limit int `url:"limit,omitempty"`
}

type CommentsResponse

type CommentsResponse struct {
	HasMore    bool      `json:"has_more,omitempty"`
	NextOffset int       `json:"next_offset,omitempty"`
	HasLess    bool      `json:"has_less,omitempty"`
	PrevOffset bool      `json:"prev_offset,omitempty"`
	Total      int       `json:"total,omitempty"`
	Thread     []Comment `json:"thread,omitempty"`
}

type CommentsService

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

func (*CommentsService) CommentDeviation

func (s *CommentsService) CommentDeviation(deviationID uuid.UUID, params *CommentParams) (Comment, error)

CommentDeviation posts a comment on a deviation.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse
  • comment.post

func (*CommentsService) CommentProfile

func (s *CommentsService) CommentProfile(username string, params *CommentParams) (Comment, error)

CommentProfile posts a comment on a users profile.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse
  • comment.post

func (*CommentsService) CommentSiblings

func (s *CommentsService) CommentSiblings(commentID uuid.UUID, params *CommentSiblingsParams) (CommentSiblings, error)

CommentSiblings fetches siblings of a comment.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

func (*CommentsService) CommentStatus

func (s *CommentsService) CommentStatus(statusID uuid.UUID, params *CommentParams) (Comment, error)

CommentStatus posts a comment on a status.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse
  • comment.post

func (*CommentsService) DeviationComments

func (s *CommentsService) DeviationComments(deviationID uuid.UUID, params *FetchCommentsParams) (CommentsResponse, error)

DeviationComments fetch comments posted on deviation.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

func (*CommentsService) ProfileComments

func (s *CommentsService) ProfileComments(username string, params *FetchCommentsParams) (CommentsResponse, error)

ProfileComments fetch comments posted on user profile.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

func (*CommentsService) StatusComments

func (s *CommentsService) StatusComments(statusID uuid.UUID, params *FetchCommentsParams) (CommentsResponse, error)

StatusComments fetch comments posted on status.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

type Content

type Content struct {
	HTML     string   `json:"html,omitempty"`
	CSS      string   `json:"css,omitempty"`
	CSSFonts []string `json:"css_fonts,omitempty"`
}

type CopyDeviationsParams

type CopyDeviationsParams struct {
	TargetFolderID uuid.UUID   `url:"target_folderid,omitempty"`
	DeviationIDs   []uuid.UUID `url:"deviationids,omitempty"`
}

type Country

type Country struct {
	CountryID uint8  `json:"countryid"`
	Name      string `json:"name"`
}

type CreateFolderParams

type CreateFolderParams struct {
	// The name of the folder to create.
	Folder string `url:"folder"`

	// Folder description.
	// This field is supported only by galleries.
	Description string `url:"description,omitempty"`

	// The UUID of the parent gallery if this is a subgallery.
	// This field is supported only by galleries.
	ParentFolderID uuid.UUID `url:"parent_folderid,omitempty"`
}

type CreateJournalParams

type CreateJournalParams struct {
	// Journal title.
	Title string `url:"title"`

	// The `body` of the journal.
	Body string `url:"body,omitempty"`

	// Journal tags.
	Tags []string `url:"tags,brackets,omitempty"`

	// Cover deviation ID.
	CoverImageDeviationID uuid.UUID `url:"cover_image_deviation_id,omitempty"`

	// ID of the embeded deviation.
	EmbeddedImageDeviationID uuid.UUID `url:"embedded_image_deviation_id,omitempty"`

	// Submission is mature or not.
	IsMature bool `url:"is_mature,omitempty"`

	// Allow comments on the submission.
	AllowComments bool `url:"allow_comments,omitempty"`

	// License options.
	LicenseOptions LicenseOptions `url:"license_options,omitempty"`
}

type CreateLiteratureParams

type CreateLiteratureParams struct {
	// Literature title.
	Title string `url:"title"`

	// The `body` of the literature.
	Body string `url:"body,omitempty"`

	// Literature description.
	Description string `url:"description,omitempty"`

	// Literature tags.
	Tags []string `url:"tags,brackets,omitempty"`

	// UUIDs of gallery folders to publish this submission to.
	GalleryIDs []uuid.UUID `url:"galleryids,omitempty"`

	// Submission is mature or not.
	IsMature bool `url:"is_mature"`

	// The mature level of the submission, required for mature submissions.
	MatureLevel string `url:"mature_level,omitempty"`

	// The mature classification of the submission.
	MatureClassification []string `url:"mature_classification,brackets,omitempty"`

	// Allow comments on the submission
	AllowComments bool `url:"allow_comments,omitempty"`

	// License options.
	LicenseOptions []LicenseOptions `url:"license_options"`

	// ID of the embeded deviation.
	EmbeddedImageDeviationID string `url:"embedded_image_deviation_id,omitempty"`
}

type CursorParams

type CursorParams struct {
	Cursor string `url:"cursor,omitempty"`
}

CursorParams params for cursor-based pagination.

type CursorResponse

type CursorResponse[T any] struct {
	Results    []T    `json:"results"`
	HasMore    bool   `json:"has_more"`
	NextCursor string `json:"next_cursor"`
	PrevCursor string `json:"prev_cursor"`
}

func (*CursorResponse[T]) Next

func (c *CursorResponse[T]) Next() *CursorParams

type DeleteMessageParams

type DeleteMessageParams struct {
	// The folder to delete the message from, defaults to inbox.
	FolderID uuid.UUID `url:"folderid,omitempty"`

	// The message to delete.
	MessageID string `url:"messageid,omitempty"`

	// The stack to delete.
	StackID string `url:"stackid,omitempty"`
}

type Deviation

type Deviation struct {
	DeviationID  uuid.UUID `json:"deviationid"`
	PrintID      uuid.UUID `json:"printid,omitempty"`
	URL          string    `json:"url,omitempty"`
	Title        string    `json:"title,omitempty"`
	Category     string    `json:"category,omitempty"`
	CategoryPath string    `json:"category_path,omitempty"`
	IsFavourited bool      `json:"is_favourited,omitempty"`
	IsDeleted    bool      `json:"is_deleted"`
	IsPublished  bool      `json:"is_published,omitempty"`
	IsBlocked    bool      `json:"is_blocked,omitempty"`
	Author       User      `json:"author,omitempty"`
	Stats        struct {
		Comments   uint32 `json:"comments"`
		Favourites uint32 `json:"favourites"`
	} `json:"stats,omitempty"`
	PublishedTime  string        `json:"published_time,omitempty"`
	AllowsComments bool          `json:"allows_comments,omitempty"`
	Tier           DeviationTier `json:"tier,omitempty"`
	Preview        StashFile     `json:"preview,omitempty"`
	Content        struct {
		StashFile
		FileSize uint32 `json:"filesize"`
	} `json:"content,omitempty"`
	Thumbs []StashFile `json:"thumbs"`
	Videos []struct {
		Src      string `json:"src"`
		Quality  string `json:"quality"`
		FileSize uint32 `json:"filesize"`
		Duration uint32 `json:"duration"`
	} `json:"videos,omitempty"`
	Flash          []fileInfo `json:"flash,omitempty"`
	DailyDeviation struct {
		Body      string `json:"body"`
		Time      string `json:"time"`
		Giver     User   `json:"giver"`
		Suggester User   `json:"suggester,omitempty"`
	} `json:"daily_deviation,omitempty"`
	PremiumFolderData *PremiumFolderData `json:"premium_folder_data,omitempty"`
	TextContent       *EditorText        `json:"text_content,omitempty"`
	IsPinned          bool               `json:"is_pinned,omitempty"`
	CoverImage        *Deviation         `json:"cover_image,omitempty"`
	TierAccess        string             `json:"tier_access,omitempty"`
	PrimaryTier       *Deviation         `json:"primary_tier,omitempty"`
	Excerpt           string             `json:"excerpt,omitempty"`
	IsMature          bool               `json:"is_mature,omitempty"`
	IsDownloadable    bool               `json:"is_downloadable,omitempty"`
	DownloadFileSize  uint32             `json:"download_filesize,omitempty"`
	MotionBook        struct {
		EmbedURL string `json:"embed_url,omitempty"`
	} `json:"motion_book,omitempty"`
	SuggestedReasons []any `json:"suggested_reasons,omitempty"`
}

type DeviationMetadata

type DeviationMetadata struct {
	DeviationID          uuid.UUID            `json:"deviationid"`
	PrintID              uuid.UUID            `json:"uuid,omitempty"`
	Author               *User                `json:"author"`
	IsWatching           bool                 `json:"is_watching"`
	Title                string               `json:"title"`
	Description          string               `json:"description"`
	License              string               `json:"license"`
	AllowsComments       bool                 `json:"allow_comments"`
	Tags                 []DeviationTag       `json:"tags"`
	IsFavourited         bool                 `json:"is_favourited"`
	IsMature             bool                 `json:"is_mature"`
	MatureLevel          string               `json:"mature_level,omitempty"`
	MatureClassification []string             `json:"mature_classification,omitempty"`
	Submission           *DeviationSubmission `json:"submission,omitempty"`
	Stats                *DeviationStats      `json:"stats,omitempty"`
	Camera               map[string]string    `json:"camera,omitempty"`
	Collections          []Folder             `json:"collections,omitempty"`
	Galleries            []Folder             `json:"galleries,omitempty"`
	CanPostComments      bool                 `json:"can_post_comments,omitempty"`
}

type DeviationService

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

func (*DeviationService) Content

func (s *DeviationService) Content(deviationID uuid.UUID) (Content, error)

Content fetches a full data that is not included in the main deviation object.

The endpoint works with journals and literatures. Deviation objects returned from API contain only excerpt of a journal, use this endpoint to load full content. Any custom CSS rules and fonts applied to journal are also returned.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

func (*DeviationService) CreateJournal

func (s *DeviationService) CreateJournal(params *CreateJournalParams) (uuid.UUID, error)

CreateJournal creates journal.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • user.manage

func (*DeviationService) CreateLiterature

func (s *DeviationService) CreateLiterature(params *CreateLiteratureParams) (uuid.UUID, error)

CreateLiterature creates literature.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • user.manage

func (*DeviationService) Deviation

func (s *DeviationService) Deviation(deviationID uuid.UUID) (Deviation, error)

Deviation fetches a deviation.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

func (*DeviationService) Download

func (s *DeviationService) Download(deviationID uuid.UUID) (DownloadResponse, error)

Download fetches the original file download (if allowed).

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

func (*DeviationService) Edit

Edit edits deviation. Note: null/empty values will have the corresponding fields cleared. To keep a field value send the old one.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • stash
  • publish

func (*DeviationService) EmbeddedContent

func (s *DeviationService) EmbeddedContent(params *EmbeddedContentParams, page *OffsetParams) (OffsetResponse[Deviation], error)

EmbeddedContent fetch a content embedded in a deviation.

Journal and literature deviations support embedding of deviations inside them.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

func (*DeviationService) Metadata

func (s *DeviationService) Metadata(params *MetadataParams) (MetadataResponse, error)

Metadata fetches a deviation metadata for a set of deviations.

This endpoint is limited to 50 deviations per query when fetching the base data and 10 when fetching extended data.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

func (*DeviationService) UpdateJournal

func (s *DeviationService) UpdateJournal(deviationID uuid.UUID, params *UpdateJournalParams) (DeviationUpdateResponse, error)

UpdateJournal updates journal. All values left empty, except cover image deviation id, will have the corresponding fields cleared. To keep a field value send the old one. To clear cover image deviation id value - pass `reset_cover_image_deviation_id` param with value `true`.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • user.manage

func (*DeviationService) UpdateLiterature

func (s *DeviationService) UpdateLiterature(deviationID uuid.UUID, params *UpdateLiteratureParams) (DeviationUpdateResponse, error)

UpdateLiterature updates literature. Note: null/empty values will have the corresponding fields cleared. To keep a field value send the old one.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • user.manage

func (*DeviationService) WhoFaved

func (s *DeviationService) WhoFaved(deviationID uuid.UUID, page *OffsetParams) (OffsetResponse[FaveInfo], error)

WhoFaved fetches a list of users who faved the deviation.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

type DeviationStats

type DeviationStats struct {
	Views          int `json:"views"`
	ViewsToday     int `json:"views_today,omitempty"`
	Favourites     int `json:"favourites"`
	Comments       int `json:"comments"`
	Downloads      int `json:"downloads"`
	DownloadsToday int `json:"downloads_today,omitempty"`
}

type DeviationSubmission

type DeviationSubmission struct {
	CreationTime  string `json:"creation_time"`
	Category      string `json:"category"`
	FileSize      string `json:"file_size,omitempty"`
	Resolution    string `json:"resolution,omitempty"`
	SubmittedWith struct {
		App string `json:"app"`
		URL string `json:"url"`
	} `json:"submitted_with"`
}

type DeviationTag

type DeviationTag struct {
	Name      string `json:"tag_name"`
	Sponsored bool   `json:"sponsored"`
	Sponsor   bool   `json:"sponsor"`
}

func (DeviationTag) String

func (t DeviationTag) String() string

String returns DeviationTag name.

type DeviationTier

type DeviationTier struct {
	State            string `json:"state,omitempty"` // TODO: enum[draft,active,pending_deletion,deleted]
	IsUserSubscribed bool   `json:"is_user_subscribed,omitempty"`
	CanUserSubscribe bool   `json:"can_user_subscribe,omitempty"`
	SubproductID     uint64 `json:"subproductid,omitempty"`
	DollarPrice      string `json:"dollar_price,omitempty"` // TODO: PremiumFolderData has the same float field.
	Settings         struct {
		AccessSettings string `json:"access_settings"` // TODO: enum[all,future_only,limited_past_and_future]
	} `json:"settings,omitempty"`
	Stats struct {
		Subscribers uint32 `json:"subscribers,omitempty"`
		Deviations  uint32 `json:"deviations,omitempty"`
		Posts       uint32 `json:"posts,omitempty"`
		Total       uint32 `json:"total,omitempty"`
	} `json:"stats"`
	Benefits []string `json:"benefits"`
}

type DeviationUpdateResponse

type DeviationUpdateResponse struct {
	StatusResponse
	URL         string    `json:"url"`
	DeviationID uuid.UUID `json:"deviationid"`
}

type DisplayResolution

type DisplayResolution uint8
const (
	DisplayResolutionOriginal DisplayResolution = iota
	DisplayResolution400px
	DisplayResolution600px
	DisplayResolution800px
	DisplayResolution900px
	DisplayResolution1024px
	DisplayResolution1280px
	DisplayResolution1600px
	DisplayResolution1920px
)

type DownloadResponse

type DownloadResponse struct {
	FileName string `json:"filename"`
	FileSize uint32 `json:"filesize"`
	// contains filtered or unexported fields
}

type EditDeviationParams

type EditDeviationParams struct {
	// Title.
	Title string `url:"title,omitempty"`

	// Submission is mature or not.
	IsMature bool `url:"is_mature"`

	// The mature level of the submission, required for mature submissions.
	MatureLevel string `url:"mature_level,omitempty"`

	// The mature classification of the submission.
	MatureClassification []string `url:"mature_classification,brackets,omitempty"`

	// Allow comments on the submission. Default: true.
	AllowComments bool `url:"allow_comments,omitempty"`

	// License options.
	LicenseOptions LicenseOptions `url:"license_options,omitempty"`

	// UUIDs of gallery folders to publish this submission to.
	GalleryIDs []string `url:"galleryids,omitempty"`

	// Offer original file as a free download.
	AllowFreeDownload bool `url:"allow_free_download,omitempty"`

	// Add watermark. Available only if display_resolution is present.
	AddWatermark bool `url:"add_watermark,omitempty"`
}

type EditorText

type EditorText struct {
	Excerpt string `json:"excerpt"`
	Body    struct {
		Type     string `json:"type"`
		Markup   string `json:"markup,omitempty"`
		Features string `json:"features"`
	} `json:"body"`
}

type EmbeddedContentParams

type EmbeddedContentParams struct {
	// The deviation ID of container deviation.
	DeviationID uuid.UUID `url:"deviationid"`

	// ID of embedded deviation to use as an offset.
	OffsetDeviationID uuid.UUID `url:"offset_deviationid,omitempty"`
}

type Error

type Error struct {
	StatusResponse

	// The error type.
	Type string `json:"error"`

	// The error message.
	Description string `json:"error_description"`

	// An additional endpoint specific error code.
	Details map[string]string `json:"error_details"`

	// An additional endpoint specific error code.
	Code int `json:"error_code"`
}

func (Error) Error

func (e Error) Error() string

type FaveInfo

type FaveInfo struct {
	User *User `json:"user"`
	Time int64 `json:"time"`
}

type FetchCommentsParams

type FetchCommentsParams struct {
	// The commentid you want to fetch.
	CommentID uuid.UUID `url:"commentid,omitempty"`

	// Depth to query replies until.
	MaxDepth uint8 `json:"maxdepth,omitempty"`

	// The pagination offset.
	Offset int `url:"offset,omitempty"`

	// The pagination limit.
	Limit int `url:"limit,omitempty"`
}

type Folder

type Folder struct {
	// FolderID uuid.UUID `json:"folderid"` // TODO: Remove it?
	FolderID int64  `json:"folderid"`
	Name     string `json:"name"`
	Owner    *User  `json:"owner,omitempty"` // TODO: Do we need this field?
}

TODO: Embed to Gallery and Collection?

type FolderContent

type FolderContent struct {
	OffsetResponse[Deviation]
	Name string `json:"name"`
}

type FolderParams

type FolderParams struct {
	// The user who owns the folder, defaults to current user.
	Username string `url:"username,omitempty"`

	// Sort results by either newest or popular (when querying all folders
	// only).
	// This field is supported only by galleries.
	SortMode string `url:"mode,omitempty"` // values(newest, popular) default: popular
}

type FoldersParams

type FoldersParams struct {
	// The user to list folders for, if omitted the authenticated user is used.
	Username string `url:"username,omitempty"`

	// The option to include the content count per each collection folder.
	CalculateSize bool `url:"calculate_size,omitempty"`

	// Include first 5 deviations from the folder.
	IncludePreload bool `url:"ext_preload,omitempty"`

	// Filters collections with no deviations if true.
	FilterEmptyFolder bool `url:"filter_empty_folder,omitempty"`
}

type FoldersService

type FoldersService[T Collection | Gallery] struct {
	// contains filtered or unexported fields
}

func (*FoldersService[T]) All

func (s *FoldersService[T]) All(username string) (OffsetResponse[Deviation], error)

All gets the "all" view of a users collection/gallery.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

func (*FoldersService[T]) CopyDeviations

func (s *FoldersService[T]) CopyDeviations(params *CopyDeviationsParams) error

CopyDeviations copies a list of deviations to a folder destination.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse
  • collection or gallery

func (*FoldersService[T]) Create

func (s *FoldersService[T]) Create(params *CreateFolderParams) (Folder, error)

Creates new collection folder.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse
  • collection or gallery

func (*FoldersService[T]) Folder

func (s *FoldersService[T]) Folder(folderID uuid.UUID, params *FolderParams, page *OffsetParams) (FolderContent, error)

Folder fetches folder contents.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

func (*FoldersService[T]) Folders

func (s *FoldersService[T]) Folders(params *FoldersParams, page *OffsetParams) (OffsetResponse[T], error)

Folders fetches collection folders.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

TODO: Support `ext_preload` for collections.

func (*FoldersService[T]) MoveDeviations

func (s *FoldersService[T]) MoveDeviations(params *MoveDeviationsParams) error

MoveDeviations moves a list of deviations to a folder destination.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse
  • collection or gallery

func (*FoldersService[T]) Remove

func (s *FoldersService[T]) Remove(folderID uuid.UUID) error

Remove deletes collection folder.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse
  • collection or gallery

func (*FoldersService[T]) RemoveDeviations

func (s *FoldersService[T]) RemoveDeviations(params *RemoveDeviationsParams) error

RemoveDeviations removes a list of deviations from a gallery folder.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse
  • collection or gallery

func (*FoldersService[T]) Update

func (s *FoldersService[T]) Update(params *UpdateFoldersParams) error

Update updates folder.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse
  • collection or gallery

func (*FoldersService[T]) UpdateDeviationOrder

func (s *FoldersService[T]) UpdateDeviationOrder(params *UpdateDeviationOrderParams) error

UpdateDeviationOrder updates order of deviation in folder.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse
  • collection or gallery

func (*FoldersService[T]) UpdateOrder

func (s *FoldersService[T]) UpdateOrder(params *UpdateOrderParams) error

UpdateOrder rearranges the position of folders.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse
  • collection or gallery

type Friend

type Friend struct {
	User       *User     `json:"user"`
	IsWatching bool      `json:"is_watching"`
	WatchesYou bool      `json:"watches_you"`
	LastVisit  string    `json:"lastvisit,omitempty"` // TODO: Parse time.
	Watch      UserWatch `json:"watch"`
}

type FriendsSearchParams

type FriendsSearchParams struct {
	Username string `url:"username,omitempty"`
	Search   string `url:"search,omitempty"`
	Query    string `url:"query,omitempty"`
}
type Gallery struct {
	FolderID          uuid.UUID          `json:"folderid"`
	Parent            uuid.UUID          `json:"parent,omitempty"`
	Name              string             `json:"name"`
	Description       string             `json:"folder"`
	Size              uint32             `json:"size,omitempty"`
	Thumb             *Deviation         `json:"thumb"`
	PremiumFolderData *PremiumFolderData `json:"premium_folder_data,omitempty"` // premium_folder_data
	HasSubfolders     bool               `json:"has_subfolders"`
	Subfolders        []Gallery          `json:"subfolders,omitempty"`
	Deviations        []Deviation        `json:"deviations,omitempty"`
}

type GalleryService

type GalleryService struct {
	*FoldersService[Gallery]
	// contains filtered or unexported fields
}

type GetProfileParams

type GetProfileParams struct {
	// Include collection folder info.
	IncludeCollections bool `url:"ext_collections,omitempty"`

	// Include gallery folder info.
	IncludeGalleries bool `url:"ext_galleries,omitempty"`
}

type ItemParams

type ItemParams struct {
	IncludeSubmission bool `url:"ext_submission,omitempty"`
	IncludeCamera     bool `url:"ext_camera,omitempty"`
	IncludeStats      bool `url:"ext_stats,omitempty"`
}

type JournalStatus

type JournalStatus struct {
	Journal *Deviation `json:"journal"`
	Status  *Status    `json:"status"`
}

type LicenseOptions

type LicenseOptions struct {
	CreativeCommons bool `url:"creative_commons,omitempty"`
	Commercial      bool `url:"commercial,omitempty"`
	// Valid values: yes, no, share
	Modify string `url:"modify,omitempty"`
}

type Message

type Message struct {
	MessageID  string `json:"messageid"`
	Type       string `json:"type"`
	Orphaned   bool   `json:"orphaned"`
	TS         string `json:"ts,omitempty"`
	StackID    string `json:"stackid,omitempty"`
	StackCount int    `json:"stack_count,omitempty"`
	IsNew      bool   `json:"is_new"`
	Originator *User  `json:"originator,omitempty"`
	Subject    *struct {
		Profile    *User      `json:"profile,omitempty"`
		Deviation  *Deviation `json:"deviation,omitempty"`
		Status     *Status    `json:"status,omitempty"`
		Comment    *Comment   `json:"comment,omitempty"`
		Collection *Folder    `json:"collection"`
		Gallery    *Folder    `json:"gallery"`
	} `json:"subject,omitempty"`
	HTML       string     `json:"html,omitempty"`
	Profile    *User      `json:"profile,omitempty"`
	Deviation  *Deviation `json:"deviation,omitempty"`
	Status     *Status    `json:"status,omitempty"`
	Comment    *Comment   `json:"comment,omitempty"`
	Collection *Folder    `json:"collection,omitempty"`
}

type MessagesFeedParams

type MessagesFeedParams struct {
	// The folder to fetch messages from, defaults to inbox.
	FolderID uuid.UUID `url:"folderid,omitempty"`

	// True to use stacked mode, false to use flat mode.
	Stack bool `url:"stack,omitempty"`
}

type MessagesFeedbackParams

type MessagesFeedbackParams struct {
	// Type of feedback messages to fetch.
	Type string `url:"type"`

	// The folder to fetch messages from, defaults to inbox.
	FolderID uuid.UUID `url:"folderid,omitempty"`

	// True to use stacked mode, false to use flat mode.
	Stack bool `url:"stack,omitempty"`
}

type MessagesMentionsParams

type MessagesMentionsParams struct {
	// The folder to fetch messages from, defaults to inbox.
	FolderID uuid.UUID `url:"folderid,omitempty"`

	// True to use stacked mode, false to use flat mode.
	Stack bool `url:"stack,omitempty"`

	// The pagination offset.
	Offset int `url:"offset,omitempty"`

	// The pagination limit.
	Limit int `url:"limit,omitempty"`
}

type MessagesService

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

func (*MessagesService) Delete

func (s *MessagesService) Delete(params *DeleteMessageParams) error

Delete deletes a message or a message stack.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • message

func (*MessagesService) Feed

Feed fetches feed of all messages.

Messages can be fetched in a stacked (default) or flat mode. In the stacked mode similar messages will be grouped together and the most recent one will be returned. stackid can be used to fetch the rest of the messages in the stack.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • message

func (*MessagesService) Feedback

Feedback fetches feedback messages.

Messages can be fetched in a stacked (default) or flat mode. In the stacked mode similar messages will be grouped together and the most recent one will be returned. stackid can be used to fetch the rest of the messages in the stack.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • message

func (*MessagesService) Mentions

Mentions fetches mention messages.

Messages can be fetched in a stacked (default) or flat mode. In the stacked mode similar messages will be grouped together and the most recent one will be returned. stackid can be used to fetch the rest of the messages in the stack.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • message

func (*MessagesService) StackFeedback

func (s *MessagesService) StackFeedback(stackID string, page *OffsetParams) (CursorResponse[Message], error)

Fetch messages in a stack.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • message

func (*MessagesService) StackMentions

func (s *MessagesService) StackMentions(stackID string, page *OffsetParams) (OffsetResponse[Message], error)

StackMentions fetches messages in a stack.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • message

type MetadataParams

type MetadataParams struct {
	// The deviation IDs you want metadata for.
	DeviationIDs []uuid.UUID `url:"deviationids"`

	IncludeSubmission bool `url:"ext_submission,omitempty"`
	IncludeCamera     bool `url:"ext_camera,omitempty"`
	IncludeStats      bool `url:"ext_stats,omitempty"`
	IncludeCollection bool `url:"ext_collection,omitempty"`
	IncludeGallery    bool `url:"ext_gallery,omitempty"`
}

type MetadataResponse

type MetadataResponse struct {
	Metatada []DeviationMetadata `json:"metadata"`
}

type ModuleCoverDeviation

type ModuleCoverDeviation struct {
	CoverDeviation          Deviation `json:"cover_deviation,omitempty"`
	CoverDeviationIDOffsetY uint32    `json:"cover_deviationid_offset_y"`
	ImageWidth              uint32    `json:"image_width,omitempty"`
	ImageHeight             uint32    `json:"image_height,omitempty"`
	CropX                   uint32    `json:"crop_x,omitempty"`
	CropY                   uint32    `json:"crop_y,omitempty"`
	CropWidth               uint32    `json:"crop_width,omitempty"`
	CropHeight              uint32    `json:"crop_height,omitempty"`
}

type MoreLikeThisPreviewResponse

type MoreLikeThisPreviewResponse struct {
	Seed                 uuid.UUID   `json:"seed"`
	Author               User        `json:"user"`
	MoreFromArtist       []Deviation `json:"more_from_artist"`
	MoreFromDeviantArt   []Deviation `json:"more_from_da"`
	SuggestedCollections []struct {
		Collection Folder      `json:"collection"` //Gallection
		Deviations []Deviation `json:"deviations"`
	} `json:"suggested_collections,omitempty"`
}

type MoveDeviationsParams

type MoveDeviationsParams struct {
	// The UUID of the folder to copy to.
	SourceFolderID uuid.UUID `url:"source_folderid"`

	// The UUID of the folder to copy to.
	TargetFolderID uuid.UUID `url:"target_folderid"`

	// The UUIDs of the deviations.
	DeviationIDs []uuid.UUID `url:"deviationids"`
}

type OffsetParams

type OffsetParams struct {
	// The pagination offset.
	Offset uint32 `url:"offset,omitempty"`

	// The pagination limit.
	Limit uint32 `url:"limit,omitempty"`
}

OffsetParams params for offset-based pagination.

type OffsetResponse

type OffsetResponse[T any] struct {
	Results    []T    `json:"results"`
	HasMore    bool   `json:"has_more"`
	NextOffset uint32 `json:"next_offset,omitempty"`

	// This field is used in some endpoints with a query parameter.
	// TODO: Use separate struct and API method (?).
	EstimatedTotal uint32 `json:"estimated_total,omitempty"`
}

func (*OffsetResponse[T]) Next

func (o *OffsetResponse[T]) Next() *OffsetParams

type PopularParams

type PopularParams struct {
	// Search query term.
	//
	// Estimated total results count would be available on EstimatedTotal field.
	Query string `url:"q,omitempty"`

	// The timerange.
	//
	// TODO: Valid values are: values(now, 1week, 1month, alltime).
	TimeRange string `url:"timerange,omitempty"`
}

type PostStatusParams

type PostStatusParams struct {
	// The body of the status.
	Text string `url:"body,omitempty"`

	// The ID of the object you wish to share.
	ID uuid.UUID `url:"id,omitempty"`

	ParentID uuid.UUID
}

type PremiumFolderData

type PremiumFolderData struct {
	Type           string    `json:"type"`
	HasAccess      bool      `json:"has_access"`
	GalleryID      uuid.UUID `json:"gallery_id"`
	PointsPrice    int       `json:"points_price,omitempty"`
	DollarPrice    float64   `json:"dollar_price,omitempty"` // TODO: DeviationTier has the same string field.
	NumSubscribers int       `json:"num_subscribers,omitempty"`
	SubproductID   int       `json:"subproductid,omitempty"` // TODO: Is it really an integer field and not an UUID?
}

type Profile

type Profile struct {
	User             User                  `json:"user"`
	IsWatching       bool                  `json:"is_watching"`
	ProfileURL       string                `json:"profile_url"`
	UserIsArtist     bool                  `json:"user_is_artist"`
	ArtistLevel      string                `json:"artist_level,omitempty"`
	ArtistSpeciality string                `json:"artist_specialty,omitempty"`
	RealName         string                `json:"real_name"`
	Tagline          string                `json:"tagline"`
	CountryID        uint8                 `json:"countryid"`
	Country          string                `json:"country"`
	Website          string                `json:"website"`
	Bio              string                `json:"bio"`
	CoverPhoto       string                `json:"cover_photo,omitempty"`
	CoverDeviation   *ModuleCoverDeviation `json:"cover_deviation,omitempty"`
	LastStatus       *Status               `json:"last_status,omitempty"`
	Stats            struct {
		UserDeviations   uint32 `json:"user_deviations"`
		UserFavourites   uint32 `json:"user_favourites"`
		UserComments     uint32 `json:"user_comments"`
		ProfilePageViews uint32 `json:"profile_pageviews"`
		ProfileComments  uint32 `json:"profile_comments"`
	} `json:"stats"`
	Collections []Folder `json:"collections,omitempty"`
	Galleries   []struct {
		FolderID uuid.UUID `json:"folderid"`
		Parent   uuid.UUID `json:"parent,omitempty"`
		Name     string    `json:"name"`
	} `json:"galleries,omitempty"`
}

type RemoveDeviationsParams

type RemoveDeviationsParams struct {
	// The UUID of the folder to remove.
	FolderID uuid.UUID `url:"folderid"`

	// The UUIDs of the deviations.
	DeviationIDs []uuid.UUID `url:"deviationids"`
}

type StackContentsParams

type StackContentsParams struct {
	Offset uint16 `url:"offset,omitempty"`
	Limit  uint8  `url:"limit,omitempty"`

	IncludeSubmission bool `url:"ext_submission,omitempty"`
	IncludeCamera     bool `url:"ext_camera,omitempty"`
	IncludeStats      bool `url:"ext_stats,omitempty"`
}

type StashDeltaParams

type StashDeltaParams struct {
	// The cursor hash provided to your app in the last delta call.
	Cursor string `url:"cursor,omitempty"`

	// The pagination offset
	Offset int `url:"offset,omitempty"`

	// The pagination limit
	Limit int `url:"limit,omitempty"`

	// Include extended submission information
	IncludeSubmission bool `url:"ext_submission"`

	// Include camera EXIF information
	IncludeCamera bool `url:"ext_camera"`

	// Include extended statistics
	IncludeStats bool `url:"ext_stats"`
}

type StashDeltaResponse

type StashDeltaResponse struct {
	Cursor     string `json:"cursor"`
	HasMore    bool   `json:"has_more"`
	NextOffset int    `json:"next_offset"`
	Reset      bool   `json:"reset"`
	Entries    []struct {
		ItemID   int64         `json:"itemid,omitempty"`
		StackID  int64         `json:"stackid,omitempty"`
		Metadata StashMetadata `json:"stash_metadata"`
		Position int           `json:"position,omitempty"`
	} `json:"entries,omitempty"`
}

type StashFile

type StashFile struct {
	Transparency bool `json:"transparency"`
	// contains filtered or unexported fields
}

type StashItem

type StashItem struct {
	ItemID   int64    `json:"itemid"`
	HTML     string   `json:"html,omitempty"`
	CSS      string   `json:"css,omitempty"`
	CSSFonts []string `json:"css_fonts,omitempty"`
	StashMetadata
}

type StashMetadata

type StashMetadata struct {
	Title          string            `json:"title"`
	Path           string            `json:"path,omitempty"`
	Size           int               `json:"size,omitempty"`
	Description    string            `json:"description,omitempty"` // html
	ParentID       int               `json:"parentid,omitempty"`
	Thumb          *StashFile        `json:"thumb,omitempty"`
	ArtistComments string            `json:"artist_comments,omitempty"` //html
	OriginalURL    string            `json:"original_url,omitempty"`
	Category       string            `json:"category,omitempty"`
	CreationTime   int64             `json:"creation_time,omitempty"`
	Files          []StashFile       `json:"files,omitempty"`
	Submission     *StashSubmission  `json:"submission,omitempty"`
	Stats          *StashStats       `json:"stats,omitempty"`
	Camera         map[string]string `json:"camera,omitempty"`
	StackID        int               `json:"stackid"`
	Tags           []string          `json:"tags,omitempty"`
}

type StashMoveResponse

type StashMoveResponse struct {
	Target  StashMetadata   `json:"target"`
	Changes []StashMetadata `json:"changes"`
}

type StashPublishParams

type StashPublishParams struct {
	// The ID of the stash item to publish.
	ItemID int64 `url:"itemid"`

	// Submission is mature or not.
	IsMature bool `url:"is_mature"`

	// The mature level of the submission, required for mature submissions.
	MatureLevel string `url:"mature_level,omitempty"`

	// The mature classification of the submission.
	MatureClassification []string `url:"mature_classification,brackets,omitempty"`

	// Agree to submission policy.
	AgreeSubmission bool `url:"agree_submission"`

	// Agree to terms of service.
	AgreeToS bool `url:"agree_tos"`

	// Feature the submission. Default: true.
	Feature bool `url:"feature,omitempty"`

	// Allow comments on the submission. Default: true.
	AllowComments bool `url:"allow_comments,omitempty"`

	// Request a critique, only available to some users see `/publish/userdata`.
	RequestCritique bool `url:"request_critique,omitempty"`

	// Resize image to. Cannot be bigger than image and is ignored for non images.
	DisplayResolution DisplayResolution `url:"display_resolution,omitempty"`

	// Sharing options.
	SharingOptions string `url:"sharing,omitempty"`

	// License options.
	LicenseOptions LicenseOptions `url:"license_options,omitempty"`

	// UUIDs of gallery folders to publish this submission to.
	GalleryIDs []string `url:"galleryids,omitempty"`

	// Offer original file as a free download.
	AllowFreeDownload bool `url:"allow_free_download,omitempty"`

	// Add watermark. Available only if display_resolution is present.
	AddWatermark bool `url:"add_watermark,omitempty"`
}

type StashPublishResponse

type StashPublishResponse struct {
	StatusResponse
	URL         string    `json:"url"`
	DeviationID uuid.UUID `json:"deviationid"`
}

type StashService

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

func (*StashService) Delete

func (s *StashService) Delete(itemID int64) (bool, error)

Delete deletes a previously submitted file.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • stash

func (*StashService) Delta

Delta retrieves contents of Sta.sh for a user.

This endpoint is used to retrieve all data available in user's Sta.sh. The Sta.sh data is organized into stacks and items. A stack contains either a list of children stacks or a single item, that is, a stack can't contain more than one item or a mix of stacks and items. Stacks can be moved into another stack or positioned within a parent. An item represents a Sta.sh submission and is always contained within some stack.

This endpoint is incremental. The first time you call it for a user, your app will receive the full list of that user's Sta.sh stacks and items. Your app should cache these results locally.

Afterward, your app should then provide a cursor parameter for all /delta calls. This cursor tells us which data you have already received so that we can send you only new and modified stacks and items.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • stash

func (*StashService) Item

func (s *StashService) Item(itemID int64, params *ItemParams) (StashItem, error)

Item fetches stash item's metadata.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • stash

func (*StashService) Move

func (s *StashService) Move(stackID, targetID int64) (StashMoveResponse, error)

Move moves the stack into the target stack.

The response includes updated metadata of the target stack and changes in its contents. Changes include at least the stack being moved. If the move operation resulted in new stacks being created, they will be returned as well. New stack may be created if the target stack is a leaf stack, i.e. has no children stacks yet.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • stash

func (*StashService) Position

func (s *StashService) Position(stackID, position int64) (bool, error)

Position changes the position of a stack within its parent.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • stash

func (*StashService) Publish

Publish a Sta.sh item to deviantART.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • stash
  • publish

func (*StashService) Space

func (s *StashService) Space() (StashSpace, error)

Space returns how much sta.sh space (expressed in bytes) a user has available for new uploads.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • stash

func (*StashService) Stack

func (s *StashService) Stack(stackID int64) (StashMetadata, error)

Stack fetches a stash stack's metadata.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • stash

func (*StashService) StackContents

func (s *StashService) StackContents(stackID int64, params *StackContentsParams) (OffsetResponse[StashMetadata], error)

StackContents fetches stack contents.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • stash

func (*StashService) Submit

func (s *StashService) Submit(params *StashSubmitParams, files ...fs.File) (SubmitResponse, error)

Submit submits files to Sta.sh or modify existing files.

It can receive files in any format. Some formats like JPG, PNG, GIF, HTML or plain text can be viewed directly on Sta.sh and DeviantArt. Other file types are made available for download and may have a preview image.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • stash

func (*StashService) Update

func (s *StashService) Update(stackID int64, params *StashUpdateParams) (bool, error)

Update updates the stash stack's details.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • stash

func (*StashService) Userdata

func (s *StashService) Userdata() (StashUserdata, error)

Userdata fetches users data about features and agreements.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • stash
  • publish

type StashSpace

type StashSpace struct {
	AvailableSpace uint64 `json:"available_space"`
	TotalSpace     uint64 `json:"total_space"`
}

func (StashSpace) String

func (s StashSpace) String() string

String represents available space in human readable form.

type StashStats

type StashStats struct {
	Views          int `json:"views,omitempty"`
	ViewsToday     int `json:"views_today,omitempty"`
	Downloads      int `json:"downloads,omitempty"`
	DownloadsToday int `json:"downloads_today,omitempty"`
}

type StashSubmission

type StashSubmission struct {
	FileSize      string `json:"file_size,omitempty"`
	Resolution    string `json:"resolution,omitempty"`
	SubmittedWith *struct {
		App string `json:"app,omitempty"`
		URL string `json:"url,omitempty"`
	} `json:"submitted_with,omitempty"`
}

type StashSubmitParams

type StashSubmitParams struct {
	// The title of the submission.
	Title string `url:"title,omitempty"`

	// Additional information about the submission provided by the author.
	Description string `url:"artist_comments,omitempty"`

	// An array of tags describing the submission. Letters, numbers and
	// underscore only.
	Tags []string `url:"tags,brackets,omitempty"`

	// A link to the original, in case the artwork has already been posted
	// elsewhere. This field can be restricted with a whitelist by editing your
	// deviantART app.
	OriginalURL string `url:"original_url,omitempty"`

	// Is the submission being worked on currently. You can use this flag to
	// warn users that the item is being edited and may change if they reload.
	// Note this does NOT provide any type of locking.
	IsDirty bool `url:"is_dirty,omitempty"`

	// The id of an existing Sta.sh submission. This can be used to overwrite
	// files and /metadata of existing submissions. If you make a new API call
	// containing files, the files that were previously associated with the
	// artwork will be replaced by the new ones.
	ItemID int64 `url:"itemid,omitempty"`

	// The name of the stack to create and place the new submission in. Applies
	// to new submissions only. (Ignored if `stackid` is set).
	Stack string `url:"stack,omitempty"`

	// The id of the stack to create and place the new submission in. Applies to
	// new submissions only.
	StackID int64 `url:"stackid,omitempty"`
}

type StashUpdateParams

type StashUpdateParams struct {
	Title       string `url:"title,omitempty"`
	Description string `url:"description,omitempty"`
}

type StashUserdata

type StashUserdata struct {
	Features   []string `json:"features"`
	Agreements []string `json:"agreements"`
}

type Status

type Status struct {
	StatusID      uuid.UUID `json:"statusid,omitempty"`
	Body          string    `json:"html,omitempty"`
	Timestamp     string    `json:"ts,omitempty"` // TODO: Parse to time.Time.
	URL           string    `json:"url,omitempty"`
	CommentsCount int       `json:"comments_count,omitempty"`
	IsShare       bool      `json:"is_share,omitempty"`
	IsDeleted     bool      `json:"is_deleted,omitempty"`
	Author        *User     `json:"user,omitempty"`
	Items         []struct {
		Type      string     `json:"type"`
		Status    *Status    `json:"status,omitempty"`
		Deviation *Deviation `json:"deviation,omitempty"`
	} `json:"items,omitempty"`
	TextContent *struct {
		Excerpt string `json:"excerpt"`
		Body    struct {
			Type     string `json:"type"`
			Markup   string `json:"markup,omitempty"`
			Features string `json:"features"`
		} `json:"body"`
	} `json:"text_content,omitempty"`
}

type StatusResponse

type StatusResponse struct {
	Status string `json:"status"`
}

type SubmitResponse

type SubmitResponse struct {
	StatusResponse
	ItemID  int64  `json:"itemid"`
	Stack   string `json:"stack,omitempty"`
	StackID int64  `json:"stackid,omitempty"`
}

type Topic

type Topic struct {
	Name              string      `json:"name"`
	CanonicalName     string      `json:"canonical_name"`
	ExampleDeviations []Deviation `json:"example_deviations,omitempty"`
}

type UpdateDeviationOrderParams

type UpdateDeviationOrderParams struct {
	// The UUID of the gallery folder.
	FolderID uuid.UUID `url:"folderid"`

	// The UUID of the deviation.
	DeviationID uuid.UUID `url:"deviationid"`

	// The new position.
	Position int `url:"position"`
}

type UpdateFoldersParams

type UpdateFoldersParams struct {
	// The UUID of the folder to rename.
	FolderID uuid.UUID `url:"folderid"`

	// Folder new name.
	Name string `url:"name,omitempty"`

	// Folder description.
	Description string `url:"description,omitempty"`

	// Folder thumb.
	CoverDeviationID uuid.UUID `url:"cover_deviationid,omitempty"`
}

type UpdateJournalParams

type UpdateJournalParams struct {
	// Journal title.
	Title string `url:"title"`

	// Journal tags.
	Tags []string `url:"tags,brackets,omitempty"`

	// Cover deviation ID.
	CoverImageDeviationID uuid.UUID `url:"cover_image_deviation_id,omitempty"`

	// Reset cover deviation ID.
	ResetCoverImageDeviationID bool `url:"reset_cover_image_deviation_id,omitempty"`

	// Submission is mature or not.
	IsMature bool `url:"is_mature,omitempty"`

	// Allow comments on the submission.
	AllowComments bool `url:"allow_comments,omitempty"`

	// License options.
	LicenseOptions LicenseOptions `url:"license_options,omitempty"`
}

type UpdateLiteratureParams

type UpdateLiteratureParams struct {
	// Literature title.
	Title string `url:"title"`

	// Literature tags.
	Tags []string `url:"tags,brackets,omitempty"`

	// UUIDs of gallery folders to publish this submission to.
	GalleryIDs []uuid.UUID `url:"galleryids,omitempty"`

	// Submission is mature or not.
	IsMature bool `url:"is_mature"`

	// The mature level of the submission, required for mature submissions.
	MatureLevel string `url:"mature_level,omitempty"`

	// The mature classification of the submission.
	MatureClassification []string `url:"mature_classification,brackets,omitempty"`

	// Allow comments on the submission
	AllowComments bool `url:"allow_comments,omitempty"`

	// License options.
	LicenseOptions []LicenseOptions `url:"license_options"`
}

type UpdateOrderParams

type UpdateOrderParams struct {
	// The UUID of the folder to reposition.
	FolderID uuid.UUID `url:"folderid"`

	// The new position.
	Position int `url:"position"`
}

type User

type User struct {
	UserID       uuid.UUID `json:"userid"`
	UserName     string    `json:"username"`
	UserIcon     string    `json:"usericon"`
	Type         string    `json:"type"`
	IsWatching   bool      `json:"is_watching,omitempty"`
	IsSubscribed bool      `json:"is_subscribed,omitempty"`
	Details      struct {
		Sex      string `json:"sex,omitempty"`
		Age      uint8  `json:"age,omitempty"`
		JoinDate string `json:"joindate"`
	} `json:"details,omitempty"`
	Geo struct {
		Country   string `json:"country"`
		CountryID uint8  `json:"countryid"`
		Timezone  string `json:"timezone"`
	} `json:"get,omitempty"`
	Profile struct {
		UserIsArtist     bool   `json:"user_is_artist"`
		ArtistLevel      string `json:"artist_level,omitempty"`
		ArtistSpeciality string `json:"artist_speciality,omitempty"`
		RealName         string `json:"real_name"`
		Tagline          string `json:"tagline"`
		Website          string `json:"website"`
		CoverPhoto       string `json:"cover_photo"`
	} `json:"profile,omitempty"`
	Stats struct {
		Watchers int32 `json:"watchers"`
		Friends  int32 `json:"friends"`
	} `json:"stats,omitempty"`
	Sidebar struct {
		Watched struct {
			HasNewContent bool `json:"has_new_content"`
			LinkSubnav    struct {
				ContentType string `json:"content_type"`
			} `json:"link_subnav"`
			IsPinned bool `json:"is_pinned"`
		} `json:"watched,omitempty"`
	} `json:"sidebar,omitempty"`
}

type UserInfoParams

type UserInfoParams struct {
	// Is the user an artist?
	UserIsArtist bool `url:"user_is_artist,omitempty"`

	// If the user is an artist, what level are they.
	ArtistLevel string `url:"artist_level,omitempty"`

	// If the user is an artist, what is their specialty.
	ArtistSpeciality string `url:"artist_specialty,omitempty"`

	// The users location.
	CountryID int `url:"countryid,omitempty"`

	// The users personal website.
	Website      string `url:"website,omitempty"`
	WebsiteLabel string `url:"website_label,omitempty"`

	// The users tagline.
	Tagline string `url:"tagline,omitempty"`

	ShowBadges  bool     `url:"show_badges,omitempty"`
	Interests   []string `url:"interests,omitempty"`    // TODO: Check positional params.
	SocialLinks []string `url:"social_links,omitempty"` // TODO: Check positional params.
}

type UserJournalsParams

type UserJournalsParams struct {
	// The username of the user to fetch journals for.
	Username string `url:"username"`

	// Fetch only featured or not.
	Featured bool `url:"featured,omitempty"`
}

type UserService

type UserService struct {
	Friends *friendsService
	// contains filtered or unexported fields
}

func (*UserService) DAmnToken

func (s *UserService) DAmnToken() (string, error)

DAmnToken retrieves the dAmn auth token required to connect to the dAmn servers.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • user

func (*UserService) PostStatus

func (s *UserService) PostStatus(params *PostStatusParams) (uuid.UUID, error)

PostStatus postes a status.

When posting a status, it is possible to share another status or deviation along with the status text. To do so, pass UUID of an object being shared (status or deviation) in `id` parameter. Note that it is not possible to share a status which already shares something. Sometimes the object you want to share is contained within the status. To share such object pass UUID of the containing status in `parentid` parameter (in addition to the `id`).

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse
  • user.manage

func (*UserService) Posts

func (s *UserService) Posts(username string, page *CursorParams) (CursorResponse[Deviation], error)

Posts returns all journals & status updates for a given user in a single feed.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

func (*UserService) Profile

func (s *UserService) Profile(username string, params *GetProfileParams) (Profile, error)

Profile gets user profile information.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

func (*UserService) Status

func (s *UserService) Status(statusID uuid.UUID) (Status, error)

Status fetches the status.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

func (*UserService) Statuses

func (s *UserService) Statuses(username string, page *OffsetParams) (OffsetResponse[Status], error)

Statuses fetches user statuses.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

func (*UserService) Tiers

func (s *UserService) Tiers(username string) ([]Deviation, error)

Tiers fetches users tiers.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • user

TODO: Scope is missing in docs.

func (*UserService) UpdateProfile

func (s *UserService) UpdateProfile(params *UserInfoParams) (bool, error)

UpdateProfile updates the users profile information.

Check Countries to get a list of countries and their IDs.

func (*UserService) Watchers

func (s *UserService) Watchers(username string, page *OffsetParams) (OffsetResponse[Friend], error)

Watchers gets the user's list of watchers.

To connect to this endpoint OAuth2 Access Token from the Client Credentials Grant, or Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

func (*UserService) Whoami

func (s *UserService) Whoami() (User, error)

Whoami fetches user info of authenticated user.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • user

func (*UserService) Whois

func (s *UserService) Whois(usernames ...string) ([]User, error)

Whois fetches user info for given usernames.

To connect to this endpoint OAuth2 Access Token from the Authorization Code Grant is required.

The following scopes are required to access this resource:

  • browse

type UserWatch

type UserWatch struct {
	Friend       bool `json:"friend" url:"friend"`
	Deviations   bool `json:"deviations" url:"deviations"`
	Journals     bool `json:"journals" url:"journals"`
	ForumThreads bool `json:"forum_threads" url:"forum_threads"`
	Critiques    bool `json:"critiques" url:"critiques"`
	Scraps       bool `json:"scraps" url:"scraps"`
	Activity     bool `json:"activity" url:"activity"`
	Collections  bool `json:"collections" url:"collections"`
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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