private Task SetContextInternalAsync(ContextsClient client, string sessionId, string projectId, string contextName, int lifeSpan = 1, IDictionary <string, string> parameters = null)
        {
            var session = CreateSession(projectId, sessionId);

            var context = GetContext(projectId, session, contextName, lifeSpan, parameters);

            return(client.CreateContextAsync(session, context));
        }
Пример #2
0
        /// <summary>Snippet for CreateContextAsync</summary>
        public async Task CreateContextResourceNamesAsync()
        {
            // Snippet: CreateContextAsync(SessionName, Context, CallSettings)
            // Additional: CreateContextAsync(SessionName, Context, CancellationToken)
            // Create client
            ContextsClient contextsClient = await ContextsClient.CreateAsync();

            // Initialize request argument(s)
            SessionName parent  = SessionName.FromProjectSession("[PROJECT]", "[SESSION]");
            Context     context = new Context();
            // Make the request
            Context response = await contextsClient.CreateContextAsync(parent, context);

            // End snippet
        }
Пример #3
0
        /// <summary>Snippet for CreateContextAsync</summary>
        public async Task CreateContextAsync()
        {
            // Snippet: CreateContextAsync(string, Context, CallSettings)
            // Additional: CreateContextAsync(string, Context, CancellationToken)
            // Create client
            ContextsClient contextsClient = await ContextsClient.CreateAsync();

            // Initialize request argument(s)
            string  parent  = "projects/[PROJECT]/agent/sessions/[SESSION]";
            Context context = new Context();
            // Make the request
            Context response = await contextsClient.CreateContextAsync(parent, context);

            // End snippet
        }
Пример #4
0
        /// <summary>Snippet for CreateContextAsync</summary>
        public async Task CreateContextRequestObjectAsync()
        {
            // Snippet: CreateContextAsync(CreateContextRequest, CallSettings)
            // Additional: CreateContextAsync(CreateContextRequest, CancellationToken)
            // Create client
            ContextsClient contextsClient = await ContextsClient.CreateAsync();

            // Initialize request argument(s)
            CreateContextRequest request = new CreateContextRequest
            {
                ParentAsSessionName = SessionName.FromProjectSession("[PROJECT]", "[SESSION]"),
                Context             = new Context(),
            };
            // Make the request
            Context response = await contextsClient.CreateContextAsync(request);

            // End snippet
        }
Пример #5
0
        /// <summary>Snippet for CreateContextAsync</summary>
        public async Task CreateContextRequestObjectAsync()
        {
            // Snippet: CreateContextAsync(CreateContextRequest, CallSettings)
            // Additional: CreateContextAsync(CreateContextRequest, CancellationToken)
            // Create client
            ContextsClient contextsClient = await ContextsClient.CreateAsync();

            // Initialize request argument(s)
            CreateContextRequest request = new CreateContextRequest
            {
                Parent  = "",
                Context = new Context(),
            };
            // Make the request
            Context response = await contextsClient.CreateContextAsync(request);

            // End snippet
        }