@@ -102,12 +102,12 @@ func (s *OrganizationsServiceOp) Invitation(ctx context.Context, orgID, invitati
102102// InviteUser invites one user to the Atlas organization that you specify.
103103//
104104// See more: https://docs.atlas.mongodb.com/reference/api/organization-create-one-invitation/
105- func (s * OrganizationsServiceOp ) InviteUser (ctx context.Context , invitation * Invitation ) (* Invitation , * Response , error ) {
106- if invitation . OrgID == "" {
105+ func (s * OrganizationsServiceOp ) InviteUser (ctx context.Context , orgID string , invitation * Invitation ) (* Invitation , * Response , error ) {
106+ if orgID == "" {
107107 return nil , nil , NewArgError ("orgID" , "must be set" )
108108 }
109109
110- path := fmt .Sprintf (invitationBasePath , invitation . OrgID )
110+ path := fmt .Sprintf (invitationBasePath , orgID )
111111
112112 req , err := s .Client .NewRequest (ctx , http .MethodPost , path , invitation )
113113 if err != nil {
@@ -126,29 +126,27 @@ func (s *OrganizationsServiceOp) InviteUser(ctx context.Context, invitation *Inv
126126// UpdateInvitation updates one pending invitation to the Atlas organization that you specify.
127127//
128128// See more: https://docs.atlas.mongodb.com/reference/api/organization-update-one-invitation/
129- func (s * OrganizationsServiceOp ) UpdateInvitation (ctx context.Context , invitation * Invitation ) (* Invitation , * Response , error ) {
130- if invitation . OrgID == "" {
129+ func (s * OrganizationsServiceOp ) UpdateInvitation (ctx context.Context , orgID string , invitation * Invitation ) (* Invitation , * Response , error ) {
130+ if orgID == "" {
131131 return nil , nil , NewArgError ("orgID" , "must be set" )
132132 }
133133
134- return s .updateInvitation (ctx , invitation )
134+ return s .updateInvitation (ctx , orgID , "" , invitation )
135135}
136136
137137// UpdateInvitationByID updates one invitation to the Atlas organization.
138138//
139139// See more: https://docs.atlas.mongodb.com/reference/api/organization-update-one-invitation-by-id/
140- func (s * OrganizationsServiceOp ) UpdateInvitationByID (ctx context.Context , invitationID string , invitation * Invitation ) (* Invitation , * Response , error ) {
141- if invitation . OrgID == "" {
140+ func (s * OrganizationsServiceOp ) UpdateInvitationByID (ctx context.Context , orgID , invitationID string , invitation * Invitation ) (* Invitation , * Response , error ) {
141+ if orgID == "" {
142142 return nil , nil , NewArgError ("orgID" , "must be set" )
143143 }
144144
145145 if invitationID == "" {
146146 return nil , nil , NewArgError ("invitationID" , "must be set" )
147147 }
148148
149- invitation .ID = invitationID
150-
151- return s .updateInvitation (ctx , invitation )
149+ return s .updateInvitation (ctx , orgID , invitationID , invitation )
152150}
153151
154152// DeleteInvitation deletes one unaccepted invitation to the specified Atlas organization. You can't delete an invitation that a user has accepted.
@@ -176,11 +174,11 @@ func (s *OrganizationsServiceOp) DeleteInvitation(ctx context.Context, orgID, in
176174 return resp , err
177175}
178176
179- func (s * OrganizationsServiceOp ) updateInvitation (ctx context.Context , invitation * Invitation ) (* Invitation , * Response , error ) {
180- path := fmt .Sprintf (invitationBasePath , invitation . OrgID )
177+ func (s * OrganizationsServiceOp ) updateInvitation (ctx context.Context , orgID , invitationID string , invitation * Invitation ) (* Invitation , * Response , error ) {
178+ path := fmt .Sprintf (invitationBasePath , orgID )
181179
182- if invitation . ID != "" {
183- path = fmt .Sprintf ("%s/%s" , path , invitation . ID )
180+ if invitationID != "" {
181+ path = fmt .Sprintf ("%s/%s" , path , invitationID )
184182 }
185183
186184 req , err := s .Client .NewRequest (ctx , http .MethodPatch , path , invitation )
0 commit comments