From 400c893def58322eb686fc16841622b8aeb83b14 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 29 Nov 2023 22:02:08 -0800 Subject: [PATCH] feat: [analytics-data] add `CreateRecurringAudienceList`, `GetRecurringAudienceList`, `ListRecurringAudienceLists` methods to the Data API v1 alpha (#4851) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add `CreateRecurringAudienceList`, `GetRecurringAudienceList`, `ListRecurringAudienceLists` methods to the Data API v1 alpha feat: add the `RecurringAudienceList` type feat: add `percentage_completed`, `recurring_audience_list` fields to the `AudienceList` resource PiperOrigin-RevId: 586431787 Source-Link: https://github.com/googleapis/googleapis/commit/9ca4a254e367fb515c25f1dcfbce7200df2b681d Source-Link: https://github.com/googleapis/googleapis-gen/commit/eb27a8feb83f4462b4f3bf3d0b4ef6cfafa29a98 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFuYWx5dGljcy1kYXRhLy5Pd2xCb3QueWFtbCIsImgiOiJlYjI3YThmZWI4M2Y0NDYyYjRmM2JmM2QwYjRlZjZjZmFmYTI5YTk4In0= * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot Co-authored-by: sofisl <55454395+sofisl@users.noreply.github.com> --- packages/google-analytics-data/README.md | 3 + .../data/v1alpha/analytics_data_api.proto | 209 ++- .../google-analytics-data/protos/protos.d.ts | 626 +++++++ .../google-analytics-data/protos/protos.js | 1503 +++++++++++++++++ .../google-analytics-data/protos/protos.json | 224 +++ .../google-analytics-data/samples/README.md | 54 + ...ics_data.create_recurring_audience_list.js | 67 + ...lytics_data.get_recurring_audience_list.js | 63 + ...tics_data.list_recurring_audience_lists.js | 80 + ...etadata_google.analytics.data.v1alpha.json | 132 ++ .../v1alpha/alpha_analytics_data_client.ts | 518 ++++++ .../alpha_analytics_data_client_config.json | 15 + .../src/v1alpha/gapic_metadata.json | 34 + .../gapic_alpha_analytics_data_v1alpha.ts | 778 ++++++++- 14 files changed, 4273 insertions(+), 33 deletions(-) create mode 100644 packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.create_recurring_audience_list.js create mode 100644 packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.get_recurring_audience_list.js create mode 100644 packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.list_recurring_audience_lists.js diff --git a/packages/google-analytics-data/README.md b/packages/google-analytics-data/README.md index 59273c8cc89..81146b2ccc7 100644 --- a/packages/google-analytics-data/README.md +++ b/packages/google-analytics-data/README.md @@ -110,8 +110,11 @@ Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/ | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | | Alpha_analytics_data.create_audience_list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.create_audience_list.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.create_audience_list.js,packages/google-analytics-data/samples/README.md) | +| Alpha_analytics_data.create_recurring_audience_list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.create_recurring_audience_list.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.create_recurring_audience_list.js,packages/google-analytics-data/samples/README.md) | | Alpha_analytics_data.get_audience_list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.get_audience_list.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.get_audience_list.js,packages/google-analytics-data/samples/README.md) | +| Alpha_analytics_data.get_recurring_audience_list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.get_recurring_audience_list.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.get_recurring_audience_list.js,packages/google-analytics-data/samples/README.md) | | Alpha_analytics_data.list_audience_lists | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.list_audience_lists.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.list_audience_lists.js,packages/google-analytics-data/samples/README.md) | +| Alpha_analytics_data.list_recurring_audience_lists | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.list_recurring_audience_lists.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.list_recurring_audience_lists.js,packages/google-analytics-data/samples/README.md) | | Alpha_analytics_data.query_audience_list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.query_audience_list.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.query_audience_list.js,packages/google-analytics-data/samples/README.md) | | Alpha_analytics_data.run_funnel_report | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.run_funnel_report.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.run_funnel_report.js,packages/google-analytics-data/samples/README.md) | | Alpha_analytics_data.sheet_export_audience_list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.sheet_export_audience_list.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.sheet_export_audience_list.js,packages/google-analytics-data/samples/README.md) | diff --git a/packages/google-analytics-data/protos/google/analytics/data/v1alpha/analytics_data_api.proto b/packages/google-analytics-data/protos/google/analytics/data/v1alpha/analytics_data_api.proto index 9faf7f9bcbb..4e4bde0d18e 100644 --- a/packages/google-analytics-data/protos/google/analytics/data/v1alpha/analytics_data_api.proto +++ b/packages/google-analytics-data/protos/google/analytics/data/v1alpha/analytics_data_api.proto @@ -201,6 +201,200 @@ service AlphaAnalyticsData { }; option (google.api.method_signature) = "parent"; } + + // Creates a recurring audience list. Recurring audience lists produces new + // audience lists each day. Audience lists are users in an audience at the + // time of the list's creation. + // + // A recurring audience list ensures that you have audience list based on the + // most recent data available for use each day. If you manually create + // audience list, you don't know when an audience list based on an additional + // day's data is available. This recurring audience list automates the + // creation of an audience list when an additional day's data is available. + // You will consume fewer quota tokens by using recurring audience list versus + // manually creating audience list at various times of day trying to guess + // when an additional day's data is ready. + // + // This method is introduced at alpha stability with the intention of + // gathering feedback on syntax and capabilities before entering beta. To give + // your feedback on this API, complete the + // [Google Analytics Audience Export API + // Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form. + rpc CreateRecurringAudienceList(CreateRecurringAudienceListRequest) + returns (RecurringAudienceList) { + option (google.api.http) = { + post: "/v1alpha/{parent=properties/*}/recurringAudienceLists" + body: "recurring_audience_list" + }; + option (google.api.method_signature) = "parent,recurring_audience_list"; + } + + // Gets configuration metadata about a specific recurring audience list. This + // method can be used to understand a recurring audience list's state after it + // has been created. For example, a recurring audience list resource will + // generate audience list instances for each day, and this method can be used + // to get the resource name of the most recent audience list instance. + // + // This method is introduced at alpha stability with the intention of + // gathering feedback on syntax and capabilities before entering beta. To give + // your feedback on this API, complete the + // [Google Analytics Audience Export API + // Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form. + rpc GetRecurringAudienceList(GetRecurringAudienceListRequest) + returns (RecurringAudienceList) { + option (google.api.http) = { + get: "/v1alpha/{name=properties/*/recurringAudienceLists/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all recurring audience lists for a property. This method can be used + // for you to find and reuse existing recurring audience lists rather than + // creating unnecessary new recurring audience lists. The same audience can + // have multiple recurring audience lists that represent different dimension + // combinations; for example, just the dimension `deviceId` or both the + // dimensions `deviceId` and `userId`. + // + // This method is introduced at alpha stability with the intention of + // gathering feedback on syntax and capabilities before entering beta. To give + // your feedback on this API, complete the + // [Google Analytics Audience Export API + // Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form. + rpc ListRecurringAudienceLists(ListRecurringAudienceListsRequest) + returns (ListRecurringAudienceListsResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=properties/*}/recurringAudienceLists" + }; + option (google.api.method_signature) = "parent"; + } +} + +// A request to create a new recurring audience list. +message CreateRecurringAudienceListRequest { + // Required. The parent resource where this recurring audience list will be + // created. Format: `properties/{property}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "analyticsdata.googleapis.com/RecurringAudienceList" + } + ]; + + // Required. The recurring audience list to create. + RecurringAudienceList recurring_audience_list = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// A recurring audience list produces new audience lists each day. Audience +// lists are users in an audience at the time of the list's creation. A +// recurring audience list ensures that you have audience list based on the most +// recent data available for use each day. +message RecurringAudienceList { + option (google.api.resource) = { + type: "analyticsdata.googleapis.com/RecurringAudienceList" + pattern: "properties/{property}/recurringAudienceLists/{recurring_audience_list}" + plural: "recurringAudienceLists" + singular: "recurringAudienceList" + }; + + // Output only. Identifier. The recurring audience list resource name assigned + // during creation. This resource name identifies this + // `RecurringAudienceList`. + // + // Format: + // `properties/{property}/recurringAudienceLists/{recurring_audience_list}` + string name = 1 [ + (google.api.field_behavior) = IDENTIFIER, + (google.api.field_behavior) = OUTPUT_ONLY + ]; + + // Required. The audience resource name. This resource name identifies the + // audience being listed and is shared between the Analytics Data & Admin + // APIs. + // + // Format: `properties/{property}/audiences/{audience}` + string audience = 2 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The descriptive display name for this audience. For example, + // "Purchasers". + string audience_display_name = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The dimensions requested and displayed in the audience list + // response. + repeated AudienceDimension dimensions = 4 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. The number of remaining days that a recurring audience export + // will produce an audience list instance. This counter decreases by one each + // day, and when it reaches zero, no new audience lists will be created. + // + // Recurring audience list request for Analytics 360 properties default to 180 + // days and have a maximum of 365 days. Requests for standard Analytics + // properties default to 14 days and have a maximum of 30 days. + // + // The minimum value allowed during creation is 1. Requests above their + // respective maximum will be coerced to their maximum. + optional int32 active_days_remaining = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Audience list resource names for audience list instances + // created for this recurring audience list. One audience list is created for + // each day, and the audience list will be listed here. + // + // This list is ordered with the most recently created audience list first. + repeated string audience_lists = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A request to retrieve configuration metadata about a specific recurring +// audience list. +message GetRecurringAudienceListRequest { + // Required. The recurring audience list resource name. + // Format: + // `properties/{property}/recurringAudienceLists/{recurring_audience_list}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "analyticsdata.googleapis.com/RecurringAudienceList" + } + ]; +} + +// A request to list all recurring audience lists for a property. +message ListRecurringAudienceListsRequest { + // Required. All recurring audience lists for this property will be listed in + // the response. Format: `properties/{property}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "analyticsdata.googleapis.com/RecurringAudienceList" + } + ]; + + // Optional. The maximum number of recurring audience lists to return. The + // service may return fewer than this value. If unspecified, at most 200 + // recurring audience lists will be returned. The maximum value is 1000 + // (higher values will be coerced to the maximum). + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous + // `ListRecurringAudienceLists` call. Provide this to retrieve the subsequent + // page. + // + // When paginating, all other parameters provided to + // `ListRecurringAudienceLists` must match the call that provided the page + // token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A list of all recurring audience lists for a property. +message ListRecurringAudienceListsResponse { + // Each recurring audience list for a property. + repeated RecurringAudienceList recurring_audience_lists = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + optional string next_page_token = 2; } // A request to retrieve configuration metadata about a specific audience list. @@ -315,7 +509,7 @@ message AudienceList { // "Purchasers". string audience_display_name = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Required. The dimensions requested and displayed in the report response. + // Required. The dimensions requested and displayed in the query response. repeated AudienceDimension dimensions = 4 [(google.api.field_behavior) = REQUIRED]; @@ -340,6 +534,19 @@ message AudienceList { // Output only. Error message is populated when an audience list fails during // creation. A common reason for such a failure is quota exhaustion. optional string error_message = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The percentage completed for this audience export ranging + // between 0 to 100. + optional double percentage_completed = 11 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The recurring audience list that created this audience list. + // Recurring audience lists create audience lists daily. + // + // If audience lists are created directly, they will have no associated + // recurring audience list, and this field will be blank. + optional string recurring_audience_list = 12 + [(google.api.field_behavior) = OUTPUT_ONLY]; } // This metadata is currently blank. diff --git a/packages/google-analytics-data/protos/protos.d.ts b/packages/google-analytics-data/protos/protos.d.ts index d8cd040a9b6..d21957488b0 100644 --- a/packages/google-analytics-data/protos/protos.d.ts +++ b/packages/google-analytics-data/protos/protos.d.ts @@ -3930,6 +3930,48 @@ export namespace google { * @returns Promise */ public listAudienceLists(request: google.analytics.data.v1alpha.IListAudienceListsRequest): Promise; + + /** + * Calls CreateRecurringAudienceList. + * @param request CreateRecurringAudienceListRequest message or plain object + * @param callback Node-style callback called with the error, if any, and RecurringAudienceList + */ + public createRecurringAudienceList(request: google.analytics.data.v1alpha.ICreateRecurringAudienceListRequest, callback: google.analytics.data.v1alpha.AlphaAnalyticsData.CreateRecurringAudienceListCallback): void; + + /** + * Calls CreateRecurringAudienceList. + * @param request CreateRecurringAudienceListRequest message or plain object + * @returns Promise + */ + public createRecurringAudienceList(request: google.analytics.data.v1alpha.ICreateRecurringAudienceListRequest): Promise; + + /** + * Calls GetRecurringAudienceList. + * @param request GetRecurringAudienceListRequest message or plain object + * @param callback Node-style callback called with the error, if any, and RecurringAudienceList + */ + public getRecurringAudienceList(request: google.analytics.data.v1alpha.IGetRecurringAudienceListRequest, callback: google.analytics.data.v1alpha.AlphaAnalyticsData.GetRecurringAudienceListCallback): void; + + /** + * Calls GetRecurringAudienceList. + * @param request GetRecurringAudienceListRequest message or plain object + * @returns Promise + */ + public getRecurringAudienceList(request: google.analytics.data.v1alpha.IGetRecurringAudienceListRequest): Promise; + + /** + * Calls ListRecurringAudienceLists. + * @param request ListRecurringAudienceListsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListRecurringAudienceListsResponse + */ + public listRecurringAudienceLists(request: google.analytics.data.v1alpha.IListRecurringAudienceListsRequest, callback: google.analytics.data.v1alpha.AlphaAnalyticsData.ListRecurringAudienceListsCallback): void; + + /** + * Calls ListRecurringAudienceLists. + * @param request ListRecurringAudienceListsRequest message or plain object + * @returns Promise + */ + public listRecurringAudienceLists(request: google.analytics.data.v1alpha.IListRecurringAudienceListsRequest): Promise; } namespace AlphaAnalyticsData { @@ -3975,6 +4017,572 @@ export namespace google { * @param [response] ListAudienceListsResponse */ type ListAudienceListsCallback = (error: (Error|null), response?: google.analytics.data.v1alpha.ListAudienceListsResponse) => void; + + /** + * Callback as used by {@link google.analytics.data.v1alpha.AlphaAnalyticsData|createRecurringAudienceList}. + * @param error Error, if any + * @param [response] RecurringAudienceList + */ + type CreateRecurringAudienceListCallback = (error: (Error|null), response?: google.analytics.data.v1alpha.RecurringAudienceList) => void; + + /** + * Callback as used by {@link google.analytics.data.v1alpha.AlphaAnalyticsData|getRecurringAudienceList}. + * @param error Error, if any + * @param [response] RecurringAudienceList + */ + type GetRecurringAudienceListCallback = (error: (Error|null), response?: google.analytics.data.v1alpha.RecurringAudienceList) => void; + + /** + * Callback as used by {@link google.analytics.data.v1alpha.AlphaAnalyticsData|listRecurringAudienceLists}. + * @param error Error, if any + * @param [response] ListRecurringAudienceListsResponse + */ + type ListRecurringAudienceListsCallback = (error: (Error|null), response?: google.analytics.data.v1alpha.ListRecurringAudienceListsResponse) => void; + } + + /** Properties of a CreateRecurringAudienceListRequest. */ + interface ICreateRecurringAudienceListRequest { + + /** CreateRecurringAudienceListRequest parent */ + parent?: (string|null); + + /** CreateRecurringAudienceListRequest recurringAudienceList */ + recurringAudienceList?: (google.analytics.data.v1alpha.IRecurringAudienceList|null); + } + + /** Represents a CreateRecurringAudienceListRequest. */ + class CreateRecurringAudienceListRequest implements ICreateRecurringAudienceListRequest { + + /** + * Constructs a new CreateRecurringAudienceListRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.analytics.data.v1alpha.ICreateRecurringAudienceListRequest); + + /** CreateRecurringAudienceListRequest parent. */ + public parent: string; + + /** CreateRecurringAudienceListRequest recurringAudienceList. */ + public recurringAudienceList?: (google.analytics.data.v1alpha.IRecurringAudienceList|null); + + /** + * Creates a new CreateRecurringAudienceListRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateRecurringAudienceListRequest instance + */ + public static create(properties?: google.analytics.data.v1alpha.ICreateRecurringAudienceListRequest): google.analytics.data.v1alpha.CreateRecurringAudienceListRequest; + + /** + * Encodes the specified CreateRecurringAudienceListRequest message. Does not implicitly {@link google.analytics.data.v1alpha.CreateRecurringAudienceListRequest.verify|verify} messages. + * @param message CreateRecurringAudienceListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.analytics.data.v1alpha.ICreateRecurringAudienceListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateRecurringAudienceListRequest message, length delimited. Does not implicitly {@link google.analytics.data.v1alpha.CreateRecurringAudienceListRequest.verify|verify} messages. + * @param message CreateRecurringAudienceListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.analytics.data.v1alpha.ICreateRecurringAudienceListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateRecurringAudienceListRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateRecurringAudienceListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.analytics.data.v1alpha.CreateRecurringAudienceListRequest; + + /** + * Decodes a CreateRecurringAudienceListRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateRecurringAudienceListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.analytics.data.v1alpha.CreateRecurringAudienceListRequest; + + /** + * Verifies a CreateRecurringAudienceListRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateRecurringAudienceListRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateRecurringAudienceListRequest + */ + public static fromObject(object: { [k: string]: any }): google.analytics.data.v1alpha.CreateRecurringAudienceListRequest; + + /** + * Creates a plain object from a CreateRecurringAudienceListRequest message. Also converts values to other types if specified. + * @param message CreateRecurringAudienceListRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.analytics.data.v1alpha.CreateRecurringAudienceListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateRecurringAudienceListRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateRecurringAudienceListRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RecurringAudienceList. */ + interface IRecurringAudienceList { + + /** RecurringAudienceList name */ + name?: (string|null); + + /** RecurringAudienceList audience */ + audience?: (string|null); + + /** RecurringAudienceList audienceDisplayName */ + audienceDisplayName?: (string|null); + + /** RecurringAudienceList dimensions */ + dimensions?: (google.analytics.data.v1alpha.IAudienceDimension[]|null); + + /** RecurringAudienceList activeDaysRemaining */ + activeDaysRemaining?: (number|null); + + /** RecurringAudienceList audienceLists */ + audienceLists?: (string[]|null); + } + + /** Represents a RecurringAudienceList. */ + class RecurringAudienceList implements IRecurringAudienceList { + + /** + * Constructs a new RecurringAudienceList. + * @param [properties] Properties to set + */ + constructor(properties?: google.analytics.data.v1alpha.IRecurringAudienceList); + + /** RecurringAudienceList name. */ + public name: string; + + /** RecurringAudienceList audience. */ + public audience: string; + + /** RecurringAudienceList audienceDisplayName. */ + public audienceDisplayName: string; + + /** RecurringAudienceList dimensions. */ + public dimensions: google.analytics.data.v1alpha.IAudienceDimension[]; + + /** RecurringAudienceList activeDaysRemaining. */ + public activeDaysRemaining?: (number|null); + + /** RecurringAudienceList audienceLists. */ + public audienceLists: string[]; + + /** RecurringAudienceList _activeDaysRemaining. */ + public _activeDaysRemaining?: "activeDaysRemaining"; + + /** + * Creates a new RecurringAudienceList instance using the specified properties. + * @param [properties] Properties to set + * @returns RecurringAudienceList instance + */ + public static create(properties?: google.analytics.data.v1alpha.IRecurringAudienceList): google.analytics.data.v1alpha.RecurringAudienceList; + + /** + * Encodes the specified RecurringAudienceList message. Does not implicitly {@link google.analytics.data.v1alpha.RecurringAudienceList.verify|verify} messages. + * @param message RecurringAudienceList message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.analytics.data.v1alpha.IRecurringAudienceList, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RecurringAudienceList message, length delimited. Does not implicitly {@link google.analytics.data.v1alpha.RecurringAudienceList.verify|verify} messages. + * @param message RecurringAudienceList message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.analytics.data.v1alpha.IRecurringAudienceList, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RecurringAudienceList message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RecurringAudienceList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.analytics.data.v1alpha.RecurringAudienceList; + + /** + * Decodes a RecurringAudienceList message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RecurringAudienceList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.analytics.data.v1alpha.RecurringAudienceList; + + /** + * Verifies a RecurringAudienceList message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RecurringAudienceList message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RecurringAudienceList + */ + public static fromObject(object: { [k: string]: any }): google.analytics.data.v1alpha.RecurringAudienceList; + + /** + * Creates a plain object from a RecurringAudienceList message. Also converts values to other types if specified. + * @param message RecurringAudienceList + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.analytics.data.v1alpha.RecurringAudienceList, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RecurringAudienceList to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RecurringAudienceList + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetRecurringAudienceListRequest. */ + interface IGetRecurringAudienceListRequest { + + /** GetRecurringAudienceListRequest name */ + name?: (string|null); + } + + /** Represents a GetRecurringAudienceListRequest. */ + class GetRecurringAudienceListRequest implements IGetRecurringAudienceListRequest { + + /** + * Constructs a new GetRecurringAudienceListRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.analytics.data.v1alpha.IGetRecurringAudienceListRequest); + + /** GetRecurringAudienceListRequest name. */ + public name: string; + + /** + * Creates a new GetRecurringAudienceListRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetRecurringAudienceListRequest instance + */ + public static create(properties?: google.analytics.data.v1alpha.IGetRecurringAudienceListRequest): google.analytics.data.v1alpha.GetRecurringAudienceListRequest; + + /** + * Encodes the specified GetRecurringAudienceListRequest message. Does not implicitly {@link google.analytics.data.v1alpha.GetRecurringAudienceListRequest.verify|verify} messages. + * @param message GetRecurringAudienceListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.analytics.data.v1alpha.IGetRecurringAudienceListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetRecurringAudienceListRequest message, length delimited. Does not implicitly {@link google.analytics.data.v1alpha.GetRecurringAudienceListRequest.verify|verify} messages. + * @param message GetRecurringAudienceListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.analytics.data.v1alpha.IGetRecurringAudienceListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetRecurringAudienceListRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetRecurringAudienceListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.analytics.data.v1alpha.GetRecurringAudienceListRequest; + + /** + * Decodes a GetRecurringAudienceListRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetRecurringAudienceListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.analytics.data.v1alpha.GetRecurringAudienceListRequest; + + /** + * Verifies a GetRecurringAudienceListRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetRecurringAudienceListRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetRecurringAudienceListRequest + */ + public static fromObject(object: { [k: string]: any }): google.analytics.data.v1alpha.GetRecurringAudienceListRequest; + + /** + * Creates a plain object from a GetRecurringAudienceListRequest message. Also converts values to other types if specified. + * @param message GetRecurringAudienceListRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.analytics.data.v1alpha.GetRecurringAudienceListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetRecurringAudienceListRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetRecurringAudienceListRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListRecurringAudienceListsRequest. */ + interface IListRecurringAudienceListsRequest { + + /** ListRecurringAudienceListsRequest parent */ + parent?: (string|null); + + /** ListRecurringAudienceListsRequest pageSize */ + pageSize?: (number|null); + + /** ListRecurringAudienceListsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListRecurringAudienceListsRequest. */ + class ListRecurringAudienceListsRequest implements IListRecurringAudienceListsRequest { + + /** + * Constructs a new ListRecurringAudienceListsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.analytics.data.v1alpha.IListRecurringAudienceListsRequest); + + /** ListRecurringAudienceListsRequest parent. */ + public parent: string; + + /** ListRecurringAudienceListsRequest pageSize. */ + public pageSize: number; + + /** ListRecurringAudienceListsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListRecurringAudienceListsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListRecurringAudienceListsRequest instance + */ + public static create(properties?: google.analytics.data.v1alpha.IListRecurringAudienceListsRequest): google.analytics.data.v1alpha.ListRecurringAudienceListsRequest; + + /** + * Encodes the specified ListRecurringAudienceListsRequest message. Does not implicitly {@link google.analytics.data.v1alpha.ListRecurringAudienceListsRequest.verify|verify} messages. + * @param message ListRecurringAudienceListsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.analytics.data.v1alpha.IListRecurringAudienceListsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListRecurringAudienceListsRequest message, length delimited. Does not implicitly {@link google.analytics.data.v1alpha.ListRecurringAudienceListsRequest.verify|verify} messages. + * @param message ListRecurringAudienceListsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.analytics.data.v1alpha.IListRecurringAudienceListsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListRecurringAudienceListsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListRecurringAudienceListsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.analytics.data.v1alpha.ListRecurringAudienceListsRequest; + + /** + * Decodes a ListRecurringAudienceListsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListRecurringAudienceListsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.analytics.data.v1alpha.ListRecurringAudienceListsRequest; + + /** + * Verifies a ListRecurringAudienceListsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListRecurringAudienceListsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListRecurringAudienceListsRequest + */ + public static fromObject(object: { [k: string]: any }): google.analytics.data.v1alpha.ListRecurringAudienceListsRequest; + + /** + * Creates a plain object from a ListRecurringAudienceListsRequest message. Also converts values to other types if specified. + * @param message ListRecurringAudienceListsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.analytics.data.v1alpha.ListRecurringAudienceListsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListRecurringAudienceListsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListRecurringAudienceListsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListRecurringAudienceListsResponse. */ + interface IListRecurringAudienceListsResponse { + + /** ListRecurringAudienceListsResponse recurringAudienceLists */ + recurringAudienceLists?: (google.analytics.data.v1alpha.IRecurringAudienceList[]|null); + + /** ListRecurringAudienceListsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListRecurringAudienceListsResponse. */ + class ListRecurringAudienceListsResponse implements IListRecurringAudienceListsResponse { + + /** + * Constructs a new ListRecurringAudienceListsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.analytics.data.v1alpha.IListRecurringAudienceListsResponse); + + /** ListRecurringAudienceListsResponse recurringAudienceLists. */ + public recurringAudienceLists: google.analytics.data.v1alpha.IRecurringAudienceList[]; + + /** ListRecurringAudienceListsResponse nextPageToken. */ + public nextPageToken?: (string|null); + + /** ListRecurringAudienceListsResponse _nextPageToken. */ + public _nextPageToken?: "nextPageToken"; + + /** + * Creates a new ListRecurringAudienceListsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListRecurringAudienceListsResponse instance + */ + public static create(properties?: google.analytics.data.v1alpha.IListRecurringAudienceListsResponse): google.analytics.data.v1alpha.ListRecurringAudienceListsResponse; + + /** + * Encodes the specified ListRecurringAudienceListsResponse message. Does not implicitly {@link google.analytics.data.v1alpha.ListRecurringAudienceListsResponse.verify|verify} messages. + * @param message ListRecurringAudienceListsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.analytics.data.v1alpha.IListRecurringAudienceListsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListRecurringAudienceListsResponse message, length delimited. Does not implicitly {@link google.analytics.data.v1alpha.ListRecurringAudienceListsResponse.verify|verify} messages. + * @param message ListRecurringAudienceListsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.analytics.data.v1alpha.IListRecurringAudienceListsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListRecurringAudienceListsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListRecurringAudienceListsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.analytics.data.v1alpha.ListRecurringAudienceListsResponse; + + /** + * Decodes a ListRecurringAudienceListsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListRecurringAudienceListsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.analytics.data.v1alpha.ListRecurringAudienceListsResponse; + + /** + * Verifies a ListRecurringAudienceListsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListRecurringAudienceListsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListRecurringAudienceListsResponse + */ + public static fromObject(object: { [k: string]: any }): google.analytics.data.v1alpha.ListRecurringAudienceListsResponse; + + /** + * Creates a plain object from a ListRecurringAudienceListsResponse message. Also converts values to other types if specified. + * @param message ListRecurringAudienceListsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.analytics.data.v1alpha.ListRecurringAudienceListsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListRecurringAudienceListsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListRecurringAudienceListsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetAudienceListRequest. */ @@ -4421,6 +5029,12 @@ export namespace google { /** AudienceList errorMessage */ errorMessage?: (string|null); + + /** AudienceList percentageCompleted */ + percentageCompleted?: (number|null); + + /** AudienceList recurringAudienceList */ + recurringAudienceList?: (string|null); } /** Represents an AudienceList. */ @@ -4459,6 +5073,12 @@ export namespace google { /** AudienceList errorMessage. */ public errorMessage?: (string|null); + /** AudienceList percentageCompleted. */ + public percentageCompleted?: (number|null); + + /** AudienceList recurringAudienceList. */ + public recurringAudienceList?: (string|null); + /** AudienceList _state. */ public _state?: "state"; @@ -4471,6 +5091,12 @@ export namespace google { /** AudienceList _errorMessage. */ public _errorMessage?: "errorMessage"; + /** AudienceList _percentageCompleted. */ + public _percentageCompleted?: "percentageCompleted"; + + /** AudienceList _recurringAudienceList. */ + public _recurringAudienceList?: "recurringAudienceList"; + /** * Creates a new AudienceList instance using the specified properties. * @param [properties] Properties to set diff --git a/packages/google-analytics-data/protos/protos.js b/packages/google-analytics-data/protos/protos.js index 5c5d71d56fe..0ca7170d930 100644 --- a/packages/google-analytics-data/protos/protos.js +++ b/packages/google-analytics-data/protos/protos.js @@ -10845,9 +10845,1436 @@ * @variation 2 */ + /** + * Callback as used by {@link google.analytics.data.v1alpha.AlphaAnalyticsData|createRecurringAudienceList}. + * @memberof google.analytics.data.v1alpha.AlphaAnalyticsData + * @typedef CreateRecurringAudienceListCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.analytics.data.v1alpha.RecurringAudienceList} [response] RecurringAudienceList + */ + + /** + * Calls CreateRecurringAudienceList. + * @function createRecurringAudienceList + * @memberof google.analytics.data.v1alpha.AlphaAnalyticsData + * @instance + * @param {google.analytics.data.v1alpha.ICreateRecurringAudienceListRequest} request CreateRecurringAudienceListRequest message or plain object + * @param {google.analytics.data.v1alpha.AlphaAnalyticsData.CreateRecurringAudienceListCallback} callback Node-style callback called with the error, if any, and RecurringAudienceList + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(AlphaAnalyticsData.prototype.createRecurringAudienceList = function createRecurringAudienceList(request, callback) { + return this.rpcCall(createRecurringAudienceList, $root.google.analytics.data.v1alpha.CreateRecurringAudienceListRequest, $root.google.analytics.data.v1alpha.RecurringAudienceList, request, callback); + }, "name", { value: "CreateRecurringAudienceList" }); + + /** + * Calls CreateRecurringAudienceList. + * @function createRecurringAudienceList + * @memberof google.analytics.data.v1alpha.AlphaAnalyticsData + * @instance + * @param {google.analytics.data.v1alpha.ICreateRecurringAudienceListRequest} request CreateRecurringAudienceListRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.analytics.data.v1alpha.AlphaAnalyticsData|getRecurringAudienceList}. + * @memberof google.analytics.data.v1alpha.AlphaAnalyticsData + * @typedef GetRecurringAudienceListCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.analytics.data.v1alpha.RecurringAudienceList} [response] RecurringAudienceList + */ + + /** + * Calls GetRecurringAudienceList. + * @function getRecurringAudienceList + * @memberof google.analytics.data.v1alpha.AlphaAnalyticsData + * @instance + * @param {google.analytics.data.v1alpha.IGetRecurringAudienceListRequest} request GetRecurringAudienceListRequest message or plain object + * @param {google.analytics.data.v1alpha.AlphaAnalyticsData.GetRecurringAudienceListCallback} callback Node-style callback called with the error, if any, and RecurringAudienceList + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(AlphaAnalyticsData.prototype.getRecurringAudienceList = function getRecurringAudienceList(request, callback) { + return this.rpcCall(getRecurringAudienceList, $root.google.analytics.data.v1alpha.GetRecurringAudienceListRequest, $root.google.analytics.data.v1alpha.RecurringAudienceList, request, callback); + }, "name", { value: "GetRecurringAudienceList" }); + + /** + * Calls GetRecurringAudienceList. + * @function getRecurringAudienceList + * @memberof google.analytics.data.v1alpha.AlphaAnalyticsData + * @instance + * @param {google.analytics.data.v1alpha.IGetRecurringAudienceListRequest} request GetRecurringAudienceListRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.analytics.data.v1alpha.AlphaAnalyticsData|listRecurringAudienceLists}. + * @memberof google.analytics.data.v1alpha.AlphaAnalyticsData + * @typedef ListRecurringAudienceListsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.analytics.data.v1alpha.ListRecurringAudienceListsResponse} [response] ListRecurringAudienceListsResponse + */ + + /** + * Calls ListRecurringAudienceLists. + * @function listRecurringAudienceLists + * @memberof google.analytics.data.v1alpha.AlphaAnalyticsData + * @instance + * @param {google.analytics.data.v1alpha.IListRecurringAudienceListsRequest} request ListRecurringAudienceListsRequest message or plain object + * @param {google.analytics.data.v1alpha.AlphaAnalyticsData.ListRecurringAudienceListsCallback} callback Node-style callback called with the error, if any, and ListRecurringAudienceListsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(AlphaAnalyticsData.prototype.listRecurringAudienceLists = function listRecurringAudienceLists(request, callback) { + return this.rpcCall(listRecurringAudienceLists, $root.google.analytics.data.v1alpha.ListRecurringAudienceListsRequest, $root.google.analytics.data.v1alpha.ListRecurringAudienceListsResponse, request, callback); + }, "name", { value: "ListRecurringAudienceLists" }); + + /** + * Calls ListRecurringAudienceLists. + * @function listRecurringAudienceLists + * @memberof google.analytics.data.v1alpha.AlphaAnalyticsData + * @instance + * @param {google.analytics.data.v1alpha.IListRecurringAudienceListsRequest} request ListRecurringAudienceListsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + return AlphaAnalyticsData; })(); + v1alpha.CreateRecurringAudienceListRequest = (function() { + + /** + * Properties of a CreateRecurringAudienceListRequest. + * @memberof google.analytics.data.v1alpha + * @interface ICreateRecurringAudienceListRequest + * @property {string|null} [parent] CreateRecurringAudienceListRequest parent + * @property {google.analytics.data.v1alpha.IRecurringAudienceList|null} [recurringAudienceList] CreateRecurringAudienceListRequest recurringAudienceList + */ + + /** + * Constructs a new CreateRecurringAudienceListRequest. + * @memberof google.analytics.data.v1alpha + * @classdesc Represents a CreateRecurringAudienceListRequest. + * @implements ICreateRecurringAudienceListRequest + * @constructor + * @param {google.analytics.data.v1alpha.ICreateRecurringAudienceListRequest=} [properties] Properties to set + */ + function CreateRecurringAudienceListRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateRecurringAudienceListRequest parent. + * @member {string} parent + * @memberof google.analytics.data.v1alpha.CreateRecurringAudienceListRequest + * @instance + */ + CreateRecurringAudienceListRequest.prototype.parent = ""; + + /** + * CreateRecurringAudienceListRequest recurringAudienceList. + * @member {google.analytics.data.v1alpha.IRecurringAudienceList|null|undefined} recurringAudienceList + * @memberof google.analytics.data.v1alpha.CreateRecurringAudienceListRequest + * @instance + */ + CreateRecurringAudienceListRequest.prototype.recurringAudienceList = null; + + /** + * Creates a new CreateRecurringAudienceListRequest instance using the specified properties. + * @function create + * @memberof google.analytics.data.v1alpha.CreateRecurringAudienceListRequest + * @static + * @param {google.analytics.data.v1alpha.ICreateRecurringAudienceListRequest=} [properties] Properties to set + * @returns {google.analytics.data.v1alpha.CreateRecurringAudienceListRequest} CreateRecurringAudienceListRequest instance + */ + CreateRecurringAudienceListRequest.create = function create(properties) { + return new CreateRecurringAudienceListRequest(properties); + }; + + /** + * Encodes the specified CreateRecurringAudienceListRequest message. Does not implicitly {@link google.analytics.data.v1alpha.CreateRecurringAudienceListRequest.verify|verify} messages. + * @function encode + * @memberof google.analytics.data.v1alpha.CreateRecurringAudienceListRequest + * @static + * @param {google.analytics.data.v1alpha.ICreateRecurringAudienceListRequest} message CreateRecurringAudienceListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateRecurringAudienceListRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.recurringAudienceList != null && Object.hasOwnProperty.call(message, "recurringAudienceList")) + $root.google.analytics.data.v1alpha.RecurringAudienceList.encode(message.recurringAudienceList, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateRecurringAudienceListRequest message, length delimited. Does not implicitly {@link google.analytics.data.v1alpha.CreateRecurringAudienceListRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.analytics.data.v1alpha.CreateRecurringAudienceListRequest + * @static + * @param {google.analytics.data.v1alpha.ICreateRecurringAudienceListRequest} message CreateRecurringAudienceListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateRecurringAudienceListRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateRecurringAudienceListRequest message from the specified reader or buffer. + * @function decode + * @memberof google.analytics.data.v1alpha.CreateRecurringAudienceListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.analytics.data.v1alpha.CreateRecurringAudienceListRequest} CreateRecurringAudienceListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateRecurringAudienceListRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.analytics.data.v1alpha.CreateRecurringAudienceListRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.recurringAudienceList = $root.google.analytics.data.v1alpha.RecurringAudienceList.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateRecurringAudienceListRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.analytics.data.v1alpha.CreateRecurringAudienceListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.analytics.data.v1alpha.CreateRecurringAudienceListRequest} CreateRecurringAudienceListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateRecurringAudienceListRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateRecurringAudienceListRequest message. + * @function verify + * @memberof google.analytics.data.v1alpha.CreateRecurringAudienceListRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateRecurringAudienceListRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.recurringAudienceList != null && message.hasOwnProperty("recurringAudienceList")) { + var error = $root.google.analytics.data.v1alpha.RecurringAudienceList.verify(message.recurringAudienceList); + if (error) + return "recurringAudienceList." + error; + } + return null; + }; + + /** + * Creates a CreateRecurringAudienceListRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.analytics.data.v1alpha.CreateRecurringAudienceListRequest + * @static + * @param {Object.} object Plain object + * @returns {google.analytics.data.v1alpha.CreateRecurringAudienceListRequest} CreateRecurringAudienceListRequest + */ + CreateRecurringAudienceListRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.analytics.data.v1alpha.CreateRecurringAudienceListRequest) + return object; + var message = new $root.google.analytics.data.v1alpha.CreateRecurringAudienceListRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.recurringAudienceList != null) { + if (typeof object.recurringAudienceList !== "object") + throw TypeError(".google.analytics.data.v1alpha.CreateRecurringAudienceListRequest.recurringAudienceList: object expected"); + message.recurringAudienceList = $root.google.analytics.data.v1alpha.RecurringAudienceList.fromObject(object.recurringAudienceList); + } + return message; + }; + + /** + * Creates a plain object from a CreateRecurringAudienceListRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.analytics.data.v1alpha.CreateRecurringAudienceListRequest + * @static + * @param {google.analytics.data.v1alpha.CreateRecurringAudienceListRequest} message CreateRecurringAudienceListRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateRecurringAudienceListRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.recurringAudienceList = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.recurringAudienceList != null && message.hasOwnProperty("recurringAudienceList")) + object.recurringAudienceList = $root.google.analytics.data.v1alpha.RecurringAudienceList.toObject(message.recurringAudienceList, options); + return object; + }; + + /** + * Converts this CreateRecurringAudienceListRequest to JSON. + * @function toJSON + * @memberof google.analytics.data.v1alpha.CreateRecurringAudienceListRequest + * @instance + * @returns {Object.} JSON object + */ + CreateRecurringAudienceListRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateRecurringAudienceListRequest + * @function getTypeUrl + * @memberof google.analytics.data.v1alpha.CreateRecurringAudienceListRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateRecurringAudienceListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.analytics.data.v1alpha.CreateRecurringAudienceListRequest"; + }; + + return CreateRecurringAudienceListRequest; + })(); + + v1alpha.RecurringAudienceList = (function() { + + /** + * Properties of a RecurringAudienceList. + * @memberof google.analytics.data.v1alpha + * @interface IRecurringAudienceList + * @property {string|null} [name] RecurringAudienceList name + * @property {string|null} [audience] RecurringAudienceList audience + * @property {string|null} [audienceDisplayName] RecurringAudienceList audienceDisplayName + * @property {Array.|null} [dimensions] RecurringAudienceList dimensions + * @property {number|null} [activeDaysRemaining] RecurringAudienceList activeDaysRemaining + * @property {Array.|null} [audienceLists] RecurringAudienceList audienceLists + */ + + /** + * Constructs a new RecurringAudienceList. + * @memberof google.analytics.data.v1alpha + * @classdesc Represents a RecurringAudienceList. + * @implements IRecurringAudienceList + * @constructor + * @param {google.analytics.data.v1alpha.IRecurringAudienceList=} [properties] Properties to set + */ + function RecurringAudienceList(properties) { + this.dimensions = []; + this.audienceLists = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RecurringAudienceList name. + * @member {string} name + * @memberof google.analytics.data.v1alpha.RecurringAudienceList + * @instance + */ + RecurringAudienceList.prototype.name = ""; + + /** + * RecurringAudienceList audience. + * @member {string} audience + * @memberof google.analytics.data.v1alpha.RecurringAudienceList + * @instance + */ + RecurringAudienceList.prototype.audience = ""; + + /** + * RecurringAudienceList audienceDisplayName. + * @member {string} audienceDisplayName + * @memberof google.analytics.data.v1alpha.RecurringAudienceList + * @instance + */ + RecurringAudienceList.prototype.audienceDisplayName = ""; + + /** + * RecurringAudienceList dimensions. + * @member {Array.} dimensions + * @memberof google.analytics.data.v1alpha.RecurringAudienceList + * @instance + */ + RecurringAudienceList.prototype.dimensions = $util.emptyArray; + + /** + * RecurringAudienceList activeDaysRemaining. + * @member {number|null|undefined} activeDaysRemaining + * @memberof google.analytics.data.v1alpha.RecurringAudienceList + * @instance + */ + RecurringAudienceList.prototype.activeDaysRemaining = null; + + /** + * RecurringAudienceList audienceLists. + * @member {Array.} audienceLists + * @memberof google.analytics.data.v1alpha.RecurringAudienceList + * @instance + */ + RecurringAudienceList.prototype.audienceLists = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * RecurringAudienceList _activeDaysRemaining. + * @member {"activeDaysRemaining"|undefined} _activeDaysRemaining + * @memberof google.analytics.data.v1alpha.RecurringAudienceList + * @instance + */ + Object.defineProperty(RecurringAudienceList.prototype, "_activeDaysRemaining", { + get: $util.oneOfGetter($oneOfFields = ["activeDaysRemaining"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new RecurringAudienceList instance using the specified properties. + * @function create + * @memberof google.analytics.data.v1alpha.RecurringAudienceList + * @static + * @param {google.analytics.data.v1alpha.IRecurringAudienceList=} [properties] Properties to set + * @returns {google.analytics.data.v1alpha.RecurringAudienceList} RecurringAudienceList instance + */ + RecurringAudienceList.create = function create(properties) { + return new RecurringAudienceList(properties); + }; + + /** + * Encodes the specified RecurringAudienceList message. Does not implicitly {@link google.analytics.data.v1alpha.RecurringAudienceList.verify|verify} messages. + * @function encode + * @memberof google.analytics.data.v1alpha.RecurringAudienceList + * @static + * @param {google.analytics.data.v1alpha.IRecurringAudienceList} message RecurringAudienceList message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RecurringAudienceList.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.audience != null && Object.hasOwnProperty.call(message, "audience")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.audience); + if (message.audienceDisplayName != null && Object.hasOwnProperty.call(message, "audienceDisplayName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.audienceDisplayName); + if (message.dimensions != null && message.dimensions.length) + for (var i = 0; i < message.dimensions.length; ++i) + $root.google.analytics.data.v1alpha.AudienceDimension.encode(message.dimensions[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.activeDaysRemaining != null && Object.hasOwnProperty.call(message, "activeDaysRemaining")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.activeDaysRemaining); + if (message.audienceLists != null && message.audienceLists.length) + for (var i = 0; i < message.audienceLists.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.audienceLists[i]); + return writer; + }; + + /** + * Encodes the specified RecurringAudienceList message, length delimited. Does not implicitly {@link google.analytics.data.v1alpha.RecurringAudienceList.verify|verify} messages. + * @function encodeDelimited + * @memberof google.analytics.data.v1alpha.RecurringAudienceList + * @static + * @param {google.analytics.data.v1alpha.IRecurringAudienceList} message RecurringAudienceList message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RecurringAudienceList.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RecurringAudienceList message from the specified reader or buffer. + * @function decode + * @memberof google.analytics.data.v1alpha.RecurringAudienceList + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.analytics.data.v1alpha.RecurringAudienceList} RecurringAudienceList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RecurringAudienceList.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.analytics.data.v1alpha.RecurringAudienceList(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.audience = reader.string(); + break; + } + case 3: { + message.audienceDisplayName = reader.string(); + break; + } + case 4: { + if (!(message.dimensions && message.dimensions.length)) + message.dimensions = []; + message.dimensions.push($root.google.analytics.data.v1alpha.AudienceDimension.decode(reader, reader.uint32())); + break; + } + case 5: { + message.activeDaysRemaining = reader.int32(); + break; + } + case 6: { + if (!(message.audienceLists && message.audienceLists.length)) + message.audienceLists = []; + message.audienceLists.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RecurringAudienceList message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.analytics.data.v1alpha.RecurringAudienceList + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.analytics.data.v1alpha.RecurringAudienceList} RecurringAudienceList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RecurringAudienceList.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RecurringAudienceList message. + * @function verify + * @memberof google.analytics.data.v1alpha.RecurringAudienceList + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RecurringAudienceList.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.audience != null && message.hasOwnProperty("audience")) + if (!$util.isString(message.audience)) + return "audience: string expected"; + if (message.audienceDisplayName != null && message.hasOwnProperty("audienceDisplayName")) + if (!$util.isString(message.audienceDisplayName)) + return "audienceDisplayName: string expected"; + if (message.dimensions != null && message.hasOwnProperty("dimensions")) { + if (!Array.isArray(message.dimensions)) + return "dimensions: array expected"; + for (var i = 0; i < message.dimensions.length; ++i) { + var error = $root.google.analytics.data.v1alpha.AudienceDimension.verify(message.dimensions[i]); + if (error) + return "dimensions." + error; + } + } + if (message.activeDaysRemaining != null && message.hasOwnProperty("activeDaysRemaining")) { + properties._activeDaysRemaining = 1; + if (!$util.isInteger(message.activeDaysRemaining)) + return "activeDaysRemaining: integer expected"; + } + if (message.audienceLists != null && message.hasOwnProperty("audienceLists")) { + if (!Array.isArray(message.audienceLists)) + return "audienceLists: array expected"; + for (var i = 0; i < message.audienceLists.length; ++i) + if (!$util.isString(message.audienceLists[i])) + return "audienceLists: string[] expected"; + } + return null; + }; + + /** + * Creates a RecurringAudienceList message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.analytics.data.v1alpha.RecurringAudienceList + * @static + * @param {Object.} object Plain object + * @returns {google.analytics.data.v1alpha.RecurringAudienceList} RecurringAudienceList + */ + RecurringAudienceList.fromObject = function fromObject(object) { + if (object instanceof $root.google.analytics.data.v1alpha.RecurringAudienceList) + return object; + var message = new $root.google.analytics.data.v1alpha.RecurringAudienceList(); + if (object.name != null) + message.name = String(object.name); + if (object.audience != null) + message.audience = String(object.audience); + if (object.audienceDisplayName != null) + message.audienceDisplayName = String(object.audienceDisplayName); + if (object.dimensions) { + if (!Array.isArray(object.dimensions)) + throw TypeError(".google.analytics.data.v1alpha.RecurringAudienceList.dimensions: array expected"); + message.dimensions = []; + for (var i = 0; i < object.dimensions.length; ++i) { + if (typeof object.dimensions[i] !== "object") + throw TypeError(".google.analytics.data.v1alpha.RecurringAudienceList.dimensions: object expected"); + message.dimensions[i] = $root.google.analytics.data.v1alpha.AudienceDimension.fromObject(object.dimensions[i]); + } + } + if (object.activeDaysRemaining != null) + message.activeDaysRemaining = object.activeDaysRemaining | 0; + if (object.audienceLists) { + if (!Array.isArray(object.audienceLists)) + throw TypeError(".google.analytics.data.v1alpha.RecurringAudienceList.audienceLists: array expected"); + message.audienceLists = []; + for (var i = 0; i < object.audienceLists.length; ++i) + message.audienceLists[i] = String(object.audienceLists[i]); + } + return message; + }; + + /** + * Creates a plain object from a RecurringAudienceList message. Also converts values to other types if specified. + * @function toObject + * @memberof google.analytics.data.v1alpha.RecurringAudienceList + * @static + * @param {google.analytics.data.v1alpha.RecurringAudienceList} message RecurringAudienceList + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RecurringAudienceList.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.dimensions = []; + object.audienceLists = []; + } + if (options.defaults) { + object.name = ""; + object.audience = ""; + object.audienceDisplayName = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.audience != null && message.hasOwnProperty("audience")) + object.audience = message.audience; + if (message.audienceDisplayName != null && message.hasOwnProperty("audienceDisplayName")) + object.audienceDisplayName = message.audienceDisplayName; + if (message.dimensions && message.dimensions.length) { + object.dimensions = []; + for (var j = 0; j < message.dimensions.length; ++j) + object.dimensions[j] = $root.google.analytics.data.v1alpha.AudienceDimension.toObject(message.dimensions[j], options); + } + if (message.activeDaysRemaining != null && message.hasOwnProperty("activeDaysRemaining")) { + object.activeDaysRemaining = message.activeDaysRemaining; + if (options.oneofs) + object._activeDaysRemaining = "activeDaysRemaining"; + } + if (message.audienceLists && message.audienceLists.length) { + object.audienceLists = []; + for (var j = 0; j < message.audienceLists.length; ++j) + object.audienceLists[j] = message.audienceLists[j]; + } + return object; + }; + + /** + * Converts this RecurringAudienceList to JSON. + * @function toJSON + * @memberof google.analytics.data.v1alpha.RecurringAudienceList + * @instance + * @returns {Object.} JSON object + */ + RecurringAudienceList.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RecurringAudienceList + * @function getTypeUrl + * @memberof google.analytics.data.v1alpha.RecurringAudienceList + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RecurringAudienceList.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.analytics.data.v1alpha.RecurringAudienceList"; + }; + + return RecurringAudienceList; + })(); + + v1alpha.GetRecurringAudienceListRequest = (function() { + + /** + * Properties of a GetRecurringAudienceListRequest. + * @memberof google.analytics.data.v1alpha + * @interface IGetRecurringAudienceListRequest + * @property {string|null} [name] GetRecurringAudienceListRequest name + */ + + /** + * Constructs a new GetRecurringAudienceListRequest. + * @memberof google.analytics.data.v1alpha + * @classdesc Represents a GetRecurringAudienceListRequest. + * @implements IGetRecurringAudienceListRequest + * @constructor + * @param {google.analytics.data.v1alpha.IGetRecurringAudienceListRequest=} [properties] Properties to set + */ + function GetRecurringAudienceListRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetRecurringAudienceListRequest name. + * @member {string} name + * @memberof google.analytics.data.v1alpha.GetRecurringAudienceListRequest + * @instance + */ + GetRecurringAudienceListRequest.prototype.name = ""; + + /** + * Creates a new GetRecurringAudienceListRequest instance using the specified properties. + * @function create + * @memberof google.analytics.data.v1alpha.GetRecurringAudienceListRequest + * @static + * @param {google.analytics.data.v1alpha.IGetRecurringAudienceListRequest=} [properties] Properties to set + * @returns {google.analytics.data.v1alpha.GetRecurringAudienceListRequest} GetRecurringAudienceListRequest instance + */ + GetRecurringAudienceListRequest.create = function create(properties) { + return new GetRecurringAudienceListRequest(properties); + }; + + /** + * Encodes the specified GetRecurringAudienceListRequest message. Does not implicitly {@link google.analytics.data.v1alpha.GetRecurringAudienceListRequest.verify|verify} messages. + * @function encode + * @memberof google.analytics.data.v1alpha.GetRecurringAudienceListRequest + * @static + * @param {google.analytics.data.v1alpha.IGetRecurringAudienceListRequest} message GetRecurringAudienceListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetRecurringAudienceListRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetRecurringAudienceListRequest message, length delimited. Does not implicitly {@link google.analytics.data.v1alpha.GetRecurringAudienceListRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.analytics.data.v1alpha.GetRecurringAudienceListRequest + * @static + * @param {google.analytics.data.v1alpha.IGetRecurringAudienceListRequest} message GetRecurringAudienceListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetRecurringAudienceListRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetRecurringAudienceListRequest message from the specified reader or buffer. + * @function decode + * @memberof google.analytics.data.v1alpha.GetRecurringAudienceListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.analytics.data.v1alpha.GetRecurringAudienceListRequest} GetRecurringAudienceListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetRecurringAudienceListRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.analytics.data.v1alpha.GetRecurringAudienceListRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetRecurringAudienceListRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.analytics.data.v1alpha.GetRecurringAudienceListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.analytics.data.v1alpha.GetRecurringAudienceListRequest} GetRecurringAudienceListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetRecurringAudienceListRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetRecurringAudienceListRequest message. + * @function verify + * @memberof google.analytics.data.v1alpha.GetRecurringAudienceListRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetRecurringAudienceListRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetRecurringAudienceListRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.analytics.data.v1alpha.GetRecurringAudienceListRequest + * @static + * @param {Object.} object Plain object + * @returns {google.analytics.data.v1alpha.GetRecurringAudienceListRequest} GetRecurringAudienceListRequest + */ + GetRecurringAudienceListRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.analytics.data.v1alpha.GetRecurringAudienceListRequest) + return object; + var message = new $root.google.analytics.data.v1alpha.GetRecurringAudienceListRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetRecurringAudienceListRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.analytics.data.v1alpha.GetRecurringAudienceListRequest + * @static + * @param {google.analytics.data.v1alpha.GetRecurringAudienceListRequest} message GetRecurringAudienceListRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetRecurringAudienceListRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetRecurringAudienceListRequest to JSON. + * @function toJSON + * @memberof google.analytics.data.v1alpha.GetRecurringAudienceListRequest + * @instance + * @returns {Object.} JSON object + */ + GetRecurringAudienceListRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetRecurringAudienceListRequest + * @function getTypeUrl + * @memberof google.analytics.data.v1alpha.GetRecurringAudienceListRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetRecurringAudienceListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.analytics.data.v1alpha.GetRecurringAudienceListRequest"; + }; + + return GetRecurringAudienceListRequest; + })(); + + v1alpha.ListRecurringAudienceListsRequest = (function() { + + /** + * Properties of a ListRecurringAudienceListsRequest. + * @memberof google.analytics.data.v1alpha + * @interface IListRecurringAudienceListsRequest + * @property {string|null} [parent] ListRecurringAudienceListsRequest parent + * @property {number|null} [pageSize] ListRecurringAudienceListsRequest pageSize + * @property {string|null} [pageToken] ListRecurringAudienceListsRequest pageToken + */ + + /** + * Constructs a new ListRecurringAudienceListsRequest. + * @memberof google.analytics.data.v1alpha + * @classdesc Represents a ListRecurringAudienceListsRequest. + * @implements IListRecurringAudienceListsRequest + * @constructor + * @param {google.analytics.data.v1alpha.IListRecurringAudienceListsRequest=} [properties] Properties to set + */ + function ListRecurringAudienceListsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListRecurringAudienceListsRequest parent. + * @member {string} parent + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsRequest + * @instance + */ + ListRecurringAudienceListsRequest.prototype.parent = ""; + + /** + * ListRecurringAudienceListsRequest pageSize. + * @member {number} pageSize + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsRequest + * @instance + */ + ListRecurringAudienceListsRequest.prototype.pageSize = 0; + + /** + * ListRecurringAudienceListsRequest pageToken. + * @member {string} pageToken + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsRequest + * @instance + */ + ListRecurringAudienceListsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListRecurringAudienceListsRequest instance using the specified properties. + * @function create + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsRequest + * @static + * @param {google.analytics.data.v1alpha.IListRecurringAudienceListsRequest=} [properties] Properties to set + * @returns {google.analytics.data.v1alpha.ListRecurringAudienceListsRequest} ListRecurringAudienceListsRequest instance + */ + ListRecurringAudienceListsRequest.create = function create(properties) { + return new ListRecurringAudienceListsRequest(properties); + }; + + /** + * Encodes the specified ListRecurringAudienceListsRequest message. Does not implicitly {@link google.analytics.data.v1alpha.ListRecurringAudienceListsRequest.verify|verify} messages. + * @function encode + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsRequest + * @static + * @param {google.analytics.data.v1alpha.IListRecurringAudienceListsRequest} message ListRecurringAudienceListsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRecurringAudienceListsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListRecurringAudienceListsRequest message, length delimited. Does not implicitly {@link google.analytics.data.v1alpha.ListRecurringAudienceListsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsRequest + * @static + * @param {google.analytics.data.v1alpha.IListRecurringAudienceListsRequest} message ListRecurringAudienceListsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRecurringAudienceListsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListRecurringAudienceListsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.analytics.data.v1alpha.ListRecurringAudienceListsRequest} ListRecurringAudienceListsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRecurringAudienceListsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.analytics.data.v1alpha.ListRecurringAudienceListsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListRecurringAudienceListsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.analytics.data.v1alpha.ListRecurringAudienceListsRequest} ListRecurringAudienceListsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRecurringAudienceListsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListRecurringAudienceListsRequest message. + * @function verify + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListRecurringAudienceListsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListRecurringAudienceListsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.analytics.data.v1alpha.ListRecurringAudienceListsRequest} ListRecurringAudienceListsRequest + */ + ListRecurringAudienceListsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.analytics.data.v1alpha.ListRecurringAudienceListsRequest) + return object; + var message = new $root.google.analytics.data.v1alpha.ListRecurringAudienceListsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListRecurringAudienceListsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsRequest + * @static + * @param {google.analytics.data.v1alpha.ListRecurringAudienceListsRequest} message ListRecurringAudienceListsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListRecurringAudienceListsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListRecurringAudienceListsRequest to JSON. + * @function toJSON + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsRequest + * @instance + * @returns {Object.} JSON object + */ + ListRecurringAudienceListsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListRecurringAudienceListsRequest + * @function getTypeUrl + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListRecurringAudienceListsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.analytics.data.v1alpha.ListRecurringAudienceListsRequest"; + }; + + return ListRecurringAudienceListsRequest; + })(); + + v1alpha.ListRecurringAudienceListsResponse = (function() { + + /** + * Properties of a ListRecurringAudienceListsResponse. + * @memberof google.analytics.data.v1alpha + * @interface IListRecurringAudienceListsResponse + * @property {Array.|null} [recurringAudienceLists] ListRecurringAudienceListsResponse recurringAudienceLists + * @property {string|null} [nextPageToken] ListRecurringAudienceListsResponse nextPageToken + */ + + /** + * Constructs a new ListRecurringAudienceListsResponse. + * @memberof google.analytics.data.v1alpha + * @classdesc Represents a ListRecurringAudienceListsResponse. + * @implements IListRecurringAudienceListsResponse + * @constructor + * @param {google.analytics.data.v1alpha.IListRecurringAudienceListsResponse=} [properties] Properties to set + */ + function ListRecurringAudienceListsResponse(properties) { + this.recurringAudienceLists = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListRecurringAudienceListsResponse recurringAudienceLists. + * @member {Array.} recurringAudienceLists + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsResponse + * @instance + */ + ListRecurringAudienceListsResponse.prototype.recurringAudienceLists = $util.emptyArray; + + /** + * ListRecurringAudienceListsResponse nextPageToken. + * @member {string|null|undefined} nextPageToken + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsResponse + * @instance + */ + ListRecurringAudienceListsResponse.prototype.nextPageToken = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ListRecurringAudienceListsResponse _nextPageToken. + * @member {"nextPageToken"|undefined} _nextPageToken + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsResponse + * @instance + */ + Object.defineProperty(ListRecurringAudienceListsResponse.prototype, "_nextPageToken", { + get: $util.oneOfGetter($oneOfFields = ["nextPageToken"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ListRecurringAudienceListsResponse instance using the specified properties. + * @function create + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsResponse + * @static + * @param {google.analytics.data.v1alpha.IListRecurringAudienceListsResponse=} [properties] Properties to set + * @returns {google.analytics.data.v1alpha.ListRecurringAudienceListsResponse} ListRecurringAudienceListsResponse instance + */ + ListRecurringAudienceListsResponse.create = function create(properties) { + return new ListRecurringAudienceListsResponse(properties); + }; + + /** + * Encodes the specified ListRecurringAudienceListsResponse message. Does not implicitly {@link google.analytics.data.v1alpha.ListRecurringAudienceListsResponse.verify|verify} messages. + * @function encode + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsResponse + * @static + * @param {google.analytics.data.v1alpha.IListRecurringAudienceListsResponse} message ListRecurringAudienceListsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRecurringAudienceListsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.recurringAudienceLists != null && message.recurringAudienceLists.length) + for (var i = 0; i < message.recurringAudienceLists.length; ++i) + $root.google.analytics.data.v1alpha.RecurringAudienceList.encode(message.recurringAudienceLists[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListRecurringAudienceListsResponse message, length delimited. Does not implicitly {@link google.analytics.data.v1alpha.ListRecurringAudienceListsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsResponse + * @static + * @param {google.analytics.data.v1alpha.IListRecurringAudienceListsResponse} message ListRecurringAudienceListsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRecurringAudienceListsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListRecurringAudienceListsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.analytics.data.v1alpha.ListRecurringAudienceListsResponse} ListRecurringAudienceListsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRecurringAudienceListsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.analytics.data.v1alpha.ListRecurringAudienceListsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.recurringAudienceLists && message.recurringAudienceLists.length)) + message.recurringAudienceLists = []; + message.recurringAudienceLists.push($root.google.analytics.data.v1alpha.RecurringAudienceList.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListRecurringAudienceListsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.analytics.data.v1alpha.ListRecurringAudienceListsResponse} ListRecurringAudienceListsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRecurringAudienceListsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListRecurringAudienceListsResponse message. + * @function verify + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListRecurringAudienceListsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.recurringAudienceLists != null && message.hasOwnProperty("recurringAudienceLists")) { + if (!Array.isArray(message.recurringAudienceLists)) + return "recurringAudienceLists: array expected"; + for (var i = 0; i < message.recurringAudienceLists.length; ++i) { + var error = $root.google.analytics.data.v1alpha.RecurringAudienceList.verify(message.recurringAudienceLists[i]); + if (error) + return "recurringAudienceLists." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) { + properties._nextPageToken = 1; + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + } + return null; + }; + + /** + * Creates a ListRecurringAudienceListsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.analytics.data.v1alpha.ListRecurringAudienceListsResponse} ListRecurringAudienceListsResponse + */ + ListRecurringAudienceListsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.analytics.data.v1alpha.ListRecurringAudienceListsResponse) + return object; + var message = new $root.google.analytics.data.v1alpha.ListRecurringAudienceListsResponse(); + if (object.recurringAudienceLists) { + if (!Array.isArray(object.recurringAudienceLists)) + throw TypeError(".google.analytics.data.v1alpha.ListRecurringAudienceListsResponse.recurringAudienceLists: array expected"); + message.recurringAudienceLists = []; + for (var i = 0; i < object.recurringAudienceLists.length; ++i) { + if (typeof object.recurringAudienceLists[i] !== "object") + throw TypeError(".google.analytics.data.v1alpha.ListRecurringAudienceListsResponse.recurringAudienceLists: object expected"); + message.recurringAudienceLists[i] = $root.google.analytics.data.v1alpha.RecurringAudienceList.fromObject(object.recurringAudienceLists[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListRecurringAudienceListsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsResponse + * @static + * @param {google.analytics.data.v1alpha.ListRecurringAudienceListsResponse} message ListRecurringAudienceListsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListRecurringAudienceListsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.recurringAudienceLists = []; + if (message.recurringAudienceLists && message.recurringAudienceLists.length) { + object.recurringAudienceLists = []; + for (var j = 0; j < message.recurringAudienceLists.length; ++j) + object.recurringAudienceLists[j] = $root.google.analytics.data.v1alpha.RecurringAudienceList.toObject(message.recurringAudienceLists[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) { + object.nextPageToken = message.nextPageToken; + if (options.oneofs) + object._nextPageToken = "nextPageToken"; + } + return object; + }; + + /** + * Converts this ListRecurringAudienceListsResponse to JSON. + * @function toJSON + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsResponse + * @instance + * @returns {Object.} JSON object + */ + ListRecurringAudienceListsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListRecurringAudienceListsResponse + * @function getTypeUrl + * @memberof google.analytics.data.v1alpha.ListRecurringAudienceListsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListRecurringAudienceListsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.analytics.data.v1alpha.ListRecurringAudienceListsResponse"; + }; + + return ListRecurringAudienceListsResponse; + })(); + v1alpha.GetAudienceListRequest = (function() { /** @@ -11814,6 +13241,8 @@ * @property {number|null} [creationQuotaTokensCharged] AudienceList creationQuotaTokensCharged * @property {number|null} [rowCount] AudienceList rowCount * @property {string|null} [errorMessage] AudienceList errorMessage + * @property {number|null} [percentageCompleted] AudienceList percentageCompleted + * @property {string|null} [recurringAudienceList] AudienceList recurringAudienceList */ /** @@ -11904,6 +13333,22 @@ */ AudienceList.prototype.errorMessage = null; + /** + * AudienceList percentageCompleted. + * @member {number|null|undefined} percentageCompleted + * @memberof google.analytics.data.v1alpha.AudienceList + * @instance + */ + AudienceList.prototype.percentageCompleted = null; + + /** + * AudienceList recurringAudienceList. + * @member {string|null|undefined} recurringAudienceList + * @memberof google.analytics.data.v1alpha.AudienceList + * @instance + */ + AudienceList.prototype.recurringAudienceList = null; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -11951,6 +13396,28 @@ set: $util.oneOfSetter($oneOfFields) }); + /** + * AudienceList _percentageCompleted. + * @member {"percentageCompleted"|undefined} _percentageCompleted + * @memberof google.analytics.data.v1alpha.AudienceList + * @instance + */ + Object.defineProperty(AudienceList.prototype, "_percentageCompleted", { + get: $util.oneOfGetter($oneOfFields = ["percentageCompleted"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * AudienceList _recurringAudienceList. + * @member {"recurringAudienceList"|undefined} _recurringAudienceList + * @memberof google.analytics.data.v1alpha.AudienceList + * @instance + */ + Object.defineProperty(AudienceList.prototype, "_recurringAudienceList", { + get: $util.oneOfGetter($oneOfFields = ["recurringAudienceList"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new AudienceList instance using the specified properties. * @function create @@ -11994,6 +13461,10 @@ writer.uint32(/* id 8, wireType 0 =*/64).int32(message.rowCount); if (message.errorMessage != null && Object.hasOwnProperty.call(message, "errorMessage")) writer.uint32(/* id 9, wireType 2 =*/74).string(message.errorMessage); + if (message.percentageCompleted != null && Object.hasOwnProperty.call(message, "percentageCompleted")) + writer.uint32(/* id 11, wireType 1 =*/89).double(message.percentageCompleted); + if (message.recurringAudienceList != null && Object.hasOwnProperty.call(message, "recurringAudienceList")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.recurringAudienceList); return writer; }; @@ -12066,6 +13537,14 @@ message.errorMessage = reader.string(); break; } + case 11: { + message.percentageCompleted = reader.double(); + break; + } + case 12: { + message.recurringAudienceList = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -12153,6 +13632,16 @@ if (!$util.isString(message.errorMessage)) return "errorMessage: string expected"; } + if (message.percentageCompleted != null && message.hasOwnProperty("percentageCompleted")) { + properties._percentageCompleted = 1; + if (typeof message.percentageCompleted !== "number") + return "percentageCompleted: number expected"; + } + if (message.recurringAudienceList != null && message.hasOwnProperty("recurringAudienceList")) { + properties._recurringAudienceList = 1; + if (!$util.isString(message.recurringAudienceList)) + return "recurringAudienceList: string expected"; + } return null; }; @@ -12219,6 +13708,10 @@ message.rowCount = object.rowCount | 0; if (object.errorMessage != null) message.errorMessage = String(object.errorMessage); + if (object.percentageCompleted != null) + message.percentageCompleted = Number(object.percentageCompleted); + if (object.recurringAudienceList != null) + message.recurringAudienceList = String(object.recurringAudienceList); return message; }; @@ -12276,6 +13769,16 @@ if (options.oneofs) object._errorMessage = "errorMessage"; } + if (message.percentageCompleted != null && message.hasOwnProperty("percentageCompleted")) { + object.percentageCompleted = options.json && !isFinite(message.percentageCompleted) ? String(message.percentageCompleted) : message.percentageCompleted; + if (options.oneofs) + object._percentageCompleted = "percentageCompleted"; + } + if (message.recurringAudienceList != null && message.hasOwnProperty("recurringAudienceList")) { + object.recurringAudienceList = message.recurringAudienceList; + if (options.oneofs) + object._recurringAudienceList = "recurringAudienceList"; + } return object; }; diff --git a/packages/google-analytics-data/protos/protos.json b/packages/google-analytics-data/protos/protos.json index c9c9194e762..e079d12aa22 100644 --- a/packages/google-analytics-data/protos/protos.json +++ b/packages/google-analytics-data/protos/protos.json @@ -1163,6 +1163,204 @@ "(google.api.method_signature)": "parent" } ] + }, + "CreateRecurringAudienceList": { + "requestType": "CreateRecurringAudienceListRequest", + "responseType": "RecurringAudienceList", + "options": { + "(google.api.http).post": "/v1alpha/{parent=properties/*}/recurringAudienceLists", + "(google.api.http).body": "recurring_audience_list", + "(google.api.method_signature)": "parent,recurring_audience_list" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1alpha/{parent=properties/*}/recurringAudienceLists", + "body": "recurring_audience_list" + } + }, + { + "(google.api.method_signature)": "parent,recurring_audience_list" + } + ] + }, + "GetRecurringAudienceList": { + "requestType": "GetRecurringAudienceListRequest", + "responseType": "RecurringAudienceList", + "options": { + "(google.api.http).get": "/v1alpha/{name=properties/*/recurringAudienceLists/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1alpha/{name=properties/*/recurringAudienceLists/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListRecurringAudienceLists": { + "requestType": "ListRecurringAudienceListsRequest", + "responseType": "ListRecurringAudienceListsResponse", + "options": { + "(google.api.http).get": "/v1alpha/{parent=properties/*}/recurringAudienceLists", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1alpha/{parent=properties/*}/recurringAudienceLists" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + } + } + }, + "CreateRecurringAudienceListRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "analyticsdata.googleapis.com/RecurringAudienceList" + } + }, + "recurringAudienceList": { + "type": "RecurringAudienceList", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "RecurringAudienceList": { + "options": { + "(google.api.resource).type": "analyticsdata.googleapis.com/RecurringAudienceList", + "(google.api.resource).pattern": "properties/{property}/recurringAudienceLists/{recurring_audience_list}", + "(google.api.resource).plural": "recurringAudienceLists", + "(google.api.resource).singular": "recurringAudienceList" + }, + "oneofs": { + "_activeDaysRemaining": { + "oneof": [ + "activeDaysRemaining" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "audience": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "audienceDisplayName": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "dimensions": { + "rule": "repeated", + "type": "AudienceDimension", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "activeDaysRemaining": { + "type": "int32", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "audienceLists": { + "rule": "repeated", + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "GetRecurringAudienceListRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "analyticsdata.googleapis.com/RecurringAudienceList" + } + } + } + }, + "ListRecurringAudienceListsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "analyticsdata.googleapis.com/RecurringAudienceList" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListRecurringAudienceListsResponse": { + "oneofs": { + "_nextPageToken": { + "oneof": [ + "nextPageToken" + ] + } + }, + "fields": { + "recurringAudienceLists": { + "rule": "repeated", + "type": "RecurringAudienceList", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2, + "options": { + "proto3_optional": true + } } } }, @@ -1273,6 +1471,16 @@ "oneof": [ "errorMessage" ] + }, + "_percentageCompleted": { + "oneof": [ + "percentageCompleted" + ] + }, + "_recurringAudienceList": { + "oneof": [ + "recurringAudienceList" + ] } }, "fields": { @@ -1343,6 +1551,22 @@ "(google.api.field_behavior)": "OUTPUT_ONLY", "proto3_optional": true } + }, + "percentageCompleted": { + "type": "double", + "id": 11, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "recurringAudienceList": { + "type": "string", + "id": 12, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } } }, "nested": { diff --git a/packages/google-analytics-data/samples/README.md b/packages/google-analytics-data/samples/README.md index aacd149beb9..eff14e30386 100644 --- a/packages/google-analytics-data/samples/README.md +++ b/packages/google-analytics-data/samples/README.md @@ -13,8 +13,11 @@ * [Before you begin](#before-you-begin) * [Samples](#samples) * [Alpha_analytics_data.create_audience_list](#alpha_analytics_data.create_audience_list) + * [Alpha_analytics_data.create_recurring_audience_list](#alpha_analytics_data.create_recurring_audience_list) * [Alpha_analytics_data.get_audience_list](#alpha_analytics_data.get_audience_list) + * [Alpha_analytics_data.get_recurring_audience_list](#alpha_analytics_data.get_recurring_audience_list) * [Alpha_analytics_data.list_audience_lists](#alpha_analytics_data.list_audience_lists) + * [Alpha_analytics_data.list_recurring_audience_lists](#alpha_analytics_data.list_recurring_audience_lists) * [Alpha_analytics_data.query_audience_list](#alpha_analytics_data.query_audience_list) * [Alpha_analytics_data.run_funnel_report](#alpha_analytics_data.run_funnel_report) * [Alpha_analytics_data.sheet_export_audience_list](#alpha_analytics_data.sheet_export_audience_list) @@ -59,6 +62,23 @@ __Usage:__ +### Alpha_analytics_data.create_recurring_audience_list + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.create_recurring_audience_list.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.create_recurring_audience_list.js,samples/README.md) + +__Usage:__ + + +`node packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.create_recurring_audience_list.js` + + +----- + + + + ### Alpha_analytics_data.get_audience_list View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.get_audience_list.js). @@ -76,6 +96,23 @@ __Usage:__ +### Alpha_analytics_data.get_recurring_audience_list + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.get_recurring_audience_list.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.get_recurring_audience_list.js,samples/README.md) + +__Usage:__ + + +`node packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.get_recurring_audience_list.js` + + +----- + + + + ### Alpha_analytics_data.list_audience_lists View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.list_audience_lists.js). @@ -93,6 +130,23 @@ __Usage:__ +### Alpha_analytics_data.list_recurring_audience_lists + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.list_recurring_audience_lists.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.list_recurring_audience_lists.js,samples/README.md) + +__Usage:__ + + +`node packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.list_recurring_audience_lists.js` + + +----- + + + + ### Alpha_analytics_data.query_audience_list View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.query_audience_list.js). diff --git a/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.create_recurring_audience_list.js b/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.create_recurring_audience_list.js new file mode 100644 index 00000000000..b64eda6bd2e --- /dev/null +++ b/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.create_recurring_audience_list.js @@ -0,0 +1,67 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, recurringAudienceList) { + // [START analyticsdata_v1alpha_generated_AlphaAnalyticsData_CreateRecurringAudienceList_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource where this recurring audience list will be + * created. Format: `properties/{property}` + */ + // const parent = 'abc123' + /** + * Required. The recurring audience list to create. + */ + // const recurringAudienceList = {} + + // Imports the Data library + const {AlphaAnalyticsDataClient} = require('@google-cloud/data').v1alpha; + + // Instantiates a client + const dataClient = new AlphaAnalyticsDataClient(); + + async function callCreateRecurringAudienceList() { + // Construct request + const request = { + parent, + recurringAudienceList, + }; + + // Run request + const response = await dataClient.createRecurringAudienceList(request); + console.log(response); + } + + callCreateRecurringAudienceList(); + // [END analyticsdata_v1alpha_generated_AlphaAnalyticsData_CreateRecurringAudienceList_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.get_recurring_audience_list.js b/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.get_recurring_audience_list.js new file mode 100644 index 00000000000..3eb61152ba3 --- /dev/null +++ b/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.get_recurring_audience_list.js @@ -0,0 +1,63 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START analyticsdata_v1alpha_generated_AlphaAnalyticsData_GetRecurringAudienceList_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The recurring audience list resource name. + * Format: + * `properties/{property}/recurringAudienceLists/{recurring_audience_list}` + */ + // const name = 'abc123' + + // Imports the Data library + const {AlphaAnalyticsDataClient} = require('@google-cloud/data').v1alpha; + + // Instantiates a client + const dataClient = new AlphaAnalyticsDataClient(); + + async function callGetRecurringAudienceList() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dataClient.getRecurringAudienceList(request); + console.log(response); + } + + callGetRecurringAudienceList(); + // [END analyticsdata_v1alpha_generated_AlphaAnalyticsData_GetRecurringAudienceList_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.list_recurring_audience_lists.js b/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.list_recurring_audience_lists.js new file mode 100644 index 00000000000..d5087859e3d --- /dev/null +++ b/packages/google-analytics-data/samples/generated/v1alpha/alpha_analytics_data.list_recurring_audience_lists.js @@ -0,0 +1,80 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START analyticsdata_v1alpha_generated_AlphaAnalyticsData_ListRecurringAudienceLists_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. All recurring audience lists for this property will be listed in + * the response. Format: `properties/{property}` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of recurring audience lists to return. The + * service may return fewer than this value. If unspecified, at most 200 + * recurring audience lists will be returned. The maximum value is 1000 + * (higher values will be coerced to the maximum). + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous + * `ListRecurringAudienceLists` call. Provide this to retrieve the subsequent + * page. + * When paginating, all other parameters provided to + * `ListRecurringAudienceLists` must match the call that provided the page + * token. + */ + // const pageToken = 'abc123' + + // Imports the Data library + const {AlphaAnalyticsDataClient} = require('@google-cloud/data').v1alpha; + + // Instantiates a client + const dataClient = new AlphaAnalyticsDataClient(); + + async function callListRecurringAudienceLists() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dataClient.listRecurringAudienceListsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListRecurringAudienceLists(); + // [END analyticsdata_v1alpha_generated_AlphaAnalyticsData_ListRecurringAudienceLists_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-analytics-data/samples/generated/v1alpha/snippet_metadata_google.analytics.data.v1alpha.json b/packages/google-analytics-data/samples/generated/v1alpha/snippet_metadata_google.analytics.data.v1alpha.json index 99a87b25942..a44c64e87f9 100644 --- a/packages/google-analytics-data/samples/generated/v1alpha/snippet_metadata_google.analytics.data.v1alpha.json +++ b/packages/google-analytics-data/samples/generated/v1alpha/snippet_metadata_google.analytics.data.v1alpha.json @@ -314,6 +314,138 @@ } } } + }, + { + "regionTag": "analyticsdata_v1alpha_generated_AlphaAnalyticsData_CreateRecurringAudienceList_async", + "title": "AlphaAnalyticsData createRecurringAudienceList Sample", + "origin": "API_DEFINITION", + "description": " Creates a recurring audience list. Recurring audience lists produces new audience lists each day. Audience lists are users in an audience at the time of the list's creation. A recurring audience list ensures that you have audience list based on the most recent data available for use each day. If you manually create audience list, you don't know when an audience list based on an additional day's data is available. This recurring audience list automates the creation of an audience list when an additional day's data is available. You will consume fewer quota tokens by using recurring audience list versus manually creating audience list at various times of day trying to guess when an additional day's data is ready. This method is introduced at alpha stability with the intention of gathering feedback on syntax and capabilities before entering beta. To give your feedback on this API, complete the [Google Analytics Audience Export API Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.", + "canonical": true, + "file": "alpha_analytics_data.create_recurring_audience_list.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateRecurringAudienceList", + "fullName": "google.analytics.data.v1alpha.AlphaAnalyticsData.CreateRecurringAudienceList", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "recurring_audience_list", + "type": ".google.analytics.data.v1alpha.RecurringAudienceList" + } + ], + "resultType": ".google.analytics.data.v1alpha.RecurringAudienceList", + "client": { + "shortName": "AlphaAnalyticsDataClient", + "fullName": "google.analytics.data.v1alpha.AlphaAnalyticsDataClient" + }, + "method": { + "shortName": "CreateRecurringAudienceList", + "fullName": "google.analytics.data.v1alpha.AlphaAnalyticsData.CreateRecurringAudienceList", + "service": { + "shortName": "AlphaAnalyticsData", + "fullName": "google.analytics.data.v1alpha.AlphaAnalyticsData" + } + } + } + }, + { + "regionTag": "analyticsdata_v1alpha_generated_AlphaAnalyticsData_GetRecurringAudienceList_async", + "title": "AlphaAnalyticsData getRecurringAudienceList Sample", + "origin": "API_DEFINITION", + "description": " Gets configuration metadata about a specific recurring audience list. This method can be used to understand a recurring audience list's state after it has been created. For example, a recurring audience list resource will generate audience list instances for each day, and this method can be used to get the resource name of the most recent audience list instance. This method is introduced at alpha stability with the intention of gathering feedback on syntax and capabilities before entering beta. To give your feedback on this API, complete the [Google Analytics Audience Export API Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.", + "canonical": true, + "file": "alpha_analytics_data.get_recurring_audience_list.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetRecurringAudienceList", + "fullName": "google.analytics.data.v1alpha.AlphaAnalyticsData.GetRecurringAudienceList", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.analytics.data.v1alpha.RecurringAudienceList", + "client": { + "shortName": "AlphaAnalyticsDataClient", + "fullName": "google.analytics.data.v1alpha.AlphaAnalyticsDataClient" + }, + "method": { + "shortName": "GetRecurringAudienceList", + "fullName": "google.analytics.data.v1alpha.AlphaAnalyticsData.GetRecurringAudienceList", + "service": { + "shortName": "AlphaAnalyticsData", + "fullName": "google.analytics.data.v1alpha.AlphaAnalyticsData" + } + } + } + }, + { + "regionTag": "analyticsdata_v1alpha_generated_AlphaAnalyticsData_ListRecurringAudienceLists_async", + "title": "AlphaAnalyticsData listRecurringAudienceLists Sample", + "origin": "API_DEFINITION", + "description": " Lists all recurring audience lists for a property. This method can be used for you to find and reuse existing recurring audience lists rather than creating unnecessary new recurring audience lists. The same audience can have multiple recurring audience lists that represent different dimension combinations; for example, just the dimension `deviceId` or both the dimensions `deviceId` and `userId`. This method is introduced at alpha stability with the intention of gathering feedback on syntax and capabilities before entering beta. To give your feedback on this API, complete the [Google Analytics Audience Export API Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.", + "canonical": true, + "file": "alpha_analytics_data.list_recurring_audience_lists.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListRecurringAudienceLists", + "fullName": "google.analytics.data.v1alpha.AlphaAnalyticsData.ListRecurringAudienceLists", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.analytics.data.v1alpha.ListRecurringAudienceListsResponse", + "client": { + "shortName": "AlphaAnalyticsDataClient", + "fullName": "google.analytics.data.v1alpha.AlphaAnalyticsDataClient" + }, + "method": { + "shortName": "ListRecurringAudienceLists", + "fullName": "google.analytics.data.v1alpha.AlphaAnalyticsData.ListRecurringAudienceLists", + "service": { + "shortName": "AlphaAnalyticsData", + "fullName": "google.analytics.data.v1alpha.AlphaAnalyticsData" + } + } + } } ] } \ No newline at end of file diff --git a/packages/google-analytics-data/src/v1alpha/alpha_analytics_data_client.ts b/packages/google-analytics-data/src/v1alpha/alpha_analytics_data_client.ts index 65016fd5997..550858a0208 100644 --- a/packages/google-analytics-data/src/v1alpha/alpha_analytics_data_client.ts +++ b/packages/google-analytics-data/src/v1alpha/alpha_analytics_data_client.ts @@ -186,6 +186,9 @@ export class AlphaAnalyticsDataClient { propertyPathTemplate: new this._gaxModule.PathTemplate( 'properties/{property}' ), + recurringAudienceListPathTemplate: new this._gaxModule.PathTemplate( + 'properties/{property}/recurringAudienceLists/{recurring_audience_list}' + ), }; // Some of the methods on this service return "paged" results, @@ -197,6 +200,11 @@ export class AlphaAnalyticsDataClient { 'nextPageToken', 'audienceLists' ), + listRecurringAudienceLists: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'recurringAudienceLists' + ), }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); @@ -286,6 +294,9 @@ export class AlphaAnalyticsDataClient { 'sheetExportAudienceList', 'getAudienceList', 'listAudienceLists', + 'createRecurringAudienceList', + 'getRecurringAudienceList', + 'listRecurringAudienceLists', ]; for (const methodName of alphaAnalyticsDataStubMethods) { const callPromise = this.alphaAnalyticsDataStub.then( @@ -920,6 +931,238 @@ export class AlphaAnalyticsDataClient { this.initialize(); return this.innerApiCalls.getAudienceList(request, options, callback); } + /** + * Creates a recurring audience list. Recurring audience lists produces new + * audience lists each day. Audience lists are users in an audience at the + * time of the list's creation. + * + * A recurring audience list ensures that you have audience list based on the + * most recent data available for use each day. If you manually create + * audience list, you don't know when an audience list based on an additional + * day's data is available. This recurring audience list automates the + * creation of an audience list when an additional day's data is available. + * You will consume fewer quota tokens by using recurring audience list versus + * manually creating audience list at various times of day trying to guess + * when an additional day's data is ready. + * + * This method is introduced at alpha stability with the intention of + * gathering feedback on syntax and capabilities before entering beta. To give + * your feedback on this API, complete the + * [Google Analytics Audience Export API + * Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this recurring audience list will be + * created. Format: `properties/{property}` + * @param {google.analytics.data.v1alpha.RecurringAudienceList} request.recurringAudienceList + * Required. The recurring audience list to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.analytics.data.v1alpha.RecurringAudienceList|RecurringAudienceList}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/alpha_analytics_data.create_recurring_audience_list.js + * region_tag:analyticsdata_v1alpha_generated_AlphaAnalyticsData_CreateRecurringAudienceList_async + */ + createRecurringAudienceList( + request?: protos.google.analytics.data.v1alpha.ICreateRecurringAudienceListRequest, + options?: CallOptions + ): Promise< + [ + protos.google.analytics.data.v1alpha.IRecurringAudienceList, + ( + | protos.google.analytics.data.v1alpha.ICreateRecurringAudienceListRequest + | undefined + ), + {} | undefined, + ] + >; + createRecurringAudienceList( + request: protos.google.analytics.data.v1alpha.ICreateRecurringAudienceListRequest, + options: CallOptions, + callback: Callback< + protos.google.analytics.data.v1alpha.IRecurringAudienceList, + | protos.google.analytics.data.v1alpha.ICreateRecurringAudienceListRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createRecurringAudienceList( + request: protos.google.analytics.data.v1alpha.ICreateRecurringAudienceListRequest, + callback: Callback< + protos.google.analytics.data.v1alpha.IRecurringAudienceList, + | protos.google.analytics.data.v1alpha.ICreateRecurringAudienceListRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createRecurringAudienceList( + request?: protos.google.analytics.data.v1alpha.ICreateRecurringAudienceListRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.analytics.data.v1alpha.IRecurringAudienceList, + | protos.google.analytics.data.v1alpha.ICreateRecurringAudienceListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.analytics.data.v1alpha.IRecurringAudienceList, + | protos.google.analytics.data.v1alpha.ICreateRecurringAudienceListRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.analytics.data.v1alpha.IRecurringAudienceList, + ( + | protos.google.analytics.data.v1alpha.ICreateRecurringAudienceListRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createRecurringAudienceList( + request, + options, + callback + ); + } + /** + * Gets configuration metadata about a specific recurring audience list. This + * method can be used to understand a recurring audience list's state after it + * has been created. For example, a recurring audience list resource will + * generate audience list instances for each day, and this method can be used + * to get the resource name of the most recent audience list instance. + * + * This method is introduced at alpha stability with the intention of + * gathering feedback on syntax and capabilities before entering beta. To give + * your feedback on this API, complete the + * [Google Analytics Audience Export API + * Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The recurring audience list resource name. + * Format: + * `properties/{property}/recurringAudienceLists/{recurring_audience_list}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.analytics.data.v1alpha.RecurringAudienceList|RecurringAudienceList}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/alpha_analytics_data.get_recurring_audience_list.js + * region_tag:analyticsdata_v1alpha_generated_AlphaAnalyticsData_GetRecurringAudienceList_async + */ + getRecurringAudienceList( + request?: protos.google.analytics.data.v1alpha.IGetRecurringAudienceListRequest, + options?: CallOptions + ): Promise< + [ + protos.google.analytics.data.v1alpha.IRecurringAudienceList, + ( + | protos.google.analytics.data.v1alpha.IGetRecurringAudienceListRequest + | undefined + ), + {} | undefined, + ] + >; + getRecurringAudienceList( + request: protos.google.analytics.data.v1alpha.IGetRecurringAudienceListRequest, + options: CallOptions, + callback: Callback< + protos.google.analytics.data.v1alpha.IRecurringAudienceList, + | protos.google.analytics.data.v1alpha.IGetRecurringAudienceListRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getRecurringAudienceList( + request: protos.google.analytics.data.v1alpha.IGetRecurringAudienceListRequest, + callback: Callback< + protos.google.analytics.data.v1alpha.IRecurringAudienceList, + | protos.google.analytics.data.v1alpha.IGetRecurringAudienceListRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getRecurringAudienceList( + request?: protos.google.analytics.data.v1alpha.IGetRecurringAudienceListRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.analytics.data.v1alpha.IRecurringAudienceList, + | protos.google.analytics.data.v1alpha.IGetRecurringAudienceListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.analytics.data.v1alpha.IRecurringAudienceList, + | protos.google.analytics.data.v1alpha.IGetRecurringAudienceListRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.analytics.data.v1alpha.IRecurringAudienceList, + ( + | protos.google.analytics.data.v1alpha.IGetRecurringAudienceListRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getRecurringAudienceList( + request, + options, + callback + ); + } /** * Creates an audience list for later retrieval. This method quickly returns @@ -1307,6 +1550,237 @@ export class AlphaAnalyticsDataClient { callSettings ) as AsyncIterable; } + /** + * Lists all recurring audience lists for a property. This method can be used + * for you to find and reuse existing recurring audience lists rather than + * creating unnecessary new recurring audience lists. The same audience can + * have multiple recurring audience lists that represent different dimension + * combinations; for example, just the dimension `deviceId` or both the + * dimensions `deviceId` and `userId`. + * + * This method is introduced at alpha stability with the intention of + * gathering feedback on syntax and capabilities before entering beta. To give + * your feedback on this API, complete the + * [Google Analytics Audience Export API + * Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. All recurring audience lists for this property will be listed in + * the response. Format: `properties/{property}` + * @param {number} [request.pageSize] + * Optional. The maximum number of recurring audience lists to return. The + * service may return fewer than this value. If unspecified, at most 200 + * recurring audience lists will be returned. The maximum value is 1000 + * (higher values will be coerced to the maximum). + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListRecurringAudienceLists` call. Provide this to retrieve the subsequent + * page. + * + * When paginating, all other parameters provided to + * `ListRecurringAudienceLists` must match the call that provided the page + * token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.analytics.data.v1alpha.RecurringAudienceList|RecurringAudienceList}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listRecurringAudienceListsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listRecurringAudienceLists( + request?: protos.google.analytics.data.v1alpha.IListRecurringAudienceListsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.analytics.data.v1alpha.IRecurringAudienceList[], + protos.google.analytics.data.v1alpha.IListRecurringAudienceListsRequest | null, + protos.google.analytics.data.v1alpha.IListRecurringAudienceListsResponse, + ] + >; + listRecurringAudienceLists( + request: protos.google.analytics.data.v1alpha.IListRecurringAudienceListsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.analytics.data.v1alpha.IListRecurringAudienceListsRequest, + | protos.google.analytics.data.v1alpha.IListRecurringAudienceListsResponse + | null + | undefined, + protos.google.analytics.data.v1alpha.IRecurringAudienceList + > + ): void; + listRecurringAudienceLists( + request: protos.google.analytics.data.v1alpha.IListRecurringAudienceListsRequest, + callback: PaginationCallback< + protos.google.analytics.data.v1alpha.IListRecurringAudienceListsRequest, + | protos.google.analytics.data.v1alpha.IListRecurringAudienceListsResponse + | null + | undefined, + protos.google.analytics.data.v1alpha.IRecurringAudienceList + > + ): void; + listRecurringAudienceLists( + request?: protos.google.analytics.data.v1alpha.IListRecurringAudienceListsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.analytics.data.v1alpha.IListRecurringAudienceListsRequest, + | protos.google.analytics.data.v1alpha.IListRecurringAudienceListsResponse + | null + | undefined, + protos.google.analytics.data.v1alpha.IRecurringAudienceList + >, + callback?: PaginationCallback< + protos.google.analytics.data.v1alpha.IListRecurringAudienceListsRequest, + | protos.google.analytics.data.v1alpha.IListRecurringAudienceListsResponse + | null + | undefined, + protos.google.analytics.data.v1alpha.IRecurringAudienceList + > + ): Promise< + [ + protos.google.analytics.data.v1alpha.IRecurringAudienceList[], + protos.google.analytics.data.v1alpha.IListRecurringAudienceListsRequest | null, + protos.google.analytics.data.v1alpha.IListRecurringAudienceListsResponse, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listRecurringAudienceLists( + request, + options, + callback + ); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. All recurring audience lists for this property will be listed in + * the response. Format: `properties/{property}` + * @param {number} [request.pageSize] + * Optional. The maximum number of recurring audience lists to return. The + * service may return fewer than this value. If unspecified, at most 200 + * recurring audience lists will be returned. The maximum value is 1000 + * (higher values will be coerced to the maximum). + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListRecurringAudienceLists` call. Provide this to retrieve the subsequent + * page. + * + * When paginating, all other parameters provided to + * `ListRecurringAudienceLists` must match the call that provided the page + * token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.analytics.data.v1alpha.RecurringAudienceList|RecurringAudienceList} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listRecurringAudienceListsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listRecurringAudienceListsStream( + request?: protos.google.analytics.data.v1alpha.IListRecurringAudienceListsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listRecurringAudienceLists']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRecurringAudienceLists.createStream( + this.innerApiCalls.listRecurringAudienceLists as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listRecurringAudienceLists`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. All recurring audience lists for this property will be listed in + * the response. Format: `properties/{property}` + * @param {number} [request.pageSize] + * Optional. The maximum number of recurring audience lists to return. The + * service may return fewer than this value. If unspecified, at most 200 + * recurring audience lists will be returned. The maximum value is 1000 + * (higher values will be coerced to the maximum). + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `ListRecurringAudienceLists` call. Provide this to retrieve the subsequent + * page. + * + * When paginating, all other parameters provided to + * `ListRecurringAudienceLists` must match the call that provided the page + * token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.analytics.data.v1alpha.RecurringAudienceList|RecurringAudienceList}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/alpha_analytics_data.list_recurring_audience_lists.js + * region_tag:analyticsdata_v1alpha_generated_AlphaAnalyticsData_ListRecurringAudienceLists_async + */ + listRecurringAudienceListsAsync( + request?: protos.google.analytics.data.v1alpha.IListRecurringAudienceListsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listRecurringAudienceLists']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRecurringAudienceLists.asyncIterate( + this.innerApiCalls['listRecurringAudienceLists'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } // -------------------- // -- Path templates -- // -------------------- @@ -1372,6 +1846,50 @@ export class AlphaAnalyticsDataClient { return this.pathTemplates.propertyPathTemplate.match(propertyName).property; } + /** + * Return a fully-qualified recurringAudienceList resource name string. + * + * @param {string} property + * @param {string} recurring_audience_list + * @returns {string} Resource name string. + */ + recurringAudienceListPath(property: string, recurringAudienceList: string) { + return this.pathTemplates.recurringAudienceListPathTemplate.render({ + property: property, + recurring_audience_list: recurringAudienceList, + }); + } + + /** + * Parse the property from RecurringAudienceList resource. + * + * @param {string} recurringAudienceListName + * A fully-qualified path representing RecurringAudienceList resource. + * @returns {string} A string representing the property. + */ + matchPropertyFromRecurringAudienceListName( + recurringAudienceListName: string + ) { + return this.pathTemplates.recurringAudienceListPathTemplate.match( + recurringAudienceListName + ).property; + } + + /** + * Parse the recurring_audience_list from RecurringAudienceList resource. + * + * @param {string} recurringAudienceListName + * A fully-qualified path representing RecurringAudienceList resource. + * @returns {string} A string representing the recurring_audience_list. + */ + matchRecurringAudienceListFromRecurringAudienceListName( + recurringAudienceListName: string + ) { + return this.pathTemplates.recurringAudienceListPathTemplate.match( + recurringAudienceListName + ).recurring_audience_list; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-analytics-data/src/v1alpha/alpha_analytics_data_client_config.json b/packages/google-analytics-data/src/v1alpha/alpha_analytics_data_client_config.json index eca3068bf7b..8568d94a228 100644 --- a/packages/google-analytics-data/src/v1alpha/alpha_analytics_data_client_config.json +++ b/packages/google-analytics-data/src/v1alpha/alpha_analytics_data_client_config.json @@ -61,6 +61,21 @@ "timeout_millis": 60000, "retry_codes_name": "unknown", "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" + }, + "CreateRecurringAudienceList": { + "timeout_millis": 60000, + "retry_codes_name": "unknown", + "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" + }, + "GetRecurringAudienceList": { + "timeout_millis": 60000, + "retry_codes_name": "unknown", + "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" + }, + "ListRecurringAudienceLists": { + "timeout_millis": 60000, + "retry_codes_name": "unknown", + "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" } } } diff --git a/packages/google-analytics-data/src/v1alpha/gapic_metadata.json b/packages/google-analytics-data/src/v1alpha/gapic_metadata.json index d22d4382034..1039ae46537 100644 --- a/packages/google-analytics-data/src/v1alpha/gapic_metadata.json +++ b/packages/google-analytics-data/src/v1alpha/gapic_metadata.json @@ -30,6 +30,16 @@ "getAudienceList" ] }, + "CreateRecurringAudienceList": { + "methods": [ + "createRecurringAudienceList" + ] + }, + "GetRecurringAudienceList": { + "methods": [ + "getRecurringAudienceList" + ] + }, "CreateAudienceList": { "methods": [ "createAudienceList" @@ -41,6 +51,13 @@ "listAudienceListsStream", "listAudienceListsAsync" ] + }, + "ListRecurringAudienceLists": { + "methods": [ + "listRecurringAudienceLists", + "listRecurringAudienceListsStream", + "listRecurringAudienceListsAsync" + ] } } }, @@ -67,6 +84,16 @@ "getAudienceList" ] }, + "CreateRecurringAudienceList": { + "methods": [ + "createRecurringAudienceList" + ] + }, + "GetRecurringAudienceList": { + "methods": [ + "getRecurringAudienceList" + ] + }, "CreateAudienceList": { "methods": [ "createAudienceList" @@ -78,6 +105,13 @@ "listAudienceListsStream", "listAudienceListsAsync" ] + }, + "ListRecurringAudienceLists": { + "methods": [ + "listRecurringAudienceLists", + "listRecurringAudienceListsStream", + "listRecurringAudienceListsAsync" + ] } } } diff --git a/packages/google-analytics-data/test/gapic_alpha_analytics_data_v1alpha.ts b/packages/google-analytics-data/test/gapic_alpha_analytics_data_v1alpha.ts index 042d2294421..76e3d4fc4fd 100644 --- a/packages/google-analytics-data/test/gapic_alpha_analytics_data_v1alpha.ts +++ b/packages/google-analytics-data/test/gapic_alpha_analytics_data_v1alpha.ts @@ -810,6 +810,288 @@ describe('v1alpha.AlphaAnalyticsDataClient', () => { }); }); + describe('createRecurringAudienceList', () => { + it('invokes createRecurringAudienceList without error', async () => { + const client = + new alphaanalyticsdataModule.v1alpha.AlphaAnalyticsDataClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.analytics.data.v1alpha.CreateRecurringAudienceListRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.analytics.data.v1alpha.CreateRecurringAudienceListRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.analytics.data.v1alpha.RecurringAudienceList() + ); + client.innerApiCalls.createRecurringAudienceList = + stubSimpleCall(expectedResponse); + const [response] = await client.createRecurringAudienceList(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createRecurringAudienceList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createRecurringAudienceList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRecurringAudienceList without error using callback', async () => { + const client = + new alphaanalyticsdataModule.v1alpha.AlphaAnalyticsDataClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.analytics.data.v1alpha.CreateRecurringAudienceListRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.analytics.data.v1alpha.CreateRecurringAudienceListRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.analytics.data.v1alpha.RecurringAudienceList() + ); + client.innerApiCalls.createRecurringAudienceList = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createRecurringAudienceList( + request, + ( + err?: Error | null, + result?: protos.google.analytics.data.v1alpha.IRecurringAudienceList | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createRecurringAudienceList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createRecurringAudienceList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRecurringAudienceList with error', async () => { + const client = + new alphaanalyticsdataModule.v1alpha.AlphaAnalyticsDataClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.analytics.data.v1alpha.CreateRecurringAudienceListRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.analytics.data.v1alpha.CreateRecurringAudienceListRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createRecurringAudienceList = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.createRecurringAudienceList(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.createRecurringAudienceList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createRecurringAudienceList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRecurringAudienceList with closed client', async () => { + const client = + new alphaanalyticsdataModule.v1alpha.AlphaAnalyticsDataClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.analytics.data.v1alpha.CreateRecurringAudienceListRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.analytics.data.v1alpha.CreateRecurringAudienceListRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.createRecurringAudienceList(request), + expectedError + ); + }); + }); + + describe('getRecurringAudienceList', () => { + it('invokes getRecurringAudienceList without error', async () => { + const client = + new alphaanalyticsdataModule.v1alpha.AlphaAnalyticsDataClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.analytics.data.v1alpha.GetRecurringAudienceListRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.analytics.data.v1alpha.GetRecurringAudienceListRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.analytics.data.v1alpha.RecurringAudienceList() + ); + client.innerApiCalls.getRecurringAudienceList = + stubSimpleCall(expectedResponse); + const [response] = await client.getRecurringAudienceList(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getRecurringAudienceList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getRecurringAudienceList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRecurringAudienceList without error using callback', async () => { + const client = + new alphaanalyticsdataModule.v1alpha.AlphaAnalyticsDataClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.analytics.data.v1alpha.GetRecurringAudienceListRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.analytics.data.v1alpha.GetRecurringAudienceListRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.analytics.data.v1alpha.RecurringAudienceList() + ); + client.innerApiCalls.getRecurringAudienceList = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getRecurringAudienceList( + request, + ( + err?: Error | null, + result?: protos.google.analytics.data.v1alpha.IRecurringAudienceList | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getRecurringAudienceList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getRecurringAudienceList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRecurringAudienceList with error', async () => { + const client = + new alphaanalyticsdataModule.v1alpha.AlphaAnalyticsDataClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.analytics.data.v1alpha.GetRecurringAudienceListRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.analytics.data.v1alpha.GetRecurringAudienceListRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getRecurringAudienceList = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getRecurringAudienceList(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.getRecurringAudienceList as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getRecurringAudienceList as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRecurringAudienceList with closed client', async () => { + const client = + new alphaanalyticsdataModule.v1alpha.AlphaAnalyticsDataClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.analytics.data.v1alpha.GetRecurringAudienceListRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.analytics.data.v1alpha.GetRecurringAudienceListRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.getRecurringAudienceList(request), + expectedError + ); + }); + }); + describe('createAudienceList', () => { it('invokes createAudienceList without error', async () => { const client = @@ -1346,44 +1628,410 @@ describe('v1alpha.AlphaAnalyticsDataClient', () => { }); }); - describe('Path templates', () => { - describe('audienceList', () => { - const fakePath = '/rendered/path/audienceList'; - const expectedParameters = { - property: 'propertyValue', - audience_list: 'audienceListValue', - }; + describe('listRecurringAudienceLists', () => { + it('invokes listRecurringAudienceLists without error', async () => { const client = new alphaanalyticsdataModule.v1alpha.AlphaAnalyticsDataClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.audienceListPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.audienceListPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('audienceListPath', () => { - const result = client.audienceListPath( - 'propertyValue', - 'audienceListValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.audienceListPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchPropertyFromAudienceListName', () => { - const result = client.matchPropertyFromAudienceListName(fakePath); - assert.strictEqual(result, 'propertyValue'); - assert( - (client.pathTemplates.audienceListPathTemplate.match as SinonStub) + const request = generateSampleMessage( + new protos.google.analytics.data.v1alpha.ListRecurringAudienceListsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.analytics.data.v1alpha.ListRecurringAudienceListsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.analytics.data.v1alpha.RecurringAudienceList() + ), + generateSampleMessage( + new protos.google.analytics.data.v1alpha.RecurringAudienceList() + ), + generateSampleMessage( + new protos.google.analytics.data.v1alpha.RecurringAudienceList() + ), + ]; + client.innerApiCalls.listRecurringAudienceLists = + stubSimpleCall(expectedResponse); + const [response] = await client.listRecurringAudienceLists(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listRecurringAudienceLists as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listRecurringAudienceLists as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRecurringAudienceLists without error using callback', async () => { + const client = + new alphaanalyticsdataModule.v1alpha.AlphaAnalyticsDataClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.analytics.data.v1alpha.ListRecurringAudienceListsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.analytics.data.v1alpha.ListRecurringAudienceListsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.analytics.data.v1alpha.RecurringAudienceList() + ), + generateSampleMessage( + new protos.google.analytics.data.v1alpha.RecurringAudienceList() + ), + generateSampleMessage( + new protos.google.analytics.data.v1alpha.RecurringAudienceList() + ), + ]; + client.innerApiCalls.listRecurringAudienceLists = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listRecurringAudienceLists( + request, + ( + err?: Error | null, + result?: + | protos.google.analytics.data.v1alpha.IRecurringAudienceList[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listRecurringAudienceLists as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listRecurringAudienceLists as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRecurringAudienceLists with error', async () => { + const client = + new alphaanalyticsdataModule.v1alpha.AlphaAnalyticsDataClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.analytics.data.v1alpha.ListRecurringAudienceListsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.analytics.data.v1alpha.ListRecurringAudienceListsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listRecurringAudienceLists = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.listRecurringAudienceLists(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.listRecurringAudienceLists as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listRecurringAudienceLists as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRecurringAudienceListsStream without error', async () => { + const client = + new alphaanalyticsdataModule.v1alpha.AlphaAnalyticsDataClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.analytics.data.v1alpha.ListRecurringAudienceListsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.analytics.data.v1alpha.ListRecurringAudienceListsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.analytics.data.v1alpha.RecurringAudienceList() + ), + generateSampleMessage( + new protos.google.analytics.data.v1alpha.RecurringAudienceList() + ), + generateSampleMessage( + new protos.google.analytics.data.v1alpha.RecurringAudienceList() + ), + ]; + client.descriptors.page.listRecurringAudienceLists.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listRecurringAudienceListsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.analytics.data.v1alpha.RecurringAudienceList[] = + []; + stream.on( + 'data', + ( + response: protos.google.analytics.data.v1alpha.RecurringAudienceList + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listRecurringAudienceLists + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listRecurringAudienceLists, request) + ); + assert( + ( + client.descriptors.page.listRecurringAudienceLists + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listRecurringAudienceListsStream with error', async () => { + const client = + new alphaanalyticsdataModule.v1alpha.AlphaAnalyticsDataClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.analytics.data.v1alpha.ListRecurringAudienceListsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.analytics.data.v1alpha.ListRecurringAudienceListsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRecurringAudienceLists.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listRecurringAudienceListsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.analytics.data.v1alpha.RecurringAudienceList[] = + []; + stream.on( + 'data', + ( + response: protos.google.analytics.data.v1alpha.RecurringAudienceList + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listRecurringAudienceLists + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listRecurringAudienceLists, request) + ); + assert( + ( + client.descriptors.page.listRecurringAudienceLists + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRecurringAudienceLists without error', async () => { + const client = + new alphaanalyticsdataModule.v1alpha.AlphaAnalyticsDataClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.analytics.data.v1alpha.ListRecurringAudienceListsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.analytics.data.v1alpha.ListRecurringAudienceListsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.analytics.data.v1alpha.RecurringAudienceList() + ), + generateSampleMessage( + new protos.google.analytics.data.v1alpha.RecurringAudienceList() + ), + generateSampleMessage( + new protos.google.analytics.data.v1alpha.RecurringAudienceList() + ), + ]; + client.descriptors.page.listRecurringAudienceLists.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.analytics.data.v1alpha.IRecurringAudienceList[] = + []; + const iterable = client.listRecurringAudienceListsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listRecurringAudienceLists + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.listRecurringAudienceLists + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRecurringAudienceLists with error', async () => { + const client = + new alphaanalyticsdataModule.v1alpha.AlphaAnalyticsDataClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.analytics.data.v1alpha.ListRecurringAudienceListsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.analytics.data.v1alpha.ListRecurringAudienceListsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRecurringAudienceLists.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listRecurringAudienceListsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.analytics.data.v1alpha.IRecurringAudienceList[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listRecurringAudienceLists + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.listRecurringAudienceLists + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('audienceList', () => { + const fakePath = '/rendered/path/audienceList'; + const expectedParameters = { + property: 'propertyValue', + audience_list: 'audienceListValue', + }; + const client = + new alphaanalyticsdataModule.v1alpha.AlphaAnalyticsDataClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.audienceListPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.audienceListPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('audienceListPath', () => { + const result = client.audienceListPath( + 'propertyValue', + 'audienceListValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.audienceListPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchPropertyFromAudienceListName', () => { + const result = client.matchPropertyFromAudienceListName(fakePath); + assert.strictEqual(result, 'propertyValue'); + assert( + (client.pathTemplates.audienceListPathTemplate.match as SinonStub) .getCall(-1) .calledWith(fakePath) ); @@ -1438,5 +2086,71 @@ describe('v1alpha.AlphaAnalyticsDataClient', () => { ); }); }); + + describe('recurringAudienceList', () => { + const fakePath = '/rendered/path/recurringAudienceList'; + const expectedParameters = { + property: 'propertyValue', + recurring_audience_list: 'recurringAudienceListValue', + }; + const client = + new alphaanalyticsdataModule.v1alpha.AlphaAnalyticsDataClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.recurringAudienceListPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.recurringAudienceListPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('recurringAudienceListPath', () => { + const result = client.recurringAudienceListPath( + 'propertyValue', + 'recurringAudienceListValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.recurringAudienceListPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchPropertyFromRecurringAudienceListName', () => { + const result = + client.matchPropertyFromRecurringAudienceListName(fakePath); + assert.strictEqual(result, 'propertyValue'); + assert( + ( + client.pathTemplates.recurringAudienceListPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchRecurringAudienceListFromRecurringAudienceListName', () => { + const result = + client.matchRecurringAudienceListFromRecurringAudienceListName( + fakePath + ); + assert.strictEqual(result, 'recurringAudienceListValue'); + assert( + ( + client.pathTemplates.recurringAudienceListPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); });