Essential Contacts v1 API - Class ContactName (2.2.0)

public sealed class ContactName : IResourceName, IEquatable<ContactName>

Reference documentation and code samples for the Essential Contacts v1 API class ContactName.

Resource name for the Contact resource.

Inheritance

object > ContactName

Namespace

Google.Cloud.EssentialContacts.V1

Assembly

Google.Cloud.EssentialContacts.V1.dll

Constructors

ContactName(string, string)

public ContactName(string projectId, string contactId)

Constructs a new instance of a ContactName class from the component parts of pattern projects/{project}/contacts/{contact}

Parameters
NameDescription
projectIdstring

The Project ID. Must not be null or empty.

contactIdstring

The Contact ID. Must not be null or empty.

Properties

ContactId

public string ContactId { get; }

The Contact ID. May be null, depending on which resource name is contained by this instance.

Property Value
TypeDescription
string

FolderId

public string FolderId { get; }

The Folder ID. May be null, depending on which resource name is contained by this instance.

Property Value
TypeDescription
string

IsKnownPattern

public bool IsKnownPattern { get; }

Whether this instance contains a resource name with a known pattern.

Property Value
TypeDescription
bool

OrganizationId

public string OrganizationId { get; }

The Organization ID. May be null, depending on which resource name is contained by this instance.

Property Value
TypeDescription
string

ProjectId

public string ProjectId { get; }

The Project ID. May be null, depending on which resource name is contained by this instance.

Property Value
TypeDescription
string

Type

public ContactName.ResourceNameType Type { get; }

The ContactName.ResourceNameType of the contained resource name.

Property Value
TypeDescription
ContactNameResourceNameType

UnparsedResource

public UnparsedResourceName UnparsedResource { get; }

The contained UnparsedResourceName. Only non-null if this instance contains an unparsed resource name.

Property Value
TypeDescription
UnparsedResourceName

Methods

Format(string, string)

public static string Format(string projectId, string contactId)

Formats the IDs into the string representation of this ContactName with pattern projects/{project}/contacts/{contact}.

Parameters
NameDescription
projectIdstring

The Project ID. Must not be null or empty.

contactIdstring

The Contact ID. Must not be null or empty.

Returns
TypeDescription
string

The string representation of this ContactName with pattern projects/{project}/contacts/{contact}.

FormatFolderContact(string, string)

public static string FormatFolderContact(string folderId, string contactId)

Formats the IDs into the string representation of this ContactName with pattern folders/{folder}/contacts/{contact}.

Parameters
NameDescription
folderIdstring

The Folder ID. Must not be null or empty.

contactIdstring

The Contact ID. Must not be null or empty.

Returns
TypeDescription
string

The string representation of this ContactName with pattern folders/{folder}/contacts/{contact}.

FormatOrganizationContact(string, string)

public static string FormatOrganizationContact(string organizationId, string contactId)

Formats the IDs into the string representation of this ContactName with pattern organizations/{organization}/contacts/{contact}.

Parameters
NameDescription
organizationIdstring

The Organization ID. Must not be null or empty.

contactIdstring

The Contact ID. Must not be null or empty.

Returns
TypeDescription
string

The string representation of this ContactName with pattern organizations/{organization}/contacts/{contact}.

FormatProjectContact(string, string)

public static string FormatProjectContact(string projectId, string contactId)

Formats the IDs into the string representation of this ContactName with pattern projects/{project}/contacts/{contact}.

Parameters
NameDescription
projectIdstring

The Project ID. Must not be null or empty.

contactIdstring

The Contact ID. Must not be null or empty.

Returns
TypeDescription
string

The string representation of this ContactName with pattern projects/{project}/contacts/{contact}.

FromFolderContact(string, string)

public static ContactName FromFolderContact(string folderId, string contactId)

Creates a ContactName with the pattern folders/{folder}/contacts/{contact}.

Parameters
NameDescription
folderIdstring

The Folder ID. Must not be null or empty.

contactIdstring

The Contact ID. Must not be null or empty.

Returns
TypeDescription
ContactName

A new instance of ContactName constructed from the provided ids.

FromOrganizationContact(string, string)

public static ContactName FromOrganizationContact(string organizationId, string contactId)

Creates a ContactName with the pattern organizations/{organization}/contacts/{contact}.

Parameters
NameDescription
organizationIdstring

