import { LinkedInRequest } from '../core/linkedin-request' ; import { GetReceivedInvitationResponse } from '../responses/received-invitations.response.get' ; import { GetSentInvitationResponse } from '../responses/sent-invitations.response.get' ; export class InvitationRequest { private request : LinkedInRequest ; constructor ( { request } ) { this . request = request ; } sendInvitation ( { profileId , trackingId , message } ) { const requestPayload = { trackingId , emberEntityName : 'growth/invitation/norm-invitation' , invitee : { 'com.linkedin.voyager.growth.invitation.InviteeProfile' : { profileId , } , } , ... ( message && { message } ) , } ; return this . request . post ( 'growth/normInvitations' , requestPayload ) ; } getReceivedInvitations ( { skip = 0 , limit = 100 } = { } ) { const queryParams = { start : skip , count : limit , q : 'receivedInvitation' , } ; return this . request . get < GetReceivedInvitationResponse > ( 'relationships/invitationViews' , { params : queryParams , } ) ; } getSentInvitations ( { skip = 0 , limit = 100 } = { } ) { const queryParams = { start : skip , count : limit , invitationType : 'CONNECTION' , q : 'invitationType' , } ; return this . request . get < GetSentInvitationResponse > ( 'relationships/sentInvitationViewsV2' , { params : queryParams , } ) ; } }