devto

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: MIT Imports: 23 Imported by: 0

README

Go API client for devto

Access DEV articles, comments and other resources via API

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 0.5.9
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://dev.to/contact

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
go get github.com/antihax/optional

Put the package under your project folder and add the following in import:

import "./devto"

Documentation for API Endpoints

All URIs are relative to https://dev.to/api

Class Method HTTP request Description
ArticlesApi CreateArticle Post /articles Create a new article
ArticlesApi GetArticleById Get /articles/{id} A published article
ArticlesApi GetArticles Get /articles Published articles
ArticlesApi GetUserAllArticles Get /articles/me/all User's all articles
ArticlesApi GetUserArticles Get /articles/me User's articles
ArticlesApi GetUserPublishedArticles Get /articles/me/published User's published articles
ArticlesApi GetUserUnpublishedArticles Get /articles/me/unpublished User's unpublished articles
ArticlesApi UpdateArticle Put /articles/{id} Update an article
UsersApi GetUserAllArticles Get /articles/me/all User's all articles
UsersApi GetUserArticles Get /articles/me User's articles
UsersApi GetUserPublishedArticles Get /articles/me/published User's published articles
UsersApi GetUserUnpublishedArticles Get /articles/me/unpublished User's unpublished articles
WebhooksApi CreateWebhook Post /webhooks Create a new webhook
WebhooksApi DeleteWebhook Delete /webhooks/{id} A webhook endpoint
WebhooksApi GetWebhookById Get /webhooks/{id} A webhook endpoint
WebhooksApi GetWebhooks Get /webhooks Webhooks

Documentation For Models

Documentation For Authorization

api_key

  • Type: API key

Example

auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
    Key: "APIKEY",
    Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)

oauth2

  • Type: OAuth
  • Flow: application
  • Authorization URL:
  • Scopes: N/A

Example

auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)

Or via OAuth2 module to automatically refresh tokens and perform user authentication.

import "golang.org/x/oauth2"

/* Perform OAuth2 round trip request and obtain a token */

tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)

Author

yo@dev.to

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
	ContextOAuth2 = contextKey("token")

	// ContextBasicAuth takes BasicAuth as authentication for the request.
	ContextBasicAuth = contextKey("basic")

	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
	ContextAccessToken = contextKey("accesstoken")

	// ContextAPIKey takes an APIKey as authentication for the request
	ContextAPIKey = contextKey("apikey")
)

Functions

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

Types

type APIClient

type APIClient struct {
	ArticlesApi *ArticlesApiService

	UsersApi *UsersApiService

	WebhooksApi *WebhooksApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the DEV API (beta) API v0.5.9 In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *Configuration) *APIClient

NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.

func (*APIClient) ChangeBasePath

func (c *APIClient) ChangeBasePath(path string)

ChangeBasePath changes base path to allow switching to mocks

func (*APIClient) GetConfig

func (c *APIClient) GetConfig() *Configuration

Allow modification of underlying config for alternate implementations and testing Caution: modifying the configuration while live can cause data races and potentially unwanted behavior

type APIKey

type APIKey struct {
	Key    string
	Prefix string
}

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

type APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the OpenAPI operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

APIResponse stores the API response returned by the server.

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

NewAPIResponse returns a new APIResonse object.

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

NewAPIResponseWithError returns a new APIResponse object with the provided error message.

type ApiError

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

ApiError struct for ApiError

type ArticleCreate

type ArticleCreate struct {
	Article ArticleCreateArticle `json:"article,omitempty"`
}

ArticleCreate struct for ArticleCreate

type ArticleCreateArticle

type ArticleCreateArticle struct {
	Title string `json:"title"`
	// The body of the article.  It can contain an optional front matter. For example  “`markdown --- title: Hello, World! published: true tags: discuss, help date: 20190701T10:00Z series: Hello series canonical_url: https://example.com/blog/hello cover_image: article_published_cover_image --- “`  `date`, `series` and `canonical_url` are optional. `date` is the publication date-time `series` is the name of the series the article belongs to `canonical_url` is the canonical URL of the article `cover_image` is the main image of the article  *If the markdown contains a front matter, it will take precedence on the equivalent params given in the JSON payload.*
	BodyMarkdown string `json:"body_markdown,omitempty"`
	// True to create a published article, false otherwise. Defaults to false
	Published bool `json:"published,omitempty"`
	// Article series name.  All articles belonging to the same series need to have the same name in this parameter.
	Series       string   `json:"series,omitempty"`
	MainImage    string   `json:"main_image,omitempty"`
	CanonicalUrl string   `json:"canonical_url,omitempty"`
	Description  string   `json:"description,omitempty"`
	Tags         []string `json:"tags,omitempty"`
	// Only users belonging to an organization can assign the article to it
	OrganizationId int32 `json:"organization_id,omitempty"`
}

ArticleCreateArticle struct for ArticleCreateArticle

type ArticleFlareTag

type ArticleFlareTag struct {
	Name string `json:"name,omitempty"`
	// Background color (hexadecimal)
	BgColorHex string `json:"bg_color_hex,omitempty"`
	// Text color (hexadecimal)
	TextColorHex string `json:"text_color_hex,omitempty"`
}

ArticleFlareTag Flare tag of the article

type ArticleIndex

type ArticleIndex 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"`
	CreatedAt              time.Time `json:"created_at"`
	EditedAt               time.Time `json:"edited_at"`
	CrosspostedAt          time.Time `json:"crossposted_at"`
	PublishedAt            time.Time `json:"published_at"`
	LastCommentAt          time.Time `json:"last_comment_at"`
	// Crossposting or published date time
	PublishedTimestamp time.Time           `json:"published_timestamp"`
	User               ArticleUser         `json:"user"`
	Organization       ArticleOrganization `json:"organization,omitempty"`
	FlareTag           ArticleFlareTag     `json:"flare_tag,omitempty"`
}

ArticleIndex struct for ArticleIndex

type ArticleMe

type ArticleMe struct {
	TypeOf                 string   `json:"type_of"`
	Id                     int32    `json:"id"`
	Title                  string   `json:"title"`
	Description            string   `json:"description"`
	CoverImage             string   `json:"cover_image"`
	Published              bool     `json:"published"`
	PublishedAt            string   `json:"published_at,omitempty"`
	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"`
	PageViewsCount         int32    `json:"page_views_count"`
	// Crossposting or published date time
	PublishedTimestamp string              `json:"published_timestamp,omitempty"`
	User               ArticleUser         `json:"user"`
	Organization       ArticleOrganization `json:"organization,omitempty"`
	FlareTag           ArticleFlareTag     `json:"flare_tag,omitempty"`
}

ArticleMe struct for ArticleMe

type ArticleOrganization

type ArticleOrganization struct {
	Name     string `json:"name,omitempty"`
	Username string `json:"username,omitempty"`
	Slug     string `json:"slug,omitempty"`
	// Profile image (640x640)
	ProfileImage string `json:"profile_image,omitempty"`
	// Profile image (90x90)
	ProfileImage90 string `json:"profile_image_90,omitempty"`
}

ArticleOrganization The organization the article belongs to

type ArticleShow

type ArticleShow 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"`
	CreatedAt              time.Time `json:"created_at"`
	EditedAt               time.Time `json:"edited_at"`
	CrosspostedAt          time.Time `json:"crossposted_at"`
	PublishedAt            string    `json:"published_at"`
	LastCommentAt          time.Time `json:"last_comment_at"`
	// Crossposting or published date time
	PublishedTimestamp string              `json:"published_timestamp"`
	BodyHtml           string              `json:"body_html"`
	BodyMarkdown       string              `json:"body_markdown"`
	User               ArticleUser         `json:"user"`
	Organization       ArticleOrganization `json:"organization,omitempty"`
	FlareTag           ArticleFlareTag     `json:"flare_tag,omitempty"`
}

ArticleShow struct for ArticleShow

type ArticleUpdate

type ArticleUpdate struct {
	Article ArticleUpdateArticle `json:"article,omitempty"`
}

ArticleUpdate struct for ArticleUpdate

type ArticleUpdateArticle

type ArticleUpdateArticle struct {
	Title string `json:"title,omitempty"`
	// The body of the article.  It can contain an optional front matter. For example  “`markdown --- title: Hello, World! published: true tags: discuss, help date: 20190701T10:00Z series: Hello series canonical_url: https://example.com/blog/hello cover_image: article_published_cover_image --- “`  `date`, `series` and `canonical_url` are optional. `date` is the publication date-time `series` is the name of the series the article belongs to `canonical_url` is the canonical URL of the article `cover_image` is the main image of the article  *If the markdown contains a front matter, it will take precedence on the equivalent params given in the JSON payload.*
	BodyMarkdown string `json:"body_markdown,omitempty"`
	// True to create a published article, false otherwise. Defaults to false
	Published bool `json:"published,omitempty"`
	// Article series name.  All articles belonging to the same series need to have the same name in this parameter.  To remove an article from a series, the `null` value can be used.
	Series       string   `json:"series,omitempty"`
	MainImage    string   `json:"main_image,omitempty"`
	CanonicalUrl string   `json:"canonical_url,omitempty"`
	Description  string   `json:"description,omitempty"`
	Tags         []string `json:"tags,omitempty"`
	// Only users belonging to an organization can assign the article to it
	OrganizationId int32 `json:"organization_id,omitempty"`
}

ArticleUpdateArticle struct for ArticleUpdateArticle

type ArticleUser

type ArticleUser struct {
	Name            string `json:"name,omitempty"`
	Username        string `json:"username,omitempty"`
	TwitterUsername string `json:"twitter_username,omitempty"`
	GithubUsername  string `json:"github_username,omitempty"`
	WebsiteUrl      string `json:"website_url,omitempty"`
	// Profile image (640x640)
	ProfileImage string `json:"profile_image,omitempty"`
	// Profile image (90x90)
	ProfileImage90 string `json:"profile_image_90,omitempty"`
}

ArticleUser The article's creator

type ArticlesApiCreateArticleOpts

type ArticlesApiCreateArticleOpts struct {
	ArticleCreate optional.Interface
}

ArticlesApiCreateArticleOpts Optional parameters for the method 'CreateArticle'

type ArticlesApiGetArticlesOpts

type ArticlesApiGetArticlesOpts struct {
	Page     optional.Int32
	Tag      optional.String
	Username optional.String
	State    optional.String
	Top      optional.Int32
}

ArticlesApiGetArticlesOpts Optional parameters for the method 'GetArticles'

type ArticlesApiGetUserAllArticlesOpts

type ArticlesApiGetUserAllArticlesOpts struct {
	Page    optional.Int32
	PerPage optional.Int32
}

ArticlesApiGetUserAllArticlesOpts Optional parameters for the method 'GetUserAllArticles'

type ArticlesApiGetUserArticlesOpts

type ArticlesApiGetUserArticlesOpts struct {
	Page    optional.Int32
	PerPage optional.Int32
}

ArticlesApiGetUserArticlesOpts Optional parameters for the method 'GetUserArticles'

type ArticlesApiGetUserPublishedArticlesOpts

type ArticlesApiGetUserPublishedArticlesOpts struct {
	Page    optional.Int32
	PerPage optional.Int32
}

ArticlesApiGetUserPublishedArticlesOpts Optional parameters for the method 'GetUserPublishedArticles'

type ArticlesApiGetUserUnpublishedArticlesOpts

type ArticlesApiGetUserUnpublishedArticlesOpts struct {
	Page    optional.Int32
	PerPage optional.Int32
}

ArticlesApiGetUserUnpublishedArticlesOpts Optional parameters for the method 'GetUserUnpublishedArticles'

type ArticlesApiService

type ArticlesApiService service

ArticlesApiService ArticlesApi service

func (*ArticlesApiService) CreateArticle

func (a *ArticlesApiService) CreateArticle(ctx _context.Context, localVarOptionals *ArticlesApiCreateArticleOpts) (ArticleShow, *_nethttp.Response, error)

CreateArticle Create a new article This endpoint allows the client to create a new article. \"Articles\" are all the posts that users create on DEV that typically show up in the feed. They can be a blog post, a discussion question, a help thread etc. but is referred to as article within the code. ### Rate limiting There is a limit of 10 articles created each 30 seconds by the same user. ### Additional resources - [Rails tests for Articles API](https://github.com/thepracticaldev/dev.to/blob/master/spec/requests/api/v0/articles_spec.rb)

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param optional nil or *ArticlesApiCreateArticleOpts - Optional Parameters:
  • @param "ArticleCreate" (optional.Interface of ArticleCreate) - Article to create

@return ArticleShow

func (*ArticlesApiService) GetArticleById

func (a *ArticlesApiService) GetArticleById(ctx _context.Context, id int32) (ArticleShow, *_nethttp.Response, error)

GetArticleById A published article This endpoint allows the client to retrieve a single published article given its `id`. Responses are cached for 5 minutes.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param id Id of the article

@return ArticleShow

func (*ArticlesApiService) GetArticles

func (a *ArticlesApiService) GetArticles(ctx _context.Context, localVarOptionals *ArticlesApiGetArticlesOpts) ([]ArticleIndex, *_nethttp.Response, error)

GetArticles Published articles This endpoint allows the client to retrieve a list of articles. \"Articles\" are all the posts that users create on DEV that typically show up in the feed. They can be a blog post, a discussion question, a help thread etc. but is referred to as article within the code. By default it will return featured, published articles ordered by descending popularity. Each page will contain `30` articles. Responses, according to the combination of params, are cached for 24 hours.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param optional nil or *ArticlesApiGetArticlesOpts - Optional Parameters:
  • @param "Page" (optional.Int32) - Pagination page. This param can be used in conjuction with all other params (except when asking for fresh and rising articles by themselves).
  • @param "Tag" (optional.String) - Adding this parameter will return articles that contain the requested tag. This param can be used by itself, with `page` or with `top`.
  • @param "Username" (optional.String) - Adding this parameter will return articles belonging to a User or Organization ordered by descending `published_at`. If `state=all` the number of items returned will be `1000` instead of the default `30`. This param can be used by itself or only with `page` and `state`.
  • @param "State" (optional.String) - Adding this will allow the client to check which articles are fresh or rising. If `state=fresh` the server will return published fresh articles. If `state=rising` the server will return published rising articles. This param can only be used by itself or with `username` if set to `all`.
  • @param "Top" (optional.Int32) - Adding this will allow the client to return the most popular articles in the last `N` days. `top` indicates the number of days since publication of the articles returned. This param can only be used by itself or with `tag`.

@return []ArticleIndex

func (*ArticlesApiService) GetUserAllArticles

func (a *ArticlesApiService) GetUserAllArticles(ctx _context.Context, localVarOptionals *ArticlesApiGetUserAllArticlesOpts) ([]ArticleMe, *_nethttp.Response, error)

GetUserAllArticles User's all articles This endpoint allows the client to retrieve a list of all articles on behalf of an authenticated user. \"Articles\" are all the posts that users create on DEV that typically show up in the feed. They can be a blog post, a discussion question, a help thread etc. but is referred to as article within the code. It will return both published and unpublished articles with pagination. Unpublished articles will be at the top of the list in reverse chronological creation order. Published articles will follow in reverse chronological publication order. By default a page will contain `30` articles.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param optional nil or *ArticlesApiGetUserAllArticlesOpts - Optional Parameters:
  • @param "Page" (optional.Int32) - Pagination page.
  • @param "PerPage" (optional.Int32) - Page size (defaults to 30 with a maximum of 1000).

@return []ArticleMe

func (*ArticlesApiService) GetUserArticles

func (a *ArticlesApiService) GetUserArticles(ctx _context.Context, localVarOptionals *ArticlesApiGetUserArticlesOpts) ([]ArticleMe, *_nethttp.Response, error)

GetUserArticles User's articles This endpoint allows the client to retrieve a list of published articles on behalf of an authenticated user. \"Articles\" are all the posts that users create on DEV that typically show up in the feed. They can be a blog post, a discussion question, a help thread etc. but is referred to as article within the code. Published articles will be in reverse chronological publication order. It will return published articles with pagination. By default a page will contain `30` articles.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param optional nil or *ArticlesApiGetUserArticlesOpts - Optional Parameters:
  • @param "Page" (optional.Int32) - Pagination page.
  • @param "PerPage" (optional.Int32) - Page size (defaults to 30 with a maximum of 1000).

@return []ArticleMe

func (*ArticlesApiService) GetUserPublishedArticles

func (a *ArticlesApiService) GetUserPublishedArticles(ctx _context.Context, localVarOptionals *ArticlesApiGetUserPublishedArticlesOpts) ([]ArticleMe, *_nethttp.Response, error)

GetUserPublishedArticles User's published articles This endpoint allows the client to retrieve a list of published articles on behalf of an authenticated user. \"Articles\" are all the posts that users create on DEV that typically show up in the feed. They can be a blog post, a discussion question, a help thread etc. but is referred to as article within the code. Published articles will be in reverse chronological publication order. It will return published articles with pagination. By default a page will contain `30` articles.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param optional nil or *ArticlesApiGetUserPublishedArticlesOpts - Optional Parameters:
  • @param "Page" (optional.Int32) - Pagination page.
  • @param "PerPage" (optional.Int32) - Page size (defaults to 30 with a maximum of 1000).

@return []ArticleMe

func (*ArticlesApiService) GetUserUnpublishedArticles

func (a *ArticlesApiService) GetUserUnpublishedArticles(ctx _context.Context, localVarOptionals *ArticlesApiGetUserUnpublishedArticlesOpts) ([]ArticleMe, *_nethttp.Response, error)

GetUserUnpublishedArticles User's unpublished articles This endpoint allows the client to retrieve a list of unpublished articles on behalf of an authenticated user. \"Articles\" are all the posts that users create on DEV that typically show up in the feed. They can be a blog post, a discussion question, a help thread etc. but is referred to as article within the code. Unpublished articles will be in reverse chronological creation order. It will return unpublished articles with pagination. By default a page will contain `30` articles.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param optional nil or *ArticlesApiGetUserUnpublishedArticlesOpts - Optional Parameters:
  • @param "Page" (optional.Int32) - Pagination page.
  • @param "PerPage" (optional.Int32) - Page size (defaults to 30 with a maximum of 1000).

@return []ArticleMe

func (*ArticlesApiService) UpdateArticle

func (a *ArticlesApiService) UpdateArticle(ctx _context.Context, id int32, localVarOptionals *ArticlesApiUpdateArticleOpts) (ArticleShow, *_nethttp.Response, error)

UpdateArticle Update an article This endpoint allows the client to updated an existing article. \"Articles\" are all the posts that users create on DEV that typically show up in the feed. They can be a blog post, a discussion question, a help thread etc. but is referred to as article within the code. ### Rate limiting There are no limits on the amount of updates. ### Additional resources - [Rails tests for Articles API](https://github.com/thepracticaldev/dev.to/blob/master/spec/requests/api/v0/articles_spec.rb)

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param id Id of the article
  • @param optional nil or *ArticlesApiUpdateArticleOpts - Optional Parameters:
  • @param "ArticleUpdate" (optional.Interface of ArticleUpdate) - Article params to update. *Note: if the article contains a front matter in its body, its front matter properties will still take precedence over any JSON equivalent params, which means that the full body_markdown with the modified front matter params needs to be provided for an update to be successful*

@return ArticleShow

type ArticlesApiUpdateArticleOpts

type ArticlesApiUpdateArticleOpts struct {
	ArticleUpdate optional.Interface
}

ArticlesApiUpdateArticleOpts Optional parameters for the method 'UpdateArticle'

type BasicAuth

type BasicAuth struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth

type Configuration

type Configuration struct {
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	Debug         bool              `json:"debug,omitempty"`
	HTTPClient    *http.Client
}

Configuration stores the configuration of the API client

func NewConfiguration

func NewConfiguration() *Configuration

NewConfiguration returns a new Configuration object

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

AddDefaultHeader adds a new HTTP header to the default header in the request

type GenericOpenAPIError

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

GenericOpenAPIError Provides access to the body, error and model on returned errors.

func (GenericOpenAPIError) Body

func (e GenericOpenAPIError) Body() []byte

Body returns the raw bytes of the response

func (GenericOpenAPIError) Error

func (e GenericOpenAPIError) Error() string

Error returns non-empty string if there was an error.

func (GenericOpenAPIError) Model

func (e GenericOpenAPIError) Model() interface{}

Model returns the unpacked model of the error

type UsersApiGetUserAllArticlesOpts

type UsersApiGetUserAllArticlesOpts struct {
	Page    optional.Int32
	PerPage optional.Int32
}

UsersApiGetUserAllArticlesOpts Optional parameters for the method 'GetUserAllArticles'

type UsersApiGetUserArticlesOpts

type UsersApiGetUserArticlesOpts struct {
	Page    optional.Int32
	PerPage optional.Int32
}

UsersApiGetUserArticlesOpts Optional parameters for the method 'GetUserArticles'

type UsersApiGetUserPublishedArticlesOpts

type UsersApiGetUserPublishedArticlesOpts struct {
	Page    optional.Int32
	PerPage optional.Int32
}

UsersApiGetUserPublishedArticlesOpts Optional parameters for the method 'GetUserPublishedArticles'

type UsersApiGetUserUnpublishedArticlesOpts

type UsersApiGetUserUnpublishedArticlesOpts struct {
	Page    optional.Int32
	PerPage optional.Int32
}

UsersApiGetUserUnpublishedArticlesOpts Optional parameters for the method 'GetUserUnpublishedArticles'

type UsersApiService

type UsersApiService service

UsersApiService UsersApi service

func (*UsersApiService) GetUserAllArticles

func (a *UsersApiService) GetUserAllArticles(ctx _context.Context, localVarOptionals *UsersApiGetUserAllArticlesOpts) ([]ArticleMe, *_nethttp.Response, error)

GetUserAllArticles User's all articles This endpoint allows the client to retrieve a list of all articles on behalf of an authenticated user. \"Articles\" are all the posts that users create on DEV that typically show up in the feed. They can be a blog post, a discussion question, a help thread etc. but is referred to as article within the code. It will return both published and unpublished articles with pagination. Unpublished articles will be at the top of the list in reverse chronological creation order. Published articles will follow in reverse chronological publication order. By default a page will contain `30` articles.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param optional nil or *UsersApiGetUserAllArticlesOpts - Optional Parameters:
  • @param "Page" (optional.Int32) - Pagination page.
  • @param "PerPage" (optional.Int32) - Page size (defaults to 30 with a maximum of 1000).

@return []ArticleMe

func (*UsersApiService) GetUserArticles

func (a *UsersApiService) GetUserArticles(ctx _context.Context, localVarOptionals *UsersApiGetUserArticlesOpts) ([]ArticleMe, *_nethttp.Response, error)

GetUserArticles User's articles This endpoint allows the client to retrieve a list of published articles on behalf of an authenticated user. \"Articles\" are all the posts that users create on DEV that typically show up in the feed. They can be a blog post, a discussion question, a help thread etc. but is referred to as article within the code. Published articles will be in reverse chronological publication order. It will return published articles with pagination. By default a page will contain `30` articles.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param optional nil or *UsersApiGetUserArticlesOpts - Optional Parameters:
  • @param "Page" (optional.Int32) - Pagination page.
  • @param "PerPage" (optional.Int32) - Page size (defaults to 30 with a maximum of 1000).

@return []ArticleMe

func (*UsersApiService) GetUserPublishedArticles

func (a *UsersApiService) GetUserPublishedArticles(ctx _context.Context, localVarOptionals *UsersApiGetUserPublishedArticlesOpts) ([]ArticleMe, *_nethttp.Response, error)

GetUserPublishedArticles User's published articles This endpoint allows the client to retrieve a list of published articles on behalf of an authenticated user. \"Articles\" are all the posts that users create on DEV that typically show up in the feed. They can be a blog post, a discussion question, a help thread etc. but is referred to as article within the code. Published articles will be in reverse chronological publication order. It will return published articles with pagination. By default a page will contain `30` articles.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param optional nil or *UsersApiGetUserPublishedArticlesOpts - Optional Parameters:
  • @param "Page" (optional.Int32) - Pagination page.
  • @param "PerPage" (optional.Int32) - Page size (defaults to 30 with a maximum of 1000).

@return []ArticleMe

func (*UsersApiService) GetUserUnpublishedArticles

func (a *UsersApiService) GetUserUnpublishedArticles(ctx _context.Context, localVarOptionals *UsersApiGetUserUnpublishedArticlesOpts) ([]ArticleMe, *_nethttp.Response, error)

GetUserUnpublishedArticles User's unpublished articles This endpoint allows the client to retrieve a list of unpublished articles on behalf of an authenticated user. \"Articles\" are all the posts that users create on DEV that typically show up in the feed. They can be a blog post, a discussion question, a help thread etc. but is referred to as article within the code. Unpublished articles will be in reverse chronological creation order. It will return unpublished articles with pagination. By default a page will contain `30` articles.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param optional nil or *UsersApiGetUserUnpublishedArticlesOpts - Optional Parameters:
  • @param "Page" (optional.Int32) - Pagination page.
  • @param "PerPage" (optional.Int32) - Page size (defaults to 30 with a maximum of 1000).

@return []ArticleMe

type WebhookCreate

type WebhookCreate struct {
	WebhookEndpoint WebhookCreateWebhookEndpoint `json:"webhook_endpoint,omitempty"`
}

WebhookCreate Webhook creation payload

type WebhookCreateWebhookEndpoint

type WebhookCreateWebhookEndpoint struct {
	// The name of the requester, eg. \"DEV\"
	Source    string `json:"source"`
	TargetUrl string `json:"target_url"`
	// An array of events identifiers
	Events []string `json:"events"`
}

WebhookCreateWebhookEndpoint struct for WebhookCreateWebhookEndpoint

type WebhookIndex

type WebhookIndex struct {
	TypeOf string `json:"type_of,omitempty"`
	Id     int64  `json:"id,omitempty"`
	// The name of the requester, eg. \"DEV\"
	Source    string `json:"source,omitempty"`
	TargetUrl string `json:"target_url,omitempty"`
	// An array of events identifiers
	Events    []string  `json:"events,omitempty"`
	CreatedAt time.Time `json:"created_at,omitempty"`
}

WebhookIndex Webhook

type WebhookShow

type WebhookShow struct {
	TypeOf string `json:"type_of,omitempty"`
	Id     int64  `json:"id,omitempty"`
	// The name of the requester, eg. \"DEV\"
	Source    string `json:"source,omitempty"`
	TargetUrl string `json:"target_url,omitempty"`
	// An array of events identifiers
	Events    []string    `json:"events,omitempty"`
	CreatedAt time.Time   `json:"created_at,omitempty"`
	User      ArticleUser `json:"user,omitempty"`
}

WebhookShow Webhook

type WebhooksApiCreateWebhookOpts

type WebhooksApiCreateWebhookOpts struct {
	WebhookCreate optional.Interface
}

WebhooksApiCreateWebhookOpts Optional parameters for the method 'CreateWebhook'

type WebhooksApiService

type WebhooksApiService service

WebhooksApiService WebhooksApi service

func (*WebhooksApiService) CreateWebhook

func (a *WebhooksApiService) CreateWebhook(ctx _context.Context, localVarOptionals *WebhooksApiCreateWebhookOpts) (WebhookShow, *_nethttp.Response, error)

CreateWebhook Create a new webhook This endpoint allows the client to create a new webhook. \"Webhooks\" are used to register HTTP endpoints that will be called once a relevant event is triggered inside the web application, events like `article_created`, `article_updated`.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param optional nil or *WebhooksApiCreateWebhookOpts - Optional Parameters:
  • @param "WebhookCreate" (optional.Interface of WebhookCreate) - Webhook to create

@return WebhookShow

func (*WebhooksApiService) DeleteWebhook

func (a *WebhooksApiService) DeleteWebhook(ctx _context.Context, id int32) (*_nethttp.Response, error)

DeleteWebhook A webhook endpoint This endpoint allows the client to delete a single webhook given its `id`.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param id Id of the webhook

func (*WebhooksApiService) GetWebhookById

func (a *WebhooksApiService) GetWebhookById(ctx _context.Context, id int32) (WebhookShow, *_nethttp.Response, error)

GetWebhookById A webhook endpoint This endpoint allows the client to retrieve a single webhook given its `id`.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param id Id of the webhook

@return WebhookShow

func (*WebhooksApiService) GetWebhooks

GetWebhooks Webhooks This endpoint allows the client to retrieve a list of webhooks they have previously registered. \"Webhooks\" are used to register HTTP endpoints that will be called once a relevant event is triggered inside the web application, events like `article_created`, `article_updated`. It will return all webhooks, without pagination.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return []WebhookIndex

Jump to

Keyboard shortcuts

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