The Organization ID. Must not be null or empty.

contactIdstring

The Contact ID. Must not be null or empty.

Returns
TypeDescription
ContactName

A new instance of ContactName constructed from the provided ids.

FromProjectContact(string, string)

public static ContactName FromProjectContact(string projectId, string contactId)

Creates a ContactName with the pattern projects/{project}/contacts/{contact}.

Parameters
NameDescription
projectIdstring

The Project ID. Must not be null or empty.

contactIdstring

The Contact ID. Must not be null or empty.

Returns
TypeDescription
ContactName

A new instance of ContactName constructed from the provided ids.

FromUnparsed(UnparsedResourceName)

public static ContactName FromUnparsed(UnparsedResourceName unparsedResourceName)

Creates a ContactName containing an unparsed resource name.

Parameter
NameDescription
unparsedResourceNameUnparsedResourceName

The unparsed resource name. Must not be null.

Returns
TypeDescription
ContactName

A new instance of ContactName containing the provided unparsedResourceName.

GetHashCode()

public override int GetHashCode()

Returns a hash code for this resource name.

Returns
TypeDescription
int
Overrides

Parse(string)

public static ContactName Parse(string contactName)

Parses the given resource name string into a new ContactName instance.

Parameter
NameDescription
contactNamestring

The resource name in string form. Must not be null.

Returns
TypeDescription
ContactName

The parsed ContactName if successful.

Remarks

To parse successfully, the resource name must be formatted as one of the following:

  • projects/{project}/contacts/{contact}
  • folders/{folder}/contacts/{contact}
  • organizations/{organization}/contacts/{contact}

Parse(string, bool)

public static ContactName Parse(string contactName, bool allowUnparsed)

Parses the given resource name string into a new ContactName instance; optionally allowing an unparseable resource name.

Parameters
NameDescription
contactNamestring

The resource name in string form. Must not be null.

allowUnparsedbool

If true will successfully store an unparseable resource name into the UnparsedResource property; otherwise will throw an ArgumentException if an unparseable resource name is specified.

Returns
TypeDescription
ContactName

The parsed ContactName if successful.

Remarks

To parse successfully, the resource name must be formatted as one of the following:

  • projects/{project}/contacts/{contact}
  • folders/{folder}/contacts/{contact}
  • organizations/{organization}/contacts/{contact}
Or may be in any format if allowUnparsed is true.

ToString()

public override string ToString()

The string representation of the resource name.

Returns
TypeDescription
string

The string representation of the resource name.

Overrides

TryParse(string, out ContactName)

public static bool TryParse(string contactName, out ContactName result)

Tries to parse the given resource name string into a new ContactName instance.

Parameters
NameDescription
contactNamestring

The resource name in string form. Must not be null.

resultContactName

When this method returns, the parsed ContactName, or null if parsing failed.

Returns
TypeDescription
bool

true if the name was parsed successfully; false otherwise.

Remarks

To parse successfully, the resource name must be formatted as one of the following:

  • projects/{project}/contacts/{contact}
  • folders/{folder}/contacts/{contact}
  • organizations/{organization}/contacts/{contact}

TryParse(string, bool, out ContactName)

public static bool TryParse(string contactName, bool allowUnparsed, out ContactName result)

Tries to parse the given resource name string into a new ContactName instance; optionally allowing an unparseable resource name.

Parameters
NameDescription
contactNamestring

The resource name in string form. Must not be null.

allowUnparsedbool

If true will successfully store an unparseable resource name into the UnparsedResource property; otherwise will throw an ArgumentException if an unparseable resource name is specified.

resultContactName

When this method returns, the parsed ContactName, or null if parsing failed.

Returns
TypeDescription
bool

true if the name was parsed successfully; false otherwise.

Remarks

To parse successfully, the resource name must be formatted as one of the following:

  • projects/{project}/contacts/{contact}
  • folders/{folder}/contacts/{contact}
  • organizations/{organization}/contacts/{contact}
Or may be in any format if allowUnparsed is true.

Operators

operator ==(ContactName, ContactName)

public static bool operator ==(ContactName a, ContactName b)
Parameters
NameDescription
aContactName
bContactName
Returns
TypeDescription
bool

operator !=(ContactName, ContactName)

public static bool operator !=(ContactName a, ContactName b)
Parameters
NameDescription
aContactName
bContactName
Returns
TypeDescription
bool