# TdApi.AddContact (tdlight API 3.3.160 API)
declaration: package: it.tdlight.jni, class: TdApi, class: AddContact

Package it.tdlight.jni

# Class TdApi.AddContact

java.lang.Object
it.tdlight.jni.TdApi.Object
it.tdlight.jni.TdApi.Function
it.tdlight.jni.TdApi.AddContact

Enclosing class:
  TdApi

    public static class TdApi.AddContact
    extends TdApi.Function

Adds a user to the contact list or edits an existing contact by their user identifier.

Returns `Ok`

## Field Summary

Fields
Modifier and Type | Field | Description
--- | --- | ---
`static int` | `CONSTRUCTOR` |
`TdApi.Contact` | `contact` | The contact to add or edit; phone number can be empty and needs to be specified only if known, vCard is ignored.
`boolean` | `sharePhoneNumber` | True, if the new contact needs to be allowed to see current user's phone number.

## Constructor Summary

Constructors
Constructor | Description
--- | ---
`AddContact()` | Adds a user to the contact list or edits an existing contact by their user identifier.
`AddContact​(TdApi.Contact contact, boolean sharePhoneNumber)` | Adds a user to the contact list or edits an existing contact by their user identifier.
`AddContact​(DataInput input)` |

## Method Summary

Modifier and Type | Method | Description
--- | --- | ---
`boolean` | `equals​(Object o)` |
`int` | `getConstructor()` |
`int` | `hashCode()` |
`void` | `serialize​(DataOutput output)` |

### Methods inherited from class it.tdlight.jni.TdApi.Function

`toString`

### Methods inherited from class it.tdlight.jni.TdApi.Object

`serialize`

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`

## Field Details

### contact

public TdApi.Contact contact
The contact to add or edit; phone number can be empty and needs to be specified only if known, vCard is ignored.

### sharePhoneNumber

public boolean sharePhoneNumber
True, if the new contact needs to be allowed to see current user's phone number. A corresponding rule to userPrivacySettingShowPhoneNumber will be added if needed. Use the field userFullInfo.needPhoneNumberPrivacyException to check whether the current user needs to be asked to share their phone number.

### CONSTRUCTOR

public static final int CONSTRUCTOR

See Also:
  Constant Field Values

## Constructor Details

### AddContact

public AddContact()
Adds a user to the contact list or edits an existing contact by their user identifier.

Returns `Ok`

### AddContact

public AddContact​(TdApi.Contact contact, boolean sharePhoneNumber)
Adds a user to the contact list or edits an existing contact by their user identifier.

Returns `Ok`

Parameters:
  `contact` - Contact The contact to add or edit; phone number can be empty and needs to be specified only if known, vCard is ignored.
  `sharePhoneNumber` - boolean True, if the new contact needs to be allowed to see current user's phone number. A corresponding rule to userPrivacySettingShowPhoneNumber will be added if needed. Use the field userFullInfo.needPhoneNumberPrivacyException to check whether the current user needs to be asked to share their phone number.

### AddContact

public AddContact​(DataInput input) throws IOException

Throws:
  `IOException`

## Method Details

### getConstructor

public int getConstructor()

Specified by:
  `getConstructor` in class `TdApi.Object`

### serialize

public void serialize​(DataOutput output) throws IOException

Specified by:
  `serialize` in class `TdApi.Object`
Throws:
  `IOException`

### equals

public boolean equals​(Object o)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`