Class ContactName (1.1.0)

public sealed class ContactName : IResourceName, IEquatable<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
Boolean

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
ContactName.ResourceNameType

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
Int32
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, Boolean)

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.

allowUnparsedBoolean

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
Boolean

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, Boolean, 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.

allowUnparsedBoolean

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
Boolean

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

Equality(ContactName, ContactName)

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

Inequality(ContactName, ContactName)

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