@@ -912,7 +912,10 @@ public void ListTopicSnapshotsRequestObject()
912
912
// Create client
913
913
PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient . Create ( ) ;
914
914
// Initialize request argument(s)
915
- ListTopicSnapshotsRequest request = new ListTopicSnapshotsRequest { Topic = "" , } ;
915
+ ListTopicSnapshotsRequest request = new ListTopicSnapshotsRequest
916
+ {
917
+ TopicAsTopicName = TopicName . FromProjectTopic ( "[PROJECT]" , "[TOPIC]" ) ,
918
+ } ;
916
919
// Make the request
917
920
PagedEnumerable < ListTopicSnapshotsResponse , string > response = publisherServiceApiClient . ListTopicSnapshots ( request ) ;
918
921
@@ -957,7 +960,10 @@ public async Task ListTopicSnapshotsRequestObjectAsync()
957
960
// Create client
958
961
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient . CreateAsync ( ) ;
959
962
// Initialize request argument(s)
960
- ListTopicSnapshotsRequest request = new ListTopicSnapshotsRequest { Topic = "" , } ;
963
+ ListTopicSnapshotsRequest request = new ListTopicSnapshotsRequest
964
+ {
965
+ TopicAsTopicName = TopicName . FromProjectTopic ( "[PROJECT]" , "[TOPIC]" ) ,
966
+ } ;
961
967
// Make the request
962
968
PagedAsyncEnumerable < ListTopicSnapshotsResponse , string > response = publisherServiceApiClient . ListTopicSnapshotsAsync ( request ) ;
963
969
@@ -995,6 +1001,186 @@ await response.AsRawResponses().ForEachAsync((ListTopicSnapshotsResponse page) =
995
1001
// End snippet
996
1002
}
997
1003
1004
+ /// <summary>Snippet for ListTopicSnapshots</summary>
1005
+ public void ListTopicSnapshots ( )
1006
+ {
1007
+ // Snippet: ListTopicSnapshots(string, string, int?, CallSettings)
1008
+ // Create client
1009
+ PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient . Create ( ) ;
1010
+ // Initialize request argument(s)
1011
+ string topic = "projects/[PROJECT]/topics/[TOPIC]" ;
1012
+ // Make the request
1013
+ PagedEnumerable < ListTopicSnapshotsResponse , string > response = publisherServiceApiClient . ListTopicSnapshots ( topic ) ;
1014
+
1015
+ // Iterate over all response items, lazily performing RPCs as required
1016
+ foreach ( string item in response )
1017
+ {
1018
+ // Do something with each item
1019
+ Console . WriteLine ( item ) ;
1020
+ }
1021
+
1022
+ // Or iterate over pages (of server-defined size), performing one RPC per page
1023
+ foreach ( ListTopicSnapshotsResponse page in response . AsRawResponses ( ) )
1024
+ {
1025
+ // Do something with each page of items
1026
+ Console . WriteLine ( "A page of results:" ) ;
1027
+ foreach ( string item in page )
1028
+ {
1029
+ // Do something with each item
1030
+ Console . WriteLine ( item ) ;
1031
+ }
1032
+ }
1033
+
1034
+ // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
1035
+ int pageSize = 10 ;
1036
+ Page < string > singlePage = response . ReadPage ( pageSize ) ;
1037
+ // Do something with the page of items
1038
+ Console . WriteLine ( $ "A page of { pageSize } results (unless it's the final page):") ;
1039
+ foreach ( string item in singlePage )
1040
+ {
1041
+ // Do something with each item
1042
+ Console . WriteLine ( item ) ;
1043
+ }
1044
+ // Store the pageToken, for when the next page is required.
1045
+ string nextPageToken = singlePage . NextPageToken ;
1046
+ // End snippet
1047
+ }
1048
+
1049
+ /// <summary>Snippet for ListTopicSnapshots</summary>
1050
+ public async Task ListTopicSnapshotsAsync ( )
1051
+ {
1052
+ // Snippet: ListTopicSnapshotsAsync(string, string, int?, CallSettings)
1053
+ // Create client
1054
+ PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient . CreateAsync ( ) ;
1055
+ // Initialize request argument(s)
1056
+ string topic = "projects/[PROJECT]/topics/[TOPIC]" ;
1057
+ // Make the request
1058
+ PagedAsyncEnumerable < ListTopicSnapshotsResponse , string > response = publisherServiceApiClient . ListTopicSnapshotsAsync ( topic ) ;
1059
+
1060
+ // Iterate over all response items, lazily performing RPCs as required
1061
+ await response . ForEachAsync ( ( string item ) =>
1062
+ {
1063
+ // Do something with each item
1064
+ Console . WriteLine ( item ) ;
1065
+ } ) ;
1066
+
1067
+ // Or iterate over pages (of server-defined size), performing one RPC per page
1068
+ await response . AsRawResponses ( ) . ForEachAsync ( ( ListTopicSnapshotsResponse page ) =>
1069
+ {
1070
+ // Do something with each page of items
1071
+ Console . WriteLine ( "A page of results:" ) ;
1072
+ foreach ( string item in page )
1073
+ {
1074
+ // Do something with each item
1075
+ Console . WriteLine ( item ) ;
1076
+ }
1077
+ } ) ;
1078
+
1079
+ // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
1080
+ int pageSize = 10 ;
1081
+ Page < string > singlePage = await response . ReadPageAsync ( pageSize ) ;
1082
+ // Do something with the page of items
1083
+ Console . WriteLine ( $ "A page of { pageSize } results (unless it's the final page):") ;
1084
+ foreach ( string item in singlePage )
1085
+ {
1086
+ // Do something with each item
1087
+ Console . WriteLine ( item ) ;
1088
+ }
1089
+ // Store the pageToken, for when the next page is required.
1090
+ string nextPageToken = singlePage . NextPageToken ;
1091
+ // End snippet
1092
+ }
1093
+
1094
+ /// <summary>Snippet for ListTopicSnapshots</summary>
1095
+ public void ListTopicSnapshotsResourceNames ( )
1096
+ {
1097
+ // Snippet: ListTopicSnapshots(TopicName, string, int?, CallSettings)
1098
+ // Create client
1099
+ PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient . Create ( ) ;
1100
+ // Initialize request argument(s)
1101
+ TopicName topic = TopicName . FromProjectTopic ( "[PROJECT]" , "[TOPIC]" ) ;
1102
+ // Make the request
1103
+ PagedEnumerable < ListTopicSnapshotsResponse , string > response = publisherServiceApiClient . ListTopicSnapshots ( topic ) ;
1104
+
1105
+ // Iterate over all response items, lazily performing RPCs as required
1106
+ foreach ( string item in response )
1107
+ {
1108
+ // Do something with each item
1109
+ Console . WriteLine ( item ) ;
1110
+ }
1111
+
1112
+ // Or iterate over pages (of server-defined size), performing one RPC per page
1113
+ foreach ( ListTopicSnapshotsResponse page in response . AsRawResponses ( ) )
1114
+ {
1115
+ // Do something with each page of items
1116
+ Console . WriteLine ( "A page of results:" ) ;
1117
+ foreach ( string item in page )
1118
+ {
1119
+ // Do something with each item
1120
+ Console . WriteLine ( item ) ;
1121
+ }
1122
+ }
1123
+
1124
+ // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
1125
+ int pageSize = 10 ;
1126
+ Page < string > singlePage = response . ReadPage ( pageSize ) ;
1127
+ // Do something with the page of items
1128
+ Console . WriteLine ( $ "A page of { pageSize } results (unless it's the final page):") ;
1129
+ foreach ( string item in singlePage )
1130
+ {
1131
+ // Do something with each item
1132
+ Console . WriteLine ( item ) ;
1133
+ }
1134
+ // Store the pageToken, for when the next page is required.
1135
+ string nextPageToken = singlePage . NextPageToken ;
1136
+ // End snippet
1137
+ }
1138
+
1139
+ /// <summary>Snippet for ListTopicSnapshots</summary>
1140
+ public async Task ListTopicSnapshotsResourceNamesAsync ( )
1141
+ {
1142
+ // Snippet: ListTopicSnapshotsAsync(TopicName, string, int?, CallSettings)
1143
+ // Create client
1144
+ PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient . CreateAsync ( ) ;
1145
+ // Initialize request argument(s)
1146
+ TopicName topic = TopicName . FromProjectTopic ( "[PROJECT]" , "[TOPIC]" ) ;
1147
+ // Make the request
1148
+ PagedAsyncEnumerable < ListTopicSnapshotsResponse , string > response = publisherServiceApiClient . ListTopicSnapshotsAsync ( topic ) ;
1149
+
1150
+ // Iterate over all response items, lazily performing RPCs as required
1151
+ await response . ForEachAsync ( ( string item ) =>
1152
+ {
1153
+ // Do something with each item
1154
+ Console . WriteLine ( item ) ;
1155
+ } ) ;
1156
+
1157
+ // Or iterate over pages (of server-defined size), performing one RPC per page
1158
+ await response . AsRawResponses ( ) . ForEachAsync ( ( ListTopicSnapshotsResponse page ) =>
1159
+ {
1160
+ // Do something with each page of items
1161
+ Console . WriteLine ( "A page of results:" ) ;
1162
+ foreach ( string item in page )
1163
+ {
1164
+ // Do something with each item
1165
+ Console . WriteLine ( item ) ;
1166
+ }
1167
+ } ) ;
1168
+
1169
+ // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
1170
+ int pageSize = 10 ;
1171
+ Page < string > singlePage = await response . ReadPageAsync ( pageSize ) ;
1172
+ // Do something with the page of items
1173
+ Console . WriteLine ( $ "A page of { pageSize } results (unless it's the final page):") ;
1174
+ foreach ( string item in singlePage )
1175
+ {
1176
+ // Do something with each item
1177
+ Console . WriteLine ( item ) ;
1178
+ }
1179
+ // Store the pageToken, for when the next page is required.
1180
+ string nextPageToken = singlePage . NextPageToken ;
1181
+ // End snippet
1182
+ }
1183
+
998
1184
/// <summary>Snippet for DeleteTopic</summary>
999
1185
public void DeleteTopicRequestObject ( )
1000
1186
{
0 commit comments