Essential Contacts v1 API - Class ContactName (2.4.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
Name Description
projectId string

The Project ID. Must not be null or empty.

contactId string

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
Type Description
string

FolderId

public string FolderId { get; }

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

Property Value
Type Description
string

IsKnownPattern

public bool IsKnownPattern { get; }

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

Property Value
Type Description
bool

OrganizationId

public string OrganizationId { get; }

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

Property Value
Type Description
string

ProjectId

public string ProjectId { get; }

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

Property Value
Type Description
string

Type

public ContactName.ResourceNameType Type { get; }

The ContactName.ResourceNameType of the contained resource name.

Property Value
Type Description
ContactNameResourceNameType

UnparsedResource

public UnparsedResourceName UnparsedResource { get; }

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

Property Value
Type Description
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
Name Description
projectId string

The Project ID. Must not be null or empty.

contactId string

The Contact ID. Must not be null or empty.

Returns
Type Description
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
Name Description
folderId string

The Folder ID. Must not be null or empty.

contactId string

The Contact ID. Must not be null or empty.

Returns
Type Description
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
Name Description
organizationId string

The Organization ID. Must not be null or empty.

contactId string

The Contact ID. Must not be null or empty.

Returns
Type Description
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
Name Description
projectId string

The Project ID. Must not be null or empty.

contactId string

The Contact ID. Must not be null or empty.

Returns
Type Description
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
Name Description
folderId string

The Folder ID. Must not be null or empty.

contactId string

The Contact ID. Must not be null or empty.

Returns
Type Description
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
Name Description
organizationId string

The Organization ID. Must not be null or empty.

contactId string

The Contact ID. Must not be null or empty.

Returns
Type Description
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
Name Description
projectId string

The Project ID. Must not be null or empty.

contactId string

The Contact ID. Must not be null or empty.

Returns
Type Description
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
Name Description
unparsedResourceName UnparsedResourceName

The unparsed resource name. Must not be null.

Returns
Type Description
ContactName

A new instance of ContactName containing the provided unparsedResourceName.

GetHashCode()

public override int GetHashCode()

Returns a hash code for this resource name.

Returns
Type Description
int
Overrides

Parse(string)

public static ContactName Parse(string contactName)

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

Parameter
Name Description
contactName string

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

Returns
Type Description
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
Name Description
contactName string

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

allowUnparsed bool

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
Type Description
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
Type Description
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
Name Description
contactName string

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

result ContactName

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

Returns
Type Description
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
Name Description
contactName string

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

allowUnparsed bool

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.

result ContactName

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

Returns
Type Description
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)

Determines whether two specified resource names have the same value.

Parameters
Name Description
a ContactName

The first resource name to compare, or null.

b ContactName

The second resource name to compare, or null.

Returns
Type Description
bool

true if the value of a is the same as the value of b; otherwise, false.

operator !=(ContactName, ContactName)

public static bool operator !=(ContactName a, ContactName b)

Determines whether two specified resource names have different values.

Parameters
Name Description
a ContactName

The first resource name to compare, or null.

b ContactName

The second resource name to compare, or null.

Returns
Type Description
bool

true if the value of a is different from the value of b; otherwise, false.