api

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorApiKeyMissing = errors.New("API_KEY is missing")
	ErrorIDMissing     = errors.New("id is missing")
)

Functions

func GetApiKey

func GetApiKey() string

func RetrieveAdminConfig

func RetrieveAdminConfig(ctx context.Context)

RetrieveAdminConfig for now will not implement this one

func SetApiKeyHeader

func SetApiKeyHeader(req *http.Request) error

func UpdateAdminConfig

func UpdateAdminConfig(ctx context.Context)

UpdateAdminConfig for now will not implement this one

Types

type ArticleCreate

type ArticleCreate struct {
	Article *ArticleCreateType `json:"article"`
}

ArticleCreate ...

type ArticleCreateType

type ArticleCreateType struct {
	Title          string   `json:"title"`
	BodyMarkdown   string   `json:"body_markdown"`
	Published      bool     `json:"published"`
	Series         string   `json:"series"`
	MainImage      string   `json:"main_image"`
	CanonicalURL   string   `json:"canonical_url"`
	Description    string   `json:"description"`
	Tags           []string `json:"tags"`
	OrganizationID int32    `json:"organization_id"`
}

ArticleCreateType ...

type ArticleEdit

type ArticleEdit struct {
	Article *ArticleEditType `json:"article"`
}

ArticleEdit ...

type ArticleEditType

type ArticleEditType struct {
	Title          string `json:"title"`
	BodyMarkdown   string `json:"body_markdown"`
	Published      bool   `json:"published"`
	Series         string `json:"series"`
	MainImage      string `json:"main_image"`
	CanonicalURL   string `json:"canonical_url"`
	Description    string `json:"description"`
	Tags           string `json:"tags"`
	OrganizationID int32  `json:"organization_id"`
}

ArticleEditType ...

type ArticleMeResponse

type ArticleMeResponse struct {
	TypeOf                 string            `json:"type_of"`
	ID                     int32             `json:"id"`
	Title                  string            `json:"title"`
	Description            string            `json:"description"`
	CoverImage             string            `json:"cover_image"`
	PublishedAt            string            `json:"published_at"`
	Published              bool              `json:"published"`
	TagList                []string          `json:"tag_list"`
	Slug                   string            `json:"slug"`
	Path                   string            `json:"path"`
	URL                    string            `json:"url"`
	CanonicalURL           string            `json:"canonical_url"`
	CommentsCount          int32             `json:"comments_count"`
	PositiveReactionsCount int32             `json:"positive_reactions_count"`
	PublicReactionsCount   int32             `json:"public_reactions_count"`
	PageViewsCount         int32             `json:"page_views_count"`
	PublishedTimestamp     string            `json:"published_timestamp"`
	BodyMarkdown           string            `json:"body_markdown"`
	User                   *UserType         `json:"user"`
	ReadingTimeMinutes     int32             `json:"reading_time_minutes"`
	Organization           *OrganizationType `json:"organization"`
	FlareTag               *FlareTagType     `json:"flare_tag"`
}

ArticleMeResponse ...

type ArticleResponse

type ArticleResponse struct {
	TypeOf                 string            `json:"type_of"`
	ID                     int32             `json:"id"`
	Title                  string            `json:"title"`
	Description            string            `json:"description"`
	CoverImage             string            `json:"cover_image"`
	ReadablePublishDate    string            `json:"readable_publish_date"`
	SocialImage            string            `json:"social_image"`
	TagList                []string          `json:"tag_list"`
	Tags                   string            `json:"tags"`
	Slug                   string            `json:"slug"`
	Path                   string            `json:"path"`
	URL                    string            `json:"url"`
	CanonicalURL           string            `json:"canonical_url"`
	CommentsCount          int32             `json:"comments_count"`
	PositiveReactionsCount int32             `json:"positive_reactions_count"`
	PublicReactionsCount   int32             `json:"public_reactions_count"`
	CreatedAt              string            `json:"created_at"`
	EditedAt               string            `json:"edited_at"`
	CrosspostedAt          string            `json:"crossposted_at"`
	PublishedAt            string            `json:"published_at"`
	LastCommentAt          string            `json:"last_comment_at"`
	PublishedTimestamp     string            `json:"published_timestamp"`
	BodyHtml               string            `json:"body_html"`
	BodyMarkdown           string            `json:"body_markdown"`
	User                   *UserType         `json:"user"`
	ReadingTimeMinutes     int32             `json:"reading_time_minutes"`
	Organization           *OrganizationType `json:"organization"`
	FlareTag               *FlareTagType     `json:"flare_tag"`
}

ArticleResponse ...

type ArticleVideoResponse

type ArticleVideoResponse struct {
	TypeOf                 string    `json:"type_of"`
	ID                     int32     `json:"id"`
	Path                   string    `json:"path"`
	CloudinaryVideoURL     string    `json:"cloudinary_video_url"`
	Title                  string    `json:"title"`
	VideoDurationInMinutes string    `json:"video_duration_in_minutes"`
	VideoSourceURL         string    `json:"video_source_url"`
	User                   *UserType `json:"user"`
}

ArticleVideoResponse ...

type ArticlesVideoResponse

type ArticlesVideoResponse []*ArticleVideoResponse

ArticlesVideoResponse ...

func RetrieveArticlesVideo

func RetrieveArticlesVideo(ctx context.Context, id string) (*ArticlesVideoResponse, error)

RetrieveArticlesVideo returns the articles with videos API PATH: /videos Method: GET

type CommentQuery

type CommentQuery struct {
	AID int32 `json:"a_id"`
	PID int32 `json:"p_id"`
}

CommentQuery ...

type CommentType

type CommentType struct {
	TypeOf    string         `json:"type_of"`
	IDCode    string         `json:"id_code"`
	CreatedAt string         `json:"created_at"`
	BodyHtml  string         `json:"body_html"`
	User      *UserType      `json:"user"`
	Children  []*CommentType `json:"children"`
}

CommentResponse ...

func RetrieveComment

func RetrieveComment(ctx context.Context, id string) (*CommentType, error)

RetrieveComment returns the comment API PATH: /comments/{id} Method: GET

type CommentsResponse

type CommentsResponse []*CommentType

CommentsResponse ...

func RetrieveComments

func RetrieveComments(ctx context.Context, queries *CommentQuery) (*CommentsResponse, error)

RetrieveComments returns the comments of a given article or podcast API PATH: /comments?a_id=<id> or /comments?p_id=<id> Method: GET

type CommonQuery

type CommonQuery struct {
	Page    int32 `json:"page"`
	PerPage int32 `json:"per_page"`
}

CommonQuery ...

type ErrorResponse

type ErrorResponse struct {
	Error  string `json:"error"`
	Status int32  `json:"status"`
}

type FlareTagType

type FlareTagType struct {
	Name         string `json:"name"`
	BgColorHex   string `json:"bg_color_hex"`
	TextColorHex string `json:"text_color_hex"`
}

type FollowTagsResponse

type FollowTagsResponse []*FollowsTagType

FollowTagsResponse ...

func RetrieveTagsIFollow

func RetrieveTagsIFollow(ctx context.Context) (*FollowTagsResponse, error)

RetrieveTagsIFollow returns the tags that I follow API PATH: /follows/tags Method: GET

type FollowerType

type FollowerType struct {
	TypeOf    string `json:"type_of"`
	CreatedAt string `json:"created_at"`
	ID        int32  `json:"id"`
	Name      string `json:"name"`
	Path      string `json:"path"`
	Username  string `json:"username"`
	//image 60x60
	ProfileImage string `json:"profile_image"`
}

FollowerType ...

type FollowersQuery

type FollowersQuery struct {
	Page    int32  `json:"page"`
	PerPage int32  `json:"per_page"`
	Sort    string `json:"sort"`
}

FollowersQuery ...

type FollowersResponse

type FollowersResponse []*FollowerType

FollowersResponse ...

func RetrieveFollowers

func RetrieveFollowers(ctx context.Context, query *FollowersQuery) (*FollowersResponse, error)

RetrieveFollowers returns my followers API PATH: /followers/users Method: GET

type FollowsTagType

type FollowsTagType struct {
	ID     int64   `json:"id"`
	Name   string  `json:"name"`
	Points float64 `json:"points"`
}

FollowTagType ...

type GetArticleQuery

type GetArticleQuery struct {
	Page         int32  `json:"page"`
	PerPage      int32  `json:"per_page"`
	Tag          string `json:"tag"`
	Tags         string `json:"tags"`
	TagsExclude  string `json:"tags_exclude"`
	Username     string `json:"username"`
	State        string `json:"state"`
	Top          int32  `json:"top"`
	CollectionID int32  `json:"collection_id"`
}

GetArticleQuery store the queries provided by the user on a Get articles

type GetArticlesMeResponse

type GetArticlesMeResponse []*ArticleMeResponse

GetArticlesMeResponse ...

func RetrieveMeArticles

func RetrieveMeArticles(ctx context.Context, queries *CommonQuery, pathToAdd string) (*GetArticlesMeResponse, error)

RetrieveMeArticles returns the articles of the authenticated user API PATHs: * /articles/me * /articles/me/published, * /articles/me/unpublished * /articles/me/all Method: GET

type GetArticlesResponse

type GetArticlesResponse []*ArticleResponse

GetArticlesResponse

func RetrieveArticles

func RetrieveArticles(ctx context.Context, username string, queries *GetArticleQuery) (*GetArticlesResponse, error)

RetrieveArticles returns the articles of a given username API PATH: /articles Method: GET

func RetrieveArticlesOnOrganization

func RetrieveArticlesOnOrganization(ctx context.Context, username string, queries *CommonQuery) (*GetArticlesResponse, error)

RetrieveArticlesOnOrganization returns list of articles belonging a given organization API PATH: /organizations/{username}/articles Method: GET

func RetrieveLatestArticles

func RetrieveLatestArticles(ctx context.Context, queries *CommonQuery) (*GetArticlesResponse, error)

RetrieveLatestArticles returns latest articles API PATH: /articles/latest Method: GET

type GetLatestArticleQuery

type GetLatestArticleQuery CommonQuery

GetLatestArticleQuery store the queries provided by the user on a Get latest articles

type ListingCreate

type ListingCreate struct {
	Listing *ListingCreateType `json:"listing"`
}

ListingCreate ...

type ListingCreateType

type ListingCreateType struct {
	Title               string   `json:"title"`
	BodyMarkdown        string   `json:"body_markdown"`
	Category            string   `json:"category"`
	TagList             string   `json:"tag_list"`
	Tags                []string `json:"tags"`
	ExpiresAt           string   `json:"expires_at"`
	Contact_via_connect bool     `json:"contact_via_connect"`
	Location            string   `json:"location"`
	OrganizationID      int64    `json:"organization_id"`
	Action              string   `json:"action"`
}

ListingCreateType ...

type ListingQuery

type ListingQuery struct {
	Page     int32  `json:"page"`
	PerPage  int32  `json:"per_page"`
	Category string `json:"category"`
}

ListingQuery ...

type ListingResponse

type ListingResponse []*ListingType

ListingResponse ...

func RetrieveListingOnOrganization

func RetrieveListingOnOrganization(ctx context.Context, username string, queries *OrganizationListingQuery) (*ListingResponse, error)

RetrieveListingOnOrganization returns list of listings on a given organization API PATH: /organizations/{username}/listings Method: GET

func RetrieveListings

func RetrieveListings(ctx context.Context, queries *ListingQuery) (*ListingResponse, error)

RetrieveListings returns the published listings API PATH: /listings Method: GET

func RetrieveListingsByID

func RetrieveListingsByID(ctx context.Context, id string) (*ListingResponse, error)

RetrieveListingByID returns a listing by id API PATH: /listings/{id} Method: GET

type ListingType

type ListingType struct {
	TypeOf        string            `json:"type_of"`
	ID            int64             `json:"id"`
	Title         string            `json:"title"`
	Slug          string            `json:"slug"`
	BodyMarkdown  string            `json:"body_markdown"`
	TagList       string            `json:"tag_list"`
	Tags          []string          `json:"tags"`
	Category      string            `json:"category"`
	ProcessedHtml string            `json:"precessed_html"`
	Published     bool              `json:"published"`
	User          *UserType         `json:"user"`
	Organization  *OrganizationType `json:"organization"`
}

ListingType ...

func CreateListing

func CreateListing(ctx context.Context, listing *ListingCreate) (*ListingType, error)

CreateListing create a new listing API PATH: /listings Method: POST

type ListingUpdate

type ListingUpdate struct {
	Listing *ListingUpdateType `json:"listing"`
}

ListingUpdate ...

type ListingUpdateType

type ListingUpdateType struct {
	Title               string   `json:"title"`
	BodyMarkdown        string   `json:"body_markdown"`
	Category            string   `json:"category"`
	TagList             []string `json:"tag_list"`
	Tags                string   `json:"tags"`
	ExpiresAt           string   `json:"expires_at"`
	Contact_via_connect bool     `json:"contact_via_connect"`
	Location            string   `json:"location"`
	Action              string   `json:"action"`
}

ListingUpdateType ...

type ModifiedArticle

type ModifiedArticle struct {
	TypeOf                 string            `json:"type_of"`
	ID                     int32             `json:"id"`
	Title                  string            `json:"title"`
	Description            string            `json:"description"`
	CoverImage             string            `json:"cover_image"`
	ReadablePublishDate    string            `json:"readable_publish_date"`
	SocialImage            string            `json:"social_image"`
	TagList                string            `json:"tag_list"`
	Tags                   []string          `json:"tags"`
	Slug                   string            `json:"slug"`
	Path                   string            `json:"path"`
	URL                    string            `json:"url"`
	CanonicalURL           string            `json:"canonical_url"`
	CommentsCount          int32             `json:"comments_count"`
	PositiveReactionsCount int32             `json:"positive_reactions_count"`
	PublicReactionsCount   int32             `json:"public_reactions_count"`
	CreatedAt              string            `json:"created_at"`
	EditedAt               string            `json:"edited_at"`
	CrosspostedAt          string            `json:"crossposted_at"`
	PublishedAt            string            `json:"published_at"`
	LastCommentAt          string            `json:"last_comment_at"`
	PublishedTimestamp     string            `json:"published_timestamp"`
	BodyHtml               string            `json:"body_html"`
	BodyMarkdown           string            `json:"body_markdown"`
	User                   *UserType         `json:"user"`
	ReadingTimeMinutes     int32             `json:"reading_time_minutes"`
	Organization           *OrganizationType `json:"organization"`
	FlareTag               *FlareTagType     `json:"flare_tag"`
}

ModifiedArticle include the response from an Update or Create article

func CreateArticle

func CreateArticle(ctx context.Context, article *ArticleCreate) (*ModifiedArticle, error)

CreateArticle create a new article API PATH: /articles Method: POST

func RetrieveArticleByID

func RetrieveArticleByID(ctx context.Context, id string) (*ModifiedArticle, error)

RetrieveArticleByID returns the article API PATH: /articles/{id} Method: GET

func UpdateArticle

func UpdateArticle(ctx context.Context, id string, article *ArticleEdit) (*ModifiedArticle, error)

UpdateArticle update an specified article API PATH: /articles/{id} Method: PUT

func UpdateListing

func UpdateListing(ctx context.Context, id string, listing *ListingUpdate) (*ModifiedArticle, error)

UpdateListing update a listing API PATH: /listings/{id} Method: PUT

type OrganizationListingQuery

type OrganizationListingQuery struct {
	Page     int32  `json:"page"`
	PerPage  int32  `json:"per_page"`
	Category string `json:"category"`
}

OrganizationListingQuery ...

type OrganizationQuery

type OrganizationQuery CommonQuery

OrganizationQuery ...

type OrganizationResponse

type OrganizationResponse struct {
	TypeOf          string `json:"type_of"`
	Username        string `json:"username"`
	Name            string `json:"name"`
	Summarry        string `json:"summary"`
	TwitterUsername string `json:"twitter_username"`
	GithubUsername  string `json:"github_username"`
	URL             string `json:"url"`
	Location        string `json:"location"`
	TechStack       string `json:"tech_stack"`
	TagLine         string `json:"tag_line"`
	Story           string `json:"story"`
	JoinedAt        string `json:"joined_at"`
	//Image 640x640
	ProfileImage string `json:"profile_image"`
}

OrganizationResponse ...

func RetrieveOrganizationByUsername

func RetrieveOrganizationByUsername(ctx context.Context, username string) (*OrganizationResponse, error)

RetrieveOrganizationByUsername returns an organization by its username API PATH: /organizations/{username} Method: GET

type OrganizationType

type OrganizationType struct {
	Name     string `json:"name"`
	Username string `json:"username"`
	Slug     string `json:"slug"`
	//Image 640x640
	ProfileImage string `json:"profile_image"`
	//Image 90x90
	ProfileImage90 string `json:"profile_image_90"`
}

Organization ...

type PodcastEpisodesQuery

type PodcastEpisodesQuery struct {
	Page     int32  `json:"page"`
	PerPage  int32  `json:"per_page"`
	Username string `json:"username"`
}

PodcastEpisodesQuery ...

type PodcastResponse

type PodcastResponse []*PodcastTypeResponse

PodcastResponse ...

func RetrievePodcastEpisodes

func RetrievePodcastEpisodes(ctx context.Context, queries *PodcastEpisodesQuery) (*PodcastResponse, error)

RetrievePodcastEpisodes returns the podcast episodes API PATH: /podcast_episodes Method: GET

type PodcastType

type PodcastType struct {
	Title    string `json:"title"`
	Slug     string `json:"slug"`
	ImageURL string `json:"image_url"`
}

PodcastType ...

type PodcastTypeResponse

type PodcastTypeResponse struct {
	TypeOf   string       `json:"type_of"`
	ID       int32        `json:"id"`
	Path     string       `json:"path"`
	ImageURL string       `json:"image_url"`
	Title    string       `json:"title"`
	Podcast  *PodcastType `json:"podcast"`
}

PodcastTypeResponse ...

type ProfileImageResponse

type ProfileImageResponse struct {
	TypeOf  string `json:"type_of"`
	ImageOf string `json:"image_of"`
	//640x640
	ProfileImage string `json:"profile_image"`
	//90x90
	ProfileImage90 string `json:"profile_image_90"`
}

ProfileImageResponse ...

func RetrieveProfileImage

func RetrieveProfileImage(ctx context.Context, username string) (*ProfileImageResponse, error)

RetrieveProfileImage retrieve a user or organization profile image information by its corresponding username API PATH: /profile_images Method: GET

type ReadingListQuery

type ReadingListQuery CommonQuery

ReadingListQuery ...

type ReadingListResponse

type ReadingListResponse []*ReadingListType

ReadingListResponse ...

func RetrieveReadingList

func RetrieveReadingList(ctx context.Context, queries *CommonQuery) (*ReadingListResponse, error)

RetrieveReadingList returns he client to retrieve a list of readinglist reactions along with the related article for the authenticated user. API PATH: /readinglist Method: GET

type ReadingListType

type ReadingListType struct {
	TypeOf    string           `json:"type_of"`
	ID        int32            `json:"id"`
	Status    string           `json:"status"`
	CreatedAt string           `json:"created_at"`
	Article   *ArticleResponse `json:"article"`
}

ReadingListType ...

type TagType

type TagType struct {
	ID           int64  `json:"id"`
	Name         string `json:"name"`
	BgColorHex   string `json:"bg_color_hex"`
	TextColorHex string `json:"text_color_hex"`
}

TagType ...

type TagsQuery

type TagsQuery CommonQuery

TagsQuery ...

type TagsResponse

type TagsResponse []*TagType

TagsResponse ...

func RetrieveTags

func RetrieveTags(ctx context.Context, queries *CommonQuery) (*TagsResponse, error)

RetrieveTags returns all available tags API PATH: /tags Method: GET

type UserOnOrganizationResponse

type UserOnOrganizationResponse []*UserOrganizationType

UserOnOrganizationResponse ...

func RetrieveUsersOnOrganization

func RetrieveUsersOnOrganization(ctx context.Context, username string, queries *CommonQuery) (*UserOnOrganizationResponse, error)

RetrieveUsersOnOrganization returns list of users on a given organization API PATH: /organizations/{username}/users Method: GET

type UserOrganizationType

type UserOrganizationType struct {
	TypeOf          string `json:"type_of"`
	ID              int32  `json:"id"`
	Username        string `json:"username"`
	Name            string `json:"name"`
	Summary         string `json:"summary"`
	TwitterUsername string `json:"twitter_username"`
	GithubUsername  string `json:"github_username"`
	WebsiteURL      string `json:"website_url"`
	Location        string `json:"location"`
	JoinedAt        string `json:"joined_at"`
	//Image 320x320
	ProfileImage string `json:"profile_image"`
}

UserOrganizationType ...

type UserType

type UserType struct {
	Name            string `json:"name"`
	Username        string `json:"username"`
	TwitterUsername string `json:"twitter_username"`
	GithubUsername  string `json:"github_username"`
	WebsiteURL      string `json:"website_url"`

	//Image 640x640
	ProfileImage string `json:"profile_image"`
	//Image 90x90
	ProfileImage90 string `json:"profile_image_90"`
}

User ...

type WebhookCreatedResponse

type WebhookCreatedResponse WebhookTypeBasic

WebhookCreatedResponse...

func CreateWebhook

func CreateWebhook(ctx context.Context, listing *WebhooksCreateType) (*WebhookCreatedResponse, error)

CreateWebhook create a new webhook API PATH: /webhooks Method: POST

type WebhookDataCreate

type WebhookDataCreate struct {
	Source    string   `json:"source"`
	TargetURL string   `json:"target_url"`
	Events    []string `json:"events"`
}

WebhookDataCreate ...

type WebhookTypeBasic

type WebhookTypeBasic struct {
	TypeOf    string    `json:"type_of"`
	ID        int64     `json:"id"`
	Source    string    `json:"source"`
	TargetURL string    `json:"target_url"`
	Events    string    `json:"events"`
	CreatedAt string    `json:"created_at"`
	User      *UserType `json:"user"`
}

WebhookTypeBasic ...

func DeleteWebhook

func DeleteWebhook(ctx context.Context, id string) (*WebhookTypeBasic, error)

DeleteWebhook delete a webhook by id API PATH: /webhook/{id} Method: DELETE

func RetrieveWebhookByID

func RetrieveWebhookByID(ctx context.Context, id string) (*WebhookTypeBasic, error)

RetrieveWebhookByID returns a webhook by id API PATH: /webhook/{id} Method: GET

type WebhooksCreateType

type WebhooksCreateType struct {
	WebhookEndpoint *WebhookDataCreate `json:"webhook_endpoint"`
}

WebhooksCreateType ...

type WebhooksResponse

type WebhooksResponse []*WebhooksType

WebhooksResponse ...

func RetrieveWebhooks

func RetrieveWebhooks(ctx context.Context) (*WebhooksResponse, error)

RetrieveWebhooks list of webhooks they have previously registered. API PATH: /webhooks Method: GET

type WebhooksType

type WebhooksType struct {
	TypeOf    string `json:"type_of"`
	ID        int64  `json:"id"`
	Source    string `json:"source"`
	TargetURL string `json:"target_url"`
	Events    string `json:"events"`
	CreatedAt string `json:"created_at"`
}

WebhooksType ...

Jump to

Keyboard shortcuts

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