Skip to content

Commit

Permalink
feat(client-customer-profiles): This release enhances the SearchProfi…
Browse files Browse the repository at this point in the history
…les API by providing functionality to search for profiles using multiple keys and logical operators.
  • Loading branch information
awstools committed Nov 14, 2022
1 parent 1b96437 commit ae0500b
Show file tree
Hide file tree
Showing 6 changed files with 169 additions and 23 deletions.
8 changes: 2 additions & 6 deletions clients/client-customer-profiles/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,11 @@ AWS SDK for JavaScript CustomerProfiles Client for Node.js, Browser and React Na

<fullname>Amazon Connect Customer Profiles</fullname>

<p>Welcome to the Amazon Connect Customer Profiles API Reference. This guide provides information
about the Amazon Connect Customer Profiles API, including supported operations, data types,
parameters, and schemas.</p>
<p>Amazon Connect Customer Profiles is a unified customer profile for your contact center that has
pre-built connectors powered by AppFlow that make it easy to combine customer information
from third party applications, such as Salesforce (CRM), ServiceNow (ITSM), and your
enterprise resource planning (ERP), with contact history from your Amazon Connect contact
center.</p>
<p>If you're new to Amazon Connect , you might find it helpful to also review the <a href="https://docs.aws.amazon.com/connect/latest/adminguide/what-is-amazon-connect.html">Amazon Connect Administrator Guide</a>.</p>
enterprise resource planning (ERP), with contact history from your Amazon Connect contact center.
If you're new to Amazon Connect, you might find it helpful to review the <a href="https://docs.aws.amazon.com/connect/latest/adminguide/">Amazon Connect Administrator Guide</a>.</p>

## Installing

Expand Down
15 changes: 7 additions & 8 deletions clients/client-customer-profiles/src/CustomerProfiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,11 @@ import { CustomerProfilesClient } from "./CustomerProfilesClient";

/**
* <fullname>Amazon Connect Customer Profiles</fullname>
* <p>Welcome to the Amazon Connect Customer Profiles API Reference. This guide provides information
* about the Amazon Connect Customer Profiles API, including supported operations, data types,
* parameters, and schemas.</p>
* <p>Amazon Connect Customer Profiles is a unified customer profile for your contact center that has
* pre-built connectors powered by AppFlow that make it easy to combine customer information
* from third party applications, such as Salesforce (CRM), ServiceNow (ITSM), and your
* enterprise resource planning (ERP), with contact history from your Amazon Connect contact
* center.</p>
* <p>If you're new to Amazon Connect , you might find it helpful to also review the <a href="https://docs.aws.amazon.com/connect/latest/adminguide/what-is-amazon-connect.html">Amazon Connect Administrator Guide</a>.</p>
* enterprise resource planning (ERP), with contact history from your Amazon Connect contact center.
* If you're new to Amazon Connect, you might find it helpful to review the <a href="https://docs.aws.amazon.com/connect/latest/adminguide/">Amazon Connect Administrator Guide</a>.</p>
*/
export class CustomerProfiles extends CustomerProfilesClient {
/**
Expand Down Expand Up @@ -1358,8 +1354,11 @@ export class CustomerProfiles extends CustomerProfilesClient {
}

/**
* <p>Searches for profiles within a specific domain name using name, phone number, email
* address, account number, or a custom defined index.</p>
* <p>Searches for profiles within a specific domain using one or more predefined search keys
* (e.g., _fullName, _phone, _email, _account, etc.) and/or custom-defined search keys. A search key
* is a data type pair that consists of a <code>KeyName</code> and <code>Values</code> list.</p>
* <p>This operation supports searching for profiles with a minimum of 1 key-value(s) pair and up to
* 5 key-value(s) pairs using either <code>AND</code> or <code>OR</code> logic.</p>
*/
public searchProfiles(
args: SearchProfilesCommandInput,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,15 +363,11 @@ export interface CustomerProfilesClientResolvedConfig extends CustomerProfilesCl

/**
* <fullname>Amazon Connect Customer Profiles</fullname>
* <p>Welcome to the Amazon Connect Customer Profiles API Reference. This guide provides information
* about the Amazon Connect Customer Profiles API, including supported operations, data types,
* parameters, and schemas.</p>
* <p>Amazon Connect Customer Profiles is a unified customer profile for your contact center that has
* pre-built connectors powered by AppFlow that make it easy to combine customer information
* from third party applications, such as Salesforce (CRM), ServiceNow (ITSM), and your
* enterprise resource planning (ERP), with contact history from your Amazon Connect contact
* center.</p>
* <p>If you're new to Amazon Connect , you might find it helpful to also review the <a href="https://docs.aws.amazon.com/connect/latest/adminguide/what-is-amazon-connect.html">Amazon Connect Administrator Guide</a>.</p>
* enterprise resource planning (ERP), with contact history from your Amazon Connect contact center.
* If you're new to Amazon Connect, you might find it helpful to review the <a href="https://docs.aws.amazon.com/connect/latest/adminguide/">Amazon Connect Administrator Guide</a>.</p>
*/
export class CustomerProfilesClient extends __Client<
__HttpHandlerOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ export interface SearchProfilesCommandInput extends SearchProfilesRequest {}
export interface SearchProfilesCommandOutput extends SearchProfilesResponse, __MetadataBearer {}

/**
* <p>Searches for profiles within a specific domain name using name, phone number, email
* address, account number, or a custom defined index.</p>
* <p>Searches for profiles within a specific domain using one or more predefined search keys
* (e.g., _fullName, _phone, _email, _account, etc.) and/or custom-defined search keys. A search key
* is a data type pair that consists of a <code>KeyName</code> and <code>Values</code> list.</p>
* <p>This operation supports searching for profiles with a minimum of 1 key-value(s) pair and up to
* 5 key-value(s) pairs using either <code>AND</code> or <code>OR</code> logic.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
112 changes: 111 additions & 1 deletion clients/client-customer-profiles/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,26 @@ export class AccessDeniedException extends __BaseException {
}
}

/**
* <p>A data type pair that consists of a <code>KeyName</code> and <code>Values</code> list that is
* used in conjunction with the
* <a href="https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_SearchProfiles.html#customerprofiles-SearchProfiles-request-KeyName">KeyName</a>
* and
* <a href="https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_SearchProfiles.html#customerprofiles-SearchProfiles-request-Values">Values</a>
* parameters to search for profiles using the <a href="https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_SearchProfiles.html">SearchProfiles</a> API.</p>
*/
export interface AdditionalSearchKey {
/**
* <p>A searchable identifier of a customer profile.</p>
*/
KeyName: string | undefined;

/**
* <p>A list of key values.</p>
*/
Values: string[] | undefined;
}

export interface AddProfileKeyRequest {
/**
* <p>The unique identifier of a customer profile.</p>
Expand Down Expand Up @@ -3109,6 +3129,11 @@ export interface PutProfileObjectTypeResponse {
Tags?: Record<string, string>;
}

export enum LogicalOperator {
AND = "AND",
OR = "OR",
}

export interface SearchProfilesRequest {
/**
* <p>The pagination token from the previous SearchProfiles API call.</p>
Expand All @@ -3117,6 +3142,7 @@ export interface SearchProfilesRequest {

/**
* <p>The maximum number of objects returned per page.</p>
* <p>The default is 20 if this parameter is not included in the request.</p>
*/
MaxResults?: number;

Expand All @@ -3139,6 +3165,51 @@ export interface SearchProfilesRequest {
* <p>A list of key values.</p>
*/
Values: string[] | undefined;

/**
* <p>A list of <code>AdditionalSearchKey</code> objects that are each searchable identifiers of a
* profile. Each <code>AdditionalSearchKey</code> object contains a <code>KeyName</code> and a
* list of <code>Values</code> associated with that specific key (i.e., a key-value(s) pair).
* These additional search keys will be used in conjunction with the <code>LogicalOperator</code> and the
* required <code>KeyName</code> and <code>Values</code> parameters to search for profiles
* that satisfy the search criteria. </p>
*/
AdditionalSearchKeys?: AdditionalSearchKey[];

/**
* <p>Relationship between all specified search keys that will be used to search for
* profiles. This includes the required <code>KeyName</code> and <code>Values</code> parameters
* as well as any key-value(s) pairs specified in the <code>AdditionalSearchKeys</code> list.</p>
* <p>This parameter influences which profiles will be returned in the response in the following manner:</p>
* <ul>
* <li>
* <p>
* <code>AND</code> - The response only includes profiles that match all of the search keys.</p>
* </li>
* <li>
* <p>
* <code>OR</code> - The response includes profiles that match at least one of the search keys.</p>
* </li>
* </ul>
* <p>The <code>OR</code> relationship is the default behavior if this parameter is not included in the request.</p>
*/
LogicalOperator?: LogicalOperator | string;
}

/**
* <p>A data type pair that consists of a <code>KeyName</code> and <code>Values</code> list that were used
* to find a profile returned in response to a <a href="https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_SearchProfiles.html">SearchProfiles</a> request. </p>
*/
export interface FoundByKeyValue {
/**
* <p>A searchable identifier of a customer profile.</p>
*/
KeyName?: string;

/**
* <p>A list of key values.</p>
*/
Values?: string[];
}

/**
Expand Down Expand Up @@ -3257,11 +3328,36 @@ export interface Profile {
* <p>A key value pair of attributes of a customer profile.</p>
*/
Attributes?: Record<string, string>;

/**
* <p>A list of items used to find a profile returned in a <a href="https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_SearchProfiles.html">SearchProfiles</a> response.
* An item is a key-value(s) pair that matches an attribute in the profile.</p>
* <p>If the optional <code>AdditionalSearchKeys</code> parameter was included in the
* <a href="https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_SearchProfiles.html">SearchProfiles</a> request, the <code>FoundByItems</code> list should be
* interpreted based on the <code>LogicalOperator</code> used in the request:</p>
* <ul>
* <li>
* <p>
* <code>AND</code> - The profile included in the response matched all of the search keys
* specified in the request. The <code>FoundByItems</code> will include all of the key-value(s)
* pairs that were specified in the request (as this is a requirement of <code>AND</code> search logic).</p>
* </li>
* <li>
* <p>
* <code>OR</code> - The profile included in the response matched at least one of the
* search keys specified in the request. The <code>FoundByItems</code> will
* include each of the key-value(s) pairs that the profile was found by.</p>
* </li>
* </ul>
* <p>The <code>OR</code> relationship is the default behavior if the <code>LogicalOperator</code> parameter is
* not included in the <a href="https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_SearchProfiles.html">SearchProfiles</a> request.</p>
*/
FoundByItems?: FoundByKeyValue[];
}

export interface SearchProfilesResponse {
/**
* <p>The list of SearchProfiles instances.</p>
* <p>The list of Profiles matching the search criteria.</p>
*/
Items?: Profile[];

Expand Down Expand Up @@ -3577,6 +3673,13 @@ export interface UpdateProfileResponse {
ProfileId: string | undefined;
}

/**
* @internal
*/
export const AdditionalSearchKeyFilterSensitiveLog = (obj: AdditionalSearchKey): any => ({
...obj,
});

/**
* @internal
*/
Expand Down Expand Up @@ -4392,6 +4495,13 @@ export const SearchProfilesRequestFilterSensitiveLog = (obj: SearchProfilesReque
...obj,
});

/**
* @internal
*/
export const FoundByKeyValueFilterSensitiveLog = (obj: FoundByKeyValue): any => ({
...obj,
});

/**
* @internal
*/
Expand Down
42 changes: 42 additions & 0 deletions clients/client-customer-profiles/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ import { UpdateProfileCommandInput, UpdateProfileCommandOutput } from "../comman
import { CustomerProfilesServiceException as __BaseException } from "../models/CustomerProfilesServiceException";
import {
AccessDeniedException,
AdditionalSearchKey,
Address,
AppflowIntegration,
AppflowIntegrationWorkflowAttributes,
Expand All @@ -119,6 +120,7 @@ import {
ExportingLocation,
FieldSourceProfileIds,
FlowDefinition,
FoundByKeyValue,
IdentityResolutionJob,
IncrementalPullConfig,
IntegrationConfig,
Expand Down Expand Up @@ -1120,7 +1122,11 @@ export const serializeAws_restJson1SearchProfilesCommand = async (
});
let body: any;
body = JSON.stringify({
...(input.AdditionalSearchKeys != null && {
AdditionalSearchKeys: serializeAws_restJson1additionalSearchKeysList(input.AdditionalSearchKeys, context),
}),
...(input.KeyName != null && { KeyName: input.KeyName }),
...(input.LogicalOperator != null && { LogicalOperator: input.LogicalOperator }),
...(input.Values != null && { Values: serializeAws_restJson1requestValueList(input.Values, context) }),
});
return new __HttpRequest({
Expand Down Expand Up @@ -3643,6 +3649,21 @@ const deserializeAws_restJson1ThrottlingExceptionResponse = async (
return __decorateServiceException(exception, parsedOutput.body);
};

const serializeAws_restJson1AdditionalSearchKey = (input: AdditionalSearchKey, context: __SerdeContext): any => {
return {
...(input.KeyName != null && { KeyName: input.KeyName }),
...(input.Values != null && { Values: serializeAws_restJson1requestValueList(input.Values, context) }),
};
};

const serializeAws_restJson1additionalSearchKeysList = (input: AdditionalSearchKey[], context: __SerdeContext): any => {
return input
.filter((e: any) => e != null)
.map((entry) => {
return serializeAws_restJson1AdditionalSearchKey(entry, context);
});
};

const serializeAws_restJson1Address = (input: Address, context: __SerdeContext): any => {
return {
...(input.Address1 != null && { Address1: input.Address1 }),
Expand Down Expand Up @@ -4310,6 +4331,25 @@ const deserializeAws_restJson1FieldNameList = (output: any, context: __SerdeCont
return retVal;
};

const deserializeAws_restJson1FoundByKeyValue = (output: any, context: __SerdeContext): FoundByKeyValue => {
return {
KeyName: __expectString(output.KeyName),
Values: output.Values != null ? deserializeAws_restJson1requestValueList(output.Values, context) : undefined,
} as any;
};

const deserializeAws_restJson1foundByList = (output: any, context: __SerdeContext): FoundByKeyValue[] => {
const retVal = (output || [])
.filter((e: any) => e != null)
.map((entry: any) => {
if (entry === null) {
return null as any;
}
return deserializeAws_restJson1FoundByKeyValue(entry, context);
});
return retVal;
};

const deserializeAws_restJson1IdentityResolutionJob = (output: any, context: __SerdeContext): IdentityResolutionJob => {
return {
DomainName: __expectString(output.DomainName),
Expand Down Expand Up @@ -4588,6 +4628,8 @@ const deserializeAws_restJson1Profile = (output: any, context: __SerdeContext):
BusinessPhoneNumber: __expectString(output.BusinessPhoneNumber),
EmailAddress: __expectString(output.EmailAddress),
FirstName: __expectString(output.FirstName),
FoundByItems:
output.FoundByItems != null ? deserializeAws_restJson1foundByList(output.FoundByItems, context) : undefined,
Gender: __expectString(output.Gender),
HomePhoneNumber: __expectString(output.HomePhoneNumber),
LastName: __expectString(output.LastName),
Expand Down

0 comments on commit ae0500b

Please sign in to comment.