Twitter OpenAPI(Swagger) specification
This API client was generated from twitter-openapi by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.
- API version: 0.0.1
- Package version: 1.0.0
- Generator version: 7.9.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/net/context
Put the package under your project folder and add the following in import:
import openapi "github.com/Jel1ySpot/twitter-openapi-go-generated"
To use a proxy, set the environment variable HTTP_PROXY
:
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
Default configuration comes with Servers
field that contains server objects as defined in the OpenAPI specification.
For using other server than the one defined on index 0 set context value openapi.ContextServerIndex
of type int
.
ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1)
Templated server URL is formatted using default variables from configuration or from context value openapi.ContextServerVariables
of type map[string]string
.
ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{
"basePath": "v2",
})
Note, enum values are always validated and all unused variables are silently ignored.
Each operation can use different server URL defined using OperationServers
map in the Configuration
.
An operation is uniquely identified by "{classname}Service.{nickname}"
string.
Similar rules for overriding default operation server index and variables applies by using openapi.ContextOperationServerIndices
and openapi.ContextOperationServerVariables
context maps.
ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})
All URIs are relative to https://x.com/i/api
Class | Method | HTTP request | Description |
---|---|---|---|
DefaultAPI | GetProfileSpotlightsQuery | Get /graphql/{pathQueryId}/ProfileSpotlightsQuery | |
DefaultAPI | GetTweetResultByRestId | Get /graphql/{pathQueryId}/TweetResultByRestId | |
OtherAPI | Other | Get /other | |
PostAPI | PostCreateBookmark | Post /graphql/{pathQueryId}/CreateBookmark | |
PostAPI | PostCreateRetweet | Post /graphql/{pathQueryId}/CreateRetweet | |
PostAPI | PostCreateTweet | Post /graphql/{pathQueryId}/CreateTweet | |
PostAPI | PostDeleteBookmark | Post /graphql/{pathQueryId}/DeleteBookmark | |
PostAPI | PostDeleteRetweet | Post /graphql/{pathQueryId}/DeleteRetweet | |
PostAPI | PostDeleteTweet | Post /graphql/{pathQueryId}/DeleteTweet | |
PostAPI | PostFavoriteTweet | Post /graphql/{pathQueryId}/FavoriteTweet | |
PostAPI | PostUnfavoriteTweet | Post /graphql/{pathQueryId}/UnfavoriteTweet | |
TweetAPI | GetBookmarks | Get /graphql/{pathQueryId}/Bookmarks | |
TweetAPI | GetHomeLatestTimeline | Get /graphql/{pathQueryId}/HomeLatestTimeline | |
TweetAPI | GetHomeTimeline | Get /graphql/{pathQueryId}/HomeTimeline | |
TweetAPI | GetLikes | Get /graphql/{pathQueryId}/Likes | |
TweetAPI | GetListLatestTweetsTimeline | Get /graphql/{pathQueryId}/ListLatestTweetsTimeline | |
TweetAPI | GetSearchTimeline | Get /graphql/{pathQueryId}/SearchTimeline | |
TweetAPI | GetTweetDetail | Get /graphql/{pathQueryId}/TweetDetail | |
TweetAPI | GetUserHighlightsTweets | Get /graphql/{pathQueryId}/UserHighlightsTweets | |
TweetAPI | GetUserMedia | Get /graphql/{pathQueryId}/UserMedia | |
TweetAPI | GetUserTweets | Get /graphql/{pathQueryId}/UserTweets | |
TweetAPI | GetUserTweetsAndReplies | Get /graphql/{pathQueryId}/UserTweetsAndReplies | |
UserAPI | GetUserByRestId | Get /graphql/{pathQueryId}/UserByRestId | |
UserAPI | GetUserByScreenName | Get /graphql/{pathQueryId}/UserByScreenName | |
UserListAPI | GetFavoriters | Get /graphql/{pathQueryId}/Favoriters | |
UserListAPI | GetFollowers | Get /graphql/{pathQueryId}/Followers | |
UserListAPI | GetFollowersYouKnow | Get /graphql/{pathQueryId}/FollowersYouKnow | |
UserListAPI | GetFollowing | Get /graphql/{pathQueryId}/Following | |
UserListAPI | GetRetweeters | Get /graphql/{pathQueryId}/Retweeters | |
UsersAPI | GetUsersByRestIds | Get /graphql/{pathQueryId}/UsersByRestIds | |
V11GetAPI | GetFriendsFollowingList | Get /1.1/friends/following/list.json | |
V11GetAPI | GetSearchTypeahead | Get /1.1/search/typeahead.json | |
V11PostAPI | PostCreateFriendships | Post /1.1/friendships/create.json | |
V11PostAPI | PostDestroyFriendships | Post /1.1/friendships/destroy.json | |
V20GetAPI | GetSearchAdaptive | Get /2/search/adaptive.json |
- AdditionalMediaInfo
- AdditionalMediaInfoCallToActions
- AdditionalMediaInfoCallToActionsUrl
- AllowDownloadStatus
- Article
- ArticleCoverMedia
- ArticleCoverMediaColorInfo
- ArticleCoverMediaColorInfoPalette
- ArticleCoverMediaColorInfoPaletteRGB
- ArticleCoverMediaInfo
- ArticleLifecycleState
- ArticleMetadata
- ArticleResult
- ArticleResults
- AuthorCommunityRelationship
- BirdwatchEntity
- BirdwatchEntityRef
- BirdwatchPivot
- BirdwatchPivotCallToAction
- BirdwatchPivotFooter
- BirdwatchPivotNote
- BirdwatchPivotSubtitle
- BookmarksResponse
- BookmarksResponseData
- BookmarksTimeline
- Callback
- ClientEventInfo
- CommunitiesActions
- Community
- CommunityActions
- CommunityData
- CommunityDeleteActionResult
- CommunityInvitesResult
- CommunityJoinActionResult
- CommunityJoinRequestsResult
- CommunityLeaveActionResult
- CommunityPinActionResult
- CommunityRelationship
- CommunityRule
- CommunityUnpinActionResult
- CommunityUrls
- CommunityUrlsPermalink
- ContentEntryType
- ContentItemType
- ContentUnion
- ConversationControl
- CoverCta
- CreateBookmarkResponse
- CreateBookmarkResponseData
- CreateRetweet
- CreateRetweetResponse
- CreateRetweetResponseData
- CreateRetweetResponseResult
- CreateTweet
- CreateTweetResponse
- CreateTweetResponseData
- CreateTweetResponseResult
- CtaClientEventInfo
- CursorType
- DeleteBookmarkResponse
- DeleteBookmarkResponseData
- DeleteRetweet
- DeleteRetweetResponse
- DeleteRetweetResponseData
- DeleteRetweetResponseResult
- DeleteTweetResponse
- DeleteTweetResponseData
- DeleteTweetResponseResult
- DisplayTreatment
- DisplayType
- Entities
- Error
- ErrorExtensions
- Errors
- ErrorsData
- ExtMediaAvailability
- ExtendedEntities
- FavoriteTweet
- FavoriteTweetResponseData
- FeedbackInfo
- FollowResponse
- FollowResponseData
- FollowResponseResult
- FollowResponseUser
- FollowTimeline
- GetBookmarks200Response
- GetFavoriters200Response
- GetFollowers200Response
- GetHomeLatestTimeline200Response
- GetLikes200Response
- GetListLatestTweetsTimeline200Response
- GetProfileSpotlightsQuery200Response
- GetRetweeters200Response
- GetSearchTimeline200Response
- GetTweetDetail200Response
- GetTweetResultByRestId200Response
- GetUserByRestId200Response
- GetUserHighlightsTweets200Response
- GetUsersByRestIds200Response
- Highlight
- HomeTimelineHome
- HomeTimelineResponseData
- InstructionType
- InstructionUnion
- ItemContentUnion
- ItemResult
- ListLatestTweetsTimelineResponse
- ListTweetsTimeline
- ListTweetsTimelineData
- ListTweetsTimelineList
- Location
- Media
- MediaExtended
- MediaOriginalInfo
- MediaOriginalInfoFocusRect
- MediaResult
- MediaResults
- MediaSize
- MediaSizes
- MediaStats
- MediaVideoInfo
- MediaVideoInfoVariant
- MediaVisibilityResults
- MediaVisibilityResultsBlurredImageInterstitial
- ModuleEntry
- ModuleItem
- NoteTweet
- NoteTweetResult
- NoteTweetResultData
- NoteTweetResultMedia
- NoteTweetResultMediaInlineMedia
- NoteTweetResultRichText
- NoteTweetResultRichTextTag
- OneFactorLoginEligibility
- OtherResponse
- PostCreateBookmark200Response
- PostCreateBookmarkRequest
- PostCreateBookmarkRequestVariables
- PostCreateRetweet200Response
- PostCreateRetweetRequest
- PostCreateRetweetRequestVariables
- PostCreateTweet200Response
- PostCreateTweetRequest
- PostCreateTweetRequestFeatures
- PostCreateTweetRequestVariables
- PostCreateTweetRequestVariablesConversationControl
- PostCreateTweetRequestVariablesMedia
- PostCreateTweetRequestVariablesMediaMediaEntitiesInner
- PostCreateTweetRequestVariablesReply
- PostDeleteBookmark200Response
- PostDeleteBookmarkRequest
- PostDeleteRetweet200Response
- PostDeleteRetweetRequest
- PostDeleteRetweetRequestVariables
- PostDeleteTweet200Response
- PostDeleteTweetRequest
- PostFavoriteTweet200Response
- PostFavoriteTweetRequest
- PostUnfavoriteTweet200Response
- PostUnfavoriteTweetRequest
- PrimaryCommunityTopic
- ProfileResponse
- ProfileResponseData
- QuotedRefResult
- QuotedStatusPermalink
- Retweet
- RetweetLegacy
- SearchByRawQuery
- SearchTimeline
- SearchTimelineData
- SearchTimelineResponse
- SelfThread
- SensitiveMediaWarning
- Session
- SocialContextLandingUrl
- SocialContextUnion
- SocialContextUnionType
- SuperFollowsReplyUserResult
- SuperFollowsReplyUserResultData
- SuperFollowsReplyUserResultLegacy
- Text
- TextEntity
- TextEntityRef
- TextHighlight
- Timeline
- TimelineAddEntries
- TimelineAddEntry
- TimelineAddToModule
- TimelineClearCache
- TimelineCommunity
- TimelineCoverBehavior
- TimelineCoverBehaviorUrl
- TimelineGeneralContext
- TimelineHalfCover
- TimelineMessagePrompt
- TimelinePinEntry
- TimelinePrompt
- TimelineReplaceEntry
- TimelineResponse
- TimelineShowAlert
- TimelineShowAlertRichText
- TimelineShowCover
- TimelineTerminateTimeline
- TimelineTimelineCursor
- TimelineTimelineItem
- TimelineTimelineModule
- TimelineTopicContext
- TimelineTweet
- TimelineUser
- TimelineV2
- Timestamp
- TopicContext
- Tracing
- Tweet
- TweetCard
- TweetCardLegacy
- TweetCardLegacyBindingValue
- TweetCardLegacyBindingValueData
- TweetCardLegacyBindingValueDataImage
- TweetCardPlatform
- TweetCardPlatformAudience
- TweetCardPlatformData
- TweetCardPlatformDevice
- TweetDetailResponse
- TweetDetailResponseData
- TweetEditControl
- TweetEditControlInitial
- TweetEditPrespective
- TweetFavoritersResponse
- TweetFavoritersResponseData
- TweetInterstitial
- TweetInterstitialRevealText
- TweetInterstitialText
- TweetInterstitialTextEntity
- TweetInterstitialTextEntityRef
- TweetLegacy
- TweetLegacyScopes
- TweetPreviousCounts
- TweetResultByRestIdData
- TweetResultByRestIdResponse
- TweetRetweetersResponse
- TweetRetweetersResponseData
- TweetTombstone
- TweetUnavailable
- TweetUnion
- TweetView
- TweetWithVisibilityResults
- TypeName
- UnfavoriteTweet
- UnfavoriteTweetResponseData
- UnifiedCard
- Url
- UrtEndpointOptions
- UrtEndpointRequestParams
- User
- UserFeatures
- UserHighlightsInfo
- UserHighlightsTweetsData
- UserHighlightsTweetsResponse
- UserHighlightsTweetsResult
- UserHighlightsTweetsTimeline
- UserHighlightsTweetsUser
- UserLegacy
- UserLegacyExtendedProfile
- UserLegacyExtendedProfileBirthdate
- UserProfessional
- UserProfessionalCategory
- UserResponse
- UserResponseData
- UserResultByScreenName
- UserResultByScreenNameLegacy
- UserResultByScreenNameResult
- UserResultCore
- UserResults
- UserTipJarSettings
- UserTweetsData
- UserTweetsResponse
- UserTweetsResult
- UserTweetsUser
- UserUnavailable
- UserUnion
- UserValue
- UserVerificationInfo
- UserVerificationInfoReason
- UserVerificationInfoReasonDescription
- UserVerificationInfoReasonDescriptionEntities
- UserVerificationInfoReasonDescriptionEntitiesRef
- UsersResponse
- UsersResponseData
Authentication schemes defined for the API:
- Type: API key
- API key parameter name: Accept
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey
where the key is: Accept and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"Accept": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
- Type: API key
- API key parameter name: Accept-Encoding
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey
where the key is: AcceptEncoding and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"AcceptEncoding": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
- Type: API key
- API key parameter name: Accept-Language
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey
where the key is: AcceptLanguage and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"AcceptLanguage": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
- Type: API key
- API key parameter name: x-twitter-active-user
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey
where the key is: ActiveUser and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"ActiveUser": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
- Type: API key
- API key parameter name: x-twitter-auth-type
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey
where the key is: AuthType and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"AuthType": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
- Type: HTTP Bearer token authentication
Example
auth := context.WithValue(context.Background(), openapi.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)
- Type: API key
- API key parameter name: x-twitter-client-language
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey
where the key is: ClientLanguage and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"ClientLanguage": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
- Type: API key
- API key parameter name: x-client-transaction-id
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey
where the key is: ClientTransactionId and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"ClientTransactionId": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
- Type: API key
- API key parameter name: x-client-uuid
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey
where the key is: ClientUuid and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"ClientUuid": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
- Type: API key
- API key parameter name: auth_token
- Location:
Note, each API key must be added to a map of map[string]APIKey
where the key is: CookieAuthToken and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"CookieAuthToken": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
- Type: API key
- API key parameter name: ct0
- Location:
Note, each API key must be added to a map of map[string]APIKey
where the key is: CookieCt0 and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"CookieCt0": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
- Type: API key
- API key parameter name: gt0
- Location:
Note, each API key must be added to a map of map[string]APIKey
where the key is: CookieGt0 and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"CookieGt0": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
- Type: API key
- API key parameter name: x-csrf-token
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey
where the key is: CsrfToken and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"CsrfToken": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
- Type: API key
- API key parameter name: x-guest-token
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey
where the key is: GuestToken and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"GuestToken": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
- Type: API key
- API key parameter name: Referer
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey
where the key is: Referer and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"Referer": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
- Type: API key
- API key parameter name: Sec-Ch-Ua
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey
where the key is: SecChUa and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"SecChUa": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
- Type: API key
- API key parameter name: Sec-Ch-Ua-Mobile
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey
where the key is: SecChUaMobile and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"SecChUaMobile": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
- Type: API key
- API key parameter name: Sec-Ch-Ua-Platform
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey
where the key is: SecChUaPlatform and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"SecChUaPlatform": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
- Type: API key
- API key parameter name: Sec-Fetch-Dest
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey
where the key is: SecFetchDest and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"SecFetchDest": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
- Type: API key
- API key parameter name: Sec-Fetch-Mode
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey
where the key is: SecFetchMode and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"SecFetchMode": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
- Type: API key
- API key parameter name: Sec-Fetch-Site
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey
where the key is: SecFetchSite and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"SecFetchSite": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
- Type: API key
- API key parameter name: user-agent
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey
where the key is: UserAgent and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"UserAgent": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:
PtrBool
PtrInt
PtrInt32
PtrInt64
PtrFloat
PtrFloat32
PtrFloat64
PtrString
PtrTime