Documentation
¶
Index ¶
- Variables
- func CacheExpires(r *http.Response) time.Time
- type APIClient
- type APIKey
- type APIResponse
- type BasicAuth
- type Configuration
- type GenericOpenAPIError
- type GetFeaturedQuestionsOpts
- type GetMyReputationHistoryOpts
- type GetQuestionsOpts
- type GetQuestionsWithoutAnswersOpts
- type GetUnansweredQuestionsOpts
- type GetUsersOpts
- type GetUsersReputationHistoryOpts
- type GetUsersReputationOpts
- type Question
- type QuestionOwner
- type QuestionsApiService
- func (a *QuestionsApiService) GetFeaturedQuestions(ctx context.Context, site string, localVarOptionals *GetFeaturedQuestionsOpts) (QuestionsResponse, *http.Response, error)
- func (a *QuestionsApiService) GetQuestions(ctx context.Context, site string, localVarOptionals *GetQuestionsOpts) (QuestionsResponse, *http.Response, error)
- func (a *QuestionsApiService) GetQuestionsWithoutAnswers(ctx context.Context, site string, ...) (QuestionsResponse, *http.Response, error)
- func (a *QuestionsApiService) GetUnansweredQuestions(ctx context.Context, site string, ...) (QuestionsResponse, *http.Response, error)
- type QuestionsResponse
- type ReputationChange
- type ReputationHistory
- type ReputationHistoryResponse
- type ReputationResponse
- type User
- type UserBadgeCounts
- type UsersApiService
- func (a *UsersApiService) GetMe(ctx context.Context, site string) (UsersResponse, *http.Response, error)
- func (a *UsersApiService) GetMyReputation(ctx context.Context) (ReputationResponse, *http.Response, error)
- func (a *UsersApiService) GetMyReputationHistory(ctx context.Context, localVarOptionals *GetMyReputationHistoryOpts) (ReputationHistoryResponse, *http.Response, error)
- func (a *UsersApiService) GetUsers(ctx context.Context, site string, localVarOptionals *GetUsersOpts) (UsersResponse, *http.Response, error)
- func (a *UsersApiService) GetUsersReputation(ctx context.Context, userIds string, site string, ...) (ReputationResponse, *http.Response, error)
- func (a *UsersApiService) GetUsersReputationHistory(ctx context.Context, userIds string, site string, ...) (ReputationHistoryResponse, *http.Response, error)
- type UsersResponse
Constants ¶
This section is empty.
Variables ¶
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 ¶
Types ¶
type APIClient ¶
type APIClient struct {
QuestionsApi *QuestionsApiService
UsersApi *UsersApiService
// contains filtered or unexported fields
}
APIClient manages communication with the Stack Exchange API API v2.2 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 ¶
Change base path to allow switching to mocks
func (*APIClient) HTTPClient ¶
type APIKey ¶
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:"-"`
}
func NewAPIResponse ¶
func NewAPIResponse(r *http.Response) *APIResponse
func NewAPIResponseWithError ¶
func NewAPIResponseWithError(errorMessage string) *APIResponse
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"`
HTTPClient *http.Client
}
func NewConfiguration ¶
func NewConfiguration() *Configuration
func (*Configuration) AddDefaultHeader ¶
func (c *Configuration) AddDefaultHeader(key string, value string)
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 GetQuestionsOpts ¶
type GetUsersOpts ¶
type GetUsersReputationOpts ¶
type Question ¶
type Question struct {
Tags []string `json:"tags,omitempty"`
Owner QuestionOwner `json:"owner,omitempty"`
IsAnswered bool `json:"is_answered,omitempty"`
ViewCount int32 `json:"view_count,omitempty"`
AnswerCount int32 `json:"answer_count,omitempty"`
Score int32 `json:"score,omitempty"`
LastActivityDate int32 `json:"last_activity_date,omitempty"`
CreationDate int32 `json:"creation_date,omitempty"`
QuestionId int32 `json:"question_id,omitempty"`
Link string `json:"link,omitempty"`
Title string `json:"title,omitempty"`
}
type QuestionOwner ¶
type QuestionOwner struct {
Reputation int32 `json:"reputation,omitempty"`
UserId int32 `json:"user_id,omitempty"`
UserType string `json:"user_type,omitempty"`
ProfileImage string `json:"profile_image,omitempty"`
DisplayName string `json:"display_name,omitempty"`
Link string `json:"link,omitempty"`
}
type QuestionsApiService ¶
type QuestionsApiService service
func (*QuestionsApiService) GetFeaturedQuestions ¶
func (a *QuestionsApiService) GetFeaturedQuestions(ctx context.Context, site string, localVarOptionals *GetFeaturedQuestionsOpts) (QuestionsResponse, *http.Response, error)
func (*QuestionsApiService) GetQuestions ¶
func (a *QuestionsApiService) GetQuestions(ctx context.Context, site string, localVarOptionals *GetQuestionsOpts) (QuestionsResponse, *http.Response, error)
func (*QuestionsApiService) GetQuestionsWithoutAnswers ¶
func (a *QuestionsApiService) GetQuestionsWithoutAnswers(ctx context.Context, site string, localVarOptionals *GetQuestionsWithoutAnswersOpts) (QuestionsResponse, *http.Response, error)
func (*QuestionsApiService) GetUnansweredQuestions ¶
func (a *QuestionsApiService) GetUnansweredQuestions(ctx context.Context, site string, localVarOptionals *GetUnansweredQuestionsOpts) (QuestionsResponse, *http.Response, error)
type QuestionsResponse ¶
type ReputationChange ¶
type ReputationChange struct {
OnDate int32 `json:"on_date,omitempty"`
ReputationChange int32 `json:"reputation_change,omitempty"`
VoteType string `json:"vote_type,omitempty"`
PostType string `json:"post_type,omitempty"`
PostId int32 `json:"post_id,omitempty"`
UserId int32 `json:"user_id,omitempty"`
}
type ReputationHistory ¶
type ReputationHistoryResponse ¶
type ReputationHistoryResponse struct {
// A list of reputation_history.
Items []ReputationHistory `json:"items,omitempty"`
HasMore bool `json:"has_more,omitempty"`
QuotaMax int32 `json:"quota_max,omitempty"`
QuotaRemaining int32 `json:"quota_remaining,omitempty"`
}
type ReputationResponse ¶
type ReputationResponse struct {
// A list of reputation_history.
Items []ReputationChange `json:"items,omitempty"`
HasMore bool `json:"has_more,omitempty"`
QuotaMax int32 `json:"quota_max,omitempty"`
QuotaRemaining int32 `json:"quota_remaining,omitempty"`
}
type User ¶
type User struct {
BadgeCounts UserBadgeCounts `json:"badge_counts,omitempty"`
AboutMe string `json:"about_me,omitempty"`
AccountId int64 `json:"account_id,omitempty"`
IsEmployee bool `json:"is_employee,omitempty"`
LastModifiedDate int64 `json:"last_modified_date,omitempty"`
LastAccessDate int64 `json:"last_access_date,omitempty"`
ReputationChangeYear int32 `json:"reputation_change_year,omitempty"`
ReputationChangeQuarter int32 `json:"reputation_change_quarter,omitempty"`
ReputationChangeMonth int32 `json:"reputation_change_month,omitempty"`
ReputationChangeWeek int32 `json:"reputation_change_week,omitempty"`
ReputationChangeDay int32 `json:"reputation_change_day,omitempty"`
Reputation int64 `json:"reputation,omitempty"`
CreationDate int64 `json:"creation_date,omitempty"`
UserType string `json:"user_type,omitempty"`
UserId int64 `json:"user_id,omitempty"`
AcceptRate int32 `json:"accept_rate,omitempty"`
Location string `json:"location,omitempty"`
WebsiteUrl string `json:"website_url,omitempty"`
Link string `json:"link,omitempty"`
ProfileImage string `json:"profile_image,omitempty"`
DisplayName string `json:"display_name,omitempty"`
}
type UserBadgeCounts ¶
type UsersApiService ¶
type UsersApiService service
func (*UsersApiService) GetMe ¶
func (a *UsersApiService) GetMe(ctx context.Context, site string) (UsersResponse, *http.Response, error)
UsersApiService Returns the user associated with the passed access_token. This method returns a [user](https://api.stackexchange.com/docs/types/user).
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param site
@return UsersResponse
func (*UsersApiService) GetMyReputation ¶
func (a *UsersApiService) GetMyReputation(ctx context.Context) (ReputationResponse, *http.Response, error)
UsersApiService Returns the reputation changed for the user associated with the given access_token. This method returns a list of [reputation changes](https://api.stackexchange.com/docs/types/reputation).
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ReputationResponse
func (*UsersApiService) GetMyReputationHistory ¶
func (a *UsersApiService) GetMyReputationHistory(ctx context.Context, localVarOptionals *GetMyReputationHistoryOpts) (ReputationHistoryResponse, *http.Response, error)
func (*UsersApiService) GetUsers ¶
func (a *UsersApiService) GetUsers(ctx context.Context, site string, localVarOptionals *GetUsersOpts) (UsersResponse, *http.Response, error)
func (*UsersApiService) GetUsersReputation ¶
func (a *UsersApiService) GetUsersReputation(ctx context.Context, userIds string, site string, localVarOptionals *GetUsersReputationOpts) (ReputationResponse, *http.Response, error)
func (*UsersApiService) GetUsersReputationHistory ¶
func (a *UsersApiService) GetUsersReputationHistory(ctx context.Context, userIds string, site string, localVarOptionals *GetUsersReputationHistoryOpts) (ReputationHistoryResponse, *http.Response, error)
Source Files
¶
- api_questions.go
- api_users.go
- client.go
- configuration.go
- model_question.go
- model_question_owner.go
- model_questions_response.go
- model_reputation_change.go
- model_reputation_history.go
- model_reputation_history_response.go
- model_reputation_response.go
- model_user.go
- model_user_badge_counts.go
- model_users_response.go
- response.go