Categorygithub.com/Jel1ySpot/twitter-openapi-go-generated
repositorypackage
0.0.16
Repository: https://github.com/jel1yspot/twitter-openapi-go-generated.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

Go API client for openapi

Twitter OpenAPI(Swagger) specification

Overview

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

Installation

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")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

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

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.

URLs Configuration per Operation

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",
	},
})

Documentation for API Endpoints

All URIs are relative to https://x.com/i/api

ClassMethodHTTP requestDescription
DefaultAPIGetProfileSpotlightsQueryGet /graphql/{pathQueryId}/ProfileSpotlightsQuery
DefaultAPIGetTweetResultByRestIdGet /graphql/{pathQueryId}/TweetResultByRestId
OtherAPIOtherGet /other
PostAPIPostCreateBookmarkPost /graphql/{pathQueryId}/CreateBookmark
PostAPIPostCreateRetweetPost /graphql/{pathQueryId}/CreateRetweet
PostAPIPostCreateTweetPost /graphql/{pathQueryId}/CreateTweet
PostAPIPostDeleteBookmarkPost /graphql/{pathQueryId}/DeleteBookmark
PostAPIPostDeleteRetweetPost /graphql/{pathQueryId}/DeleteRetweet
PostAPIPostDeleteTweetPost /graphql/{pathQueryId}/DeleteTweet
PostAPIPostFavoriteTweetPost /graphql/{pathQueryId}/FavoriteTweet
PostAPIPostUnfavoriteTweetPost /graphql/{pathQueryId}/UnfavoriteTweet
TweetAPIGetBookmarksGet /graphql/{pathQueryId}/Bookmarks
TweetAPIGetHomeLatestTimelineGet /graphql/{pathQueryId}/HomeLatestTimeline
TweetAPIGetHomeTimelineGet /graphql/{pathQueryId}/HomeTimeline
TweetAPIGetLikesGet /graphql/{pathQueryId}/Likes
TweetAPIGetListLatestTweetsTimelineGet /graphql/{pathQueryId}/ListLatestTweetsTimeline
TweetAPIGetSearchTimelineGet /graphql/{pathQueryId}/SearchTimeline
TweetAPIGetTweetDetailGet /graphql/{pathQueryId}/TweetDetail
TweetAPIGetUserHighlightsTweetsGet /graphql/{pathQueryId}/UserHighlightsTweets
TweetAPIGetUserMediaGet /graphql/{pathQueryId}/UserMedia
TweetAPIGetUserTweetsGet /graphql/{pathQueryId}/UserTweets
TweetAPIGetUserTweetsAndRepliesGet /graphql/{pathQueryId}/UserTweetsAndReplies
UserAPIGetUserByRestIdGet /graphql/{pathQueryId}/UserByRestId
UserAPIGetUserByScreenNameGet /graphql/{pathQueryId}/UserByScreenName
UserListAPIGetFavoritersGet /graphql/{pathQueryId}/Favoriters
UserListAPIGetFollowersGet /graphql/{pathQueryId}/Followers
UserListAPIGetFollowersYouKnowGet /graphql/{pathQueryId}/FollowersYouKnow
UserListAPIGetFollowingGet /graphql/{pathQueryId}/Following
UserListAPIGetRetweetersGet /graphql/{pathQueryId}/Retweeters
UsersAPIGetUsersByRestIdsGet /graphql/{pathQueryId}/UsersByRestIds
V11GetAPIGetFriendsFollowingListGet /1.1/friends/following/list.json
V11GetAPIGetSearchTypeaheadGet /1.1/search/typeahead.json
V11PostAPIPostCreateFriendshipsPost /1.1/friendships/create.json
V11PostAPIPostDestroyFriendshipsPost /1.1/friendships/destroy.json
V20GetAPIGetSearchAdaptiveGet /2/search/adaptive.json

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

Accept

  • 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)

AcceptEncoding

  • 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)

AcceptLanguage

  • 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)

ActiveUser

  • 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)

AuthType

  • 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)

BearerAuth

  • Type: HTTP Bearer token authentication

Example

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

ClientLanguage

  • 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)

ClientTransactionId

  • 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)

ClientUuid

  • 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)

CookieAuthToken

  • 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)

CookieCt0

  • 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)

CookieGt0

  • 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)

CsrfToken

  • 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)

GuestToken

  • 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)

Referer

  • 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)

SecChUa

  • 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)

SecChUaMobile

  • 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)

SecChUaPlatform

  • 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)

SecFetchDest

  • 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)

SecFetchMode

  • 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)

SecFetchSite

  • 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)

UserAgent

  • 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)

Documentation for Utility Methods

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

Author

[email protected]