Documentation ¶
Index ¶
- Variables
- func SetHeaders(h *http.Header, headers interface{})
- type API
- func (a *API) GetMatches(count string, pageToken *string) (response.MatchesResponse, error)
- func (a *API) GetMessages(matchId string, count string, pageToken *string) (response.MessagesResponse, error)
- func (a *API) GetProfile() (response.ProfileResponse, error)
- func (a *API) GetUpdates(lastActivityDate time.Time, nudge bool) (response.UpdatesResponse, error)
- func (a *API) GetUser(userId string) (response.UserResponse, error)
- func (a *API) SearchGifs(query string) (response.GifSearchResponse, error)
- func (a *API) SeenMatch(matchId string) (response.MetaResponse, error)
- func (a *API) SendAPIRequest(url string, contentType string, method string, payload *[]byte) (*http.Response, error)
- func (a *API) SendBuckets() (response.BucketResponse, error)
- func (a *API) SendMessage(matchId string, messagePayload payload.MessagePayload) (response.Message, error)
- func (a *API) StartTyping(userId string, matchId string) error
- func (a *API) TrendingGifs() (response.GifResponse, error)
- type Authenticator
- func (a *Authenticator) RefreshAuth() (*bin.LoginResult, error)
- func (a *Authenticator) Reset()
- func (a *Authenticator) SendSMS(number string) (response.SentSMSResponse, error)
- func (a *Authenticator) SetPhone(number string)
- func (a *Authenticator) SetRefreshToken(refreshToken string)
- func (a *Authenticator) SetRefreshing(v bool)
- func (a *Authenticator) UpdateDeviceData(loginResult *bin.LoginResult)
- func (a *Authenticator) ValidateEmailOTP(otp string) (response.ValidateEmailOTPResponse, error)
- func (a *Authenticator) VerifyOTP(otp string) (response.VerifyOTPResponse, error)
- type Client
- func (c *Client) AddInitialEvents()
- func (c *Client) AddNewEvent(PlatformEvent *bin.AppPlatformEvent)
- func (c *Client) Connect() error
- func (c *Client) Disconnect(reason *string) error
- func (c *Client) GetEventSession() *bin.AppEventSession
- func (c *Client) GetRequest(url string, headers interface{}) (*http.Response, error)
- func (c *Client) HandleAppActionEvent(actionEvent *bin.AppAction)
- func (c *Client) HandleSocketMessage(msgType int, data []byte)
- func (c *Client) HandleUpdateEvent(ev *bin.SocketEvents)
- func (c *Client) PostRequest(url string, payload []byte, headers interface{}) (*http.Response, error)
- func (c *Client) PublishEvents() (*bin.AppPublishInitialData, error)
- func (c *Client) SetEventHandler(evHandler EventHandler)
- func (c *Client) SetProxy(proxy string) error
- type EventHandler
- type EventPublishHeaders
- type EventResponses
- func (e *EventResponses) NewAddedImage(data *bin.AddedImage) Event_AddedImage
- func (e *EventResponses) NewBlock(matchId string) Event_Block
- func (e *EventResponses) NewConnectionFromAnotherClient(data *bin.ConnectedOnAnotherClient) Event_ConnectionFromAnotherClient
- func (e *EventResponses) NewLikedMessage(data response.LikedMessage) Event_LikedMessage
- func (e *EventResponses) NewMatch(match response.Match) Event_NewMatch
- func (e *EventResponses) NewMessage(message Event_NewMessage) Event_NewMessage
- func (e *EventResponses) NewStartedTyping(data *bin.StartTyping) Event_StartedTyping
- type Event_AddedImage
- type Event_Block
- type Event_ClientReady
- type Event_Closed
- type Event_ConnectionFromAnotherClient
- type Event_LikedMessage
- type Event_NewMatch
- type Event_NewMessage
- type Event_StartedTyping
- type KeepAliveSocket
- type Proxy
- type ServerTimestamps
- type Ts
Constants ¶
This section is empty.
Variables ¶
var ( ErrAlreadyRefreshing = errors.New("already attempting to refresh") ErrInvalidRefreshToken = errors.New("invalid refreshToken") )
var ( ErrSocketClosed = errors.New("socket is closed") ErrSocketAlreadyOpen = errors.New("socket is already open") )
var (
)var HubbleInstrumentEvents = util.PreAuthHubbleEvents{
LoginFacebookTap: "f554b19e-dfcd",
LoginGoogleTap: "4de5c7d5-a28e",
LoginSMSTap: "f353c681-565a",
SplashImpression: "4a354f6c-c875",
LoginImpression: "5375cf05-3088",
WelcomeBackImpression: "9a0d4099-f8a1",
LoginPushTap: "677ba945-c261",
WelcomeBackTextTap: "53e9081c-5571",
PushAuthDeviceCheckImpression: "a3af5a55-71cf",
Default: "1b7aaa2d-ccb7",
}
Functions ¶
func SetHeaders ¶
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
The API struct which contains all the functions to interact with the TinderAPI
func (*API) GetMatches ¶
Count is max 100 and min 1
func (*API) GetMessages ¶
func (*API) GetProfile ¶
func (a *API) GetProfile() (response.ProfileResponse, error)
func (*API) GetUpdates ¶
func (*API) SearchGifs ¶
func (a *API) SearchGifs(query string) (response.GifSearchResponse, error)
func (*API) SendAPIRequest ¶
func (*API) SendBuckets ¶
func (a *API) SendBuckets() (response.BucketResponse, error)
Tells the TinderAPI that the device is ready to use the API and if it should grant access to any experiments, this also returns every single path their API has to offer. Guessing that's just how their infrastructure works
func (*API) SendMessage ¶
func (*API) TrendingGifs ¶
func (a *API) TrendingGifs() (response.GifResponse, error)
type Authenticator ¶
type Authenticator struct {
// contains filtered or unexported fields
}
func (*Authenticator) RefreshAuth ¶
func (a *Authenticator) RefreshAuth() (*bin.LoginResult, error)
func (*Authenticator) Reset ¶
func (a *Authenticator) Reset()
func (*Authenticator) SendSMS ¶
func (a *Authenticator) SendSMS(number string) (response.SentSMSResponse, error)
Phone numbers should always start with the country code representative of their originating country.
func (*Authenticator) SetPhone ¶
func (a *Authenticator) SetPhone(number string)
func (*Authenticator) SetRefreshToken ¶
func (a *Authenticator) SetRefreshToken(refreshToken string)
func (*Authenticator) SetRefreshing ¶
func (a *Authenticator) SetRefreshing(v bool)
func (*Authenticator) UpdateDeviceData ¶
func (a *Authenticator) UpdateDeviceData(loginResult *bin.LoginResult)
func (*Authenticator) ValidateEmailOTP ¶
func (a *Authenticator) ValidateEmailOTP(otp string) (response.ValidateEmailOTPResponse, error)
func (*Authenticator) VerifyOTP ¶
func (a *Authenticator) VerifyOTP(otp string) (response.VerifyOTPResponse, error)
there is a possibility for this to not return the loginresult, that is if the device is not recognized and needs email validation aswell.
type Client ¶
type Client struct { App *util.App Device *util.Device Api *API KeepAliveSocket *KeepAliveSocket EventResponses *EventResponses Authenticator *Authenticator EventContainer *bin.AppEventData Logger *zerolog.Logger CurrentUser *util.CurrentUser // contains filtered or unexported fields }
func NewClient ¶
NewClient is a constructor function for creating a new instance of the Client struct.
Parameters:
- device: a pointer to a util.Device instance. If this is nil, a new device template is created. If the device is not nil, the AuthSession, Session, and UserSession of the device are reset. If the UserSession contains a UserId or RefreshToken, these are also reset and the RefreshToken is assigned to the authenticator.
- logger: an instance of zerolog.Logger that will be used for logging information and errors in the client. Pass an empty zerolog.Logger instance to disable logging completely.
- proxy: a string pointer representing a proxy address. If this is not nil, the client will try to set this proxy address. If the proxy address cannot be set, an error is logged and the function continues.
The function constructs a new Client instance with the following properties:
- App: an instance of util.App with predefined properties.
- KeepAliveSocket: an empty instance of KeepAliveSocket.
- Device: the passed in device or a new device template if the passed in device was nil.
- Api: an empty instance of API.
- EventResponses: an empty instance of EventResponses.
- Authenticator: the authenticator constructed earlier in the function.
- EventContainer: an instance of bin.AppEventData with a BatchId set to a new UUIDv4 and an empty events array.
- http: an instance of http.Client.
- Logger: a pointer to the passed in logger.
After creating the Client instance, the function assigns the Client instance to the client properties of Api, KeepAliveSocket, Authenticator, and EventResponses.
Then the function logs the initialized device and checks if a proxy was passed in. If so, it tries to set the proxy. If setting the proxy fails, an error is logged and the program closes.
Next, the function sends a buckets request. If this fails, an error is logged and the program closes.
The function then tries to publish events. If this fails, an error is logged and the program closes.
Then the function tries to cache the current user. If this fails, an error is logged, and the program closes.
The function then caches the last activity date and returns the Client instance.
Return:
- a pointer to the newly constructed Client instance.
func (*Client) AddInitialEvents ¶
func (c *Client) AddInitialEvents()
func (*Client) AddNewEvent ¶
func (c *Client) AddNewEvent(PlatformEvent *bin.AppPlatformEvent)
func (*Client) Disconnect ¶
func (*Client) GetEventSession ¶
func (c *Client) GetEventSession() *bin.AppEventSession
func (*Client) GetRequest ¶
func (*Client) HandleAppActionEvent ¶
func (*Client) HandleSocketMessage ¶
func (*Client) HandleUpdateEvent ¶
func (c *Client) HandleUpdateEvent(ev *bin.SocketEvents)
func (*Client) PostRequest ¶
func (*Client) PublishEvents ¶
func (c *Client) PublishEvents() (*bin.AppPublishInitialData, error)
func (*Client) SetEventHandler ¶
func (c *Client) SetEventHandler(evHandler EventHandler)
type EventHandler ¶
type EventHandler func(evt interface{})
type EventPublishHeaders ¶
type EventResponses ¶
type EventResponses struct {
// contains filtered or unexported fields
}
func (*EventResponses) NewAddedImage ¶
func (e *EventResponses) NewAddedImage(data *bin.AddedImage) Event_AddedImage
func (*EventResponses) NewBlock ¶
func (e *EventResponses) NewBlock(matchId string) Event_Block
func (*EventResponses) NewConnectionFromAnotherClient ¶
func (e *EventResponses) NewConnectionFromAnotherClient(data *bin.ConnectedOnAnotherClient) Event_ConnectionFromAnotherClient
func (*EventResponses) NewLikedMessage ¶
func (e *EventResponses) NewLikedMessage(data response.LikedMessage) Event_LikedMessage
func (*EventResponses) NewMatch ¶
func (e *EventResponses) NewMatch(match response.Match) Event_NewMatch
func (*EventResponses) NewMessage ¶
func (e *EventResponses) NewMessage(message Event_NewMessage) Event_NewMessage
func (*EventResponses) NewStartedTyping ¶
func (e *EventResponses) NewStartedTyping(data *bin.StartTyping) Event_StartedTyping
type Event_AddedImage ¶
type Event_AddedImage struct { Id string `json:"id,omitempty"` OriginalUrl string `json:"original_url,omitempty"` Images []response.ProcessedFiles `json:"images,omitempty"` ImagesAdded int32 `json:"images_added,omitempty"` }
type Event_Block ¶
type Event_Block struct { MatchId string `json:"match_id,omitempty"` // contains filtered or unexported fields }
type Event_ClientReady ¶
type Event_ClientReady struct {
Connected bool `json:"connected,omitempty"`
}
type Event_Closed ¶
type Event_Closed struct {
Reason *string `json:"reason,omitempty"`
}
type Event_ConnectionFromAnotherClient ¶
type Event_ConnectionFromAnotherClient struct {
Timestamp Ts `json:"timestamp,omitempty"`
}
type Event_LikedMessage ¶
type Event_LikedMessage struct { MessageID string `json:"message_id,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` LikerID string `json:"liker_id,omitempty"` MatchID string `json:"match_id,omitempty"` IsLiked bool `json:"is_liked,omitempty"` // contains filtered or unexported fields }
func (*Event_LikedMessage) IsMe ¶
func (m *Event_LikedMessage) IsMe() bool
type Event_NewMatch ¶
type Event_NewMessage ¶
type Event_NewMessage struct { Message response.Message /* Additional fields that aren't included in the message itself */ MatchId string `json:"_id,omitempty"` LastActivityDate time.Time `json:"last_activity_date,omitempty"` ReadReceipt response.ReadReceipt `json:"readreceipt,omitempty"` HasShownInitialInterest bool `json:"has_shown_initial_interest,omitempty"` IsNewMessage bool `json:"is_new_message,omitempty"` IsArchived bool `json:"is_archived,omitempty"` Seen response.Seen `json:"seen,omitempty"` // contains filtered or unexported fields }
func (*Event_NewMessage) IsMe ¶
func (m *Event_NewMessage) IsMe() bool
type Event_StartedTyping ¶
type KeepAliveSocket ¶
type KeepAliveSocket struct {
// contains filtered or unexported fields
}
func NewKeepAliveSocket ¶
func NewKeepAliveSocket(client *Client) *KeepAliveSocket
func (*KeepAliveSocket) CloseHandler ¶
func (s *KeepAliveSocket) CloseHandler(code int, text string) error
func (*KeepAliveSocket) Connect ¶
func (socket *KeepAliveSocket) Connect() error
func (*KeepAliveSocket) IsConnected ¶
func (s *KeepAliveSocket) IsConnected() bool