/// <summary>
        /// Get Definitions for VHost
        /// </summary>
        /// <exception cref="Thinkcode.RabbitMQ.OpenAPI.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="vhost"></param>
        /// <returns>ApiResponse of Definition</returns>
        public Thinkcode.RabbitMQ.OpenAPI.Client.ApiResponse <Definition> GetDefinitionsForVirtualHostWithHttpInfo(string vhost)
        {
            // verify the required parameter 'vhost' is set
            if (vhost == null)
            {
                throw new Thinkcode.RabbitMQ.OpenAPI.Client.ApiException(400, "Missing required parameter 'vhost' when calling InformationalApi->GetDefinitionsForVirtualHost");
            }

            Thinkcode.RabbitMQ.OpenAPI.Client.RequestOptions requestOptions = new Thinkcode.RabbitMQ.OpenAPI.Client.RequestOptions();

            String[] @contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] @accepts = new String[] {
                "application/json"
            };

            var localVarContentType = Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.SelectHeaderContentType(@contentTypes);

            if (localVarContentType != null)
            {
                requestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.SelectHeaderAccept(@accepts);

            if (localVarAccept != null)
            {
                requestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            if (vhost != null)
            {
                requestOptions.PathParameters.Add("vhost", Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.ParameterToString(vhost)); // path parameter
            }
            // authentication (basic_auth) required
            // http basic authentication required
            if (!String.IsNullOrEmpty(this.Configuration.Username) || !String.IsNullOrEmpty(this.Configuration.Password))
            {
                requestOptions.HeaderParameters.Add("Authorization", "Basic " + Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password));
                requestOptions.HeaderParameters.Add("X-Auth-Fallback", "Basic " + Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password));
            }

            // make the HTTP request

            var response = this.Client.Get <Definition>("/definitions/{vhost}", requestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception exception = this.ExceptionFactory("GetDefinitionsForVirtualHost", response);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(response);
        }
        /// <summary>
        /// List Users Topic Permissions
        /// </summary>
        /// <exception cref="Thinkcode.RabbitMQ.OpenAPI.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="user"></param>
        /// <returns>ApiResponse of List&lt;PermissionTopic&gt;</returns>
        public Thinkcode.RabbitMQ.OpenAPI.Client.ApiResponse <List <PermissionTopic> > ListUsersTopicPermissionsWithHttpInfo(string user)
        {
            // verify the required parameter 'user' is set
            if (user == null)
            {
                throw new Thinkcode.RabbitMQ.OpenAPI.Client.ApiException(400, "Missing required parameter 'user' when calling PermissionsApi->ListUsersTopicPermissions");
            }

            Thinkcode.RabbitMQ.OpenAPI.Client.RequestOptions requestOptions = new Thinkcode.RabbitMQ.OpenAPI.Client.RequestOptions();

            String[] @contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] @accepts = new String[] {
                "application/json"
            };

            var localVarContentType = Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.SelectHeaderContentType(@contentTypes);

            if (localVarContentType != null)
            {
                requestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.SelectHeaderAccept(@accepts);

            if (localVarAccept != null)
            {
                requestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            if (user != null)
            {
                requestOptions.PathParameters.Add("user", Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.ParameterToString(user)); // path parameter
            }
            // authentication (basic_auth) required
            // http basic authentication required
            if (!String.IsNullOrEmpty(this.Configuration.Username) || !String.IsNullOrEmpty(this.Configuration.Password))
            {
                requestOptions.HeaderParameters.Add("Authorization", "Basic " + Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password));
                requestOptions.HeaderParameters.Add("X-Auth-Fallback", "Basic " + Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password));
            }

            // make the HTTP request

            var response = this.Client.Get <List <PermissionTopic> >("/users/{user}/topic-permissions", requestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception exception = this.ExceptionFactory("ListUsersTopicPermissions", response);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(response);
        }
        /// <summary>
        /// List User Permissions
        /// </summary>
        /// <exception cref="Thinkcode.RabbitMQ.OpenAPI.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="user"></param>
        /// <returns>Task of ApiResponse (List&lt;PermissionUser&gt;)</returns>
        public async System.Threading.Tasks.Task <Thinkcode.RabbitMQ.OpenAPI.Client.ApiResponse <List <PermissionUser> > > ListUserPermissionsAsyncWithHttpInfo(string user)
        {
            // verify the required parameter 'user' is set
            if (user == null)
            {
                throw new Thinkcode.RabbitMQ.OpenAPI.Client.ApiException(400, "Missing required parameter 'user' when calling PermissionsApi->ListUserPermissions");
            }


            Thinkcode.RabbitMQ.OpenAPI.Client.RequestOptions requestOptions = new Thinkcode.RabbitMQ.OpenAPI.Client.RequestOptions();

            String[] @contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] @accepts = new String[] {
                "application/json"
            };

            foreach (var contentType in @contentTypes)
            {
                requestOptions.HeaderParameters.Add("Content-Type", contentType);
            }

            foreach (var accept in @accepts)
            {
                requestOptions.HeaderParameters.Add("Accept", accept);
            }

            if (user != null)
            {
                requestOptions.PathParameters.Add("user", Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.ParameterToString(user)); // path parameter
            }
            // authentication (basic_auth) required
            // http basic authentication required
            if (!String.IsNullOrEmpty(this.Configuration.Username) || !String.IsNullOrEmpty(this.Configuration.Password))
            {
                requestOptions.HeaderParameters.Add("Authorization", "Basic " + Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password));
                requestOptions.HeaderParameters.Add("X-Auth-Fallback", "Basic " + Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password));
            }

            // make the HTTP request

            var response = await this.AsynchronousClient.GetAsync <List <PermissionUser> >("/users/{user}/permissions", requestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception exception = this.ExceptionFactory("ListUserPermissions", response);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(response);
        }
        /// <summary>
        /// List Definitions
        /// </summary>
        /// <exception cref="Thinkcode.RabbitMQ.OpenAPI.Client.ApiException">Thrown when fails to make API call</exception>
        /// <returns>ApiResponse of Definition</returns>
        public Thinkcode.RabbitMQ.OpenAPI.Client.ApiResponse <Definition> ListDefinitionsWithHttpInfo()
        {
            Thinkcode.RabbitMQ.OpenAPI.Client.RequestOptions requestOptions = new Thinkcode.RabbitMQ.OpenAPI.Client.RequestOptions();

            String[] @contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] @accepts = new String[] {
                "application/json"
            };

            var localVarContentType = Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.SelectHeaderContentType(@contentTypes);

            if (localVarContentType != null)
            {
                requestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.SelectHeaderAccept(@accepts);

            if (localVarAccept != null)
            {
                requestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }


            // authentication (basic_auth) required
            // http basic authentication required
            if (!String.IsNullOrEmpty(this.Configuration.Username) || !String.IsNullOrEmpty(this.Configuration.Password))
            {
                requestOptions.HeaderParameters.Add("Authorization", "Basic " + Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password));
                requestOptions.HeaderParameters.Add("X-Auth-Fallback", "Basic " + Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password));
            }

            // make the HTTP request

            var response = this.Client.Get <Definition>("/definitions", requestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception exception = this.ExceptionFactory("ListDefinitions", response);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(response);
        }
        /// <summary>
        /// List Definitions
        /// </summary>
        /// <exception cref="Thinkcode.RabbitMQ.OpenAPI.Client.ApiException">Thrown when fails to make API call</exception>
        /// <returns>Task of ApiResponse (Definition)</returns>
        public async System.Threading.Tasks.Task <Thinkcode.RabbitMQ.OpenAPI.Client.ApiResponse <Definition> > ListDefinitionsAsyncWithHttpInfo()
        {
            Thinkcode.RabbitMQ.OpenAPI.Client.RequestOptions requestOptions = new Thinkcode.RabbitMQ.OpenAPI.Client.RequestOptions();

            String[] @contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] @accepts = new String[] {
                "application/json"
            };

            foreach (var contentType in @contentTypes)
            {
                requestOptions.HeaderParameters.Add("Content-Type", contentType);
            }

            foreach (var accept in @accepts)
            {
                requestOptions.HeaderParameters.Add("Accept", accept);
            }


            // authentication (basic_auth) required
            // http basic authentication required
            if (!String.IsNullOrEmpty(this.Configuration.Username) || !String.IsNullOrEmpty(this.Configuration.Password))
            {
                requestOptions.HeaderParameters.Add("Authorization", "Basic " + Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password));
                requestOptions.HeaderParameters.Add("X-Auth-Fallback", "Basic " + Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password));
            }

            // make the HTTP request

            var response = await this.AsynchronousClient.GetAsync <Definition>("/definitions", requestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception exception = this.ExceptionFactory("ListDefinitions", response);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(response);
        }
Example #6
0
        /// <summary>
        /// Publish Message
        /// </summary>
        /// <exception cref="Thinkcode.RabbitMQ.OpenAPI.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="vhost"></param>
        /// <param name="exchange"></param>
        /// <param name="body"> (optional)</param>
        /// <returns>Task of ApiResponse (PublishResponse)</returns>
        public async System.Threading.Tasks.Task <Thinkcode.RabbitMQ.OpenAPI.Client.ApiResponse <PublishResponse> > PublishMessageAsyncWithHttpInfo(string vhost, string exchange, PublishRequest body = null)
        {
            // verify the required parameter 'vhost' is set
            if (vhost == null)
            {
                throw new Thinkcode.RabbitMQ.OpenAPI.Client.ApiException(400, "Missing required parameter 'vhost' when calling PubSubApi->PublishMessage");
            }

            // verify the required parameter 'exchange' is set
            if (exchange == null)
            {
                throw new Thinkcode.RabbitMQ.OpenAPI.Client.ApiException(400, "Missing required parameter 'exchange' when calling PubSubApi->PublishMessage");
            }


            Thinkcode.RabbitMQ.OpenAPI.Client.RequestOptions requestOptions = new Thinkcode.RabbitMQ.OpenAPI.Client.RequestOptions();

            String[] @contentTypes = new String[] {
                "application/json"
            };

            // to determine the Accept header
            String[] @accepts = new String[] {
                "application/json"
            };

            foreach (var contentType in @contentTypes)
            {
                requestOptions.HeaderParameters.Add("Content-Type", contentType);
            }

            foreach (var accept in @accepts)
            {
                requestOptions.HeaderParameters.Add("Accept", accept);
            }

            if (vhost != null)
            {
                requestOptions.PathParameters.Add("vhost", Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.ParameterToString(vhost)); // path parameter
            }
            if (exchange != null)
            {
                requestOptions.PathParameters.Add("exchange", Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.ParameterToString(exchange)); // path parameter
            }
            requestOptions.Data = body;

            // authentication (basic_auth) required
            // http basic authentication required
            if (!String.IsNullOrEmpty(this.Configuration.Username) || !String.IsNullOrEmpty(this.Configuration.Password))
            {
                requestOptions.HeaderParameters.Add("Authorization", "Basic " + Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password));
                requestOptions.HeaderParameters.Add("X-Auth-Fallback", "Basic " + Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password));
            }

            // make the HTTP request

            var response = await this.AsynchronousClient.PostAsync <PublishResponse>("/exchanges/{vhost}/{exchange}/publish", requestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception exception = this.ExceptionFactory("PublishMessage", response);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(response);
        }
Example #7
0
        /// <summary>
        /// Consume Message
        /// </summary>
        /// <exception cref="Thinkcode.RabbitMQ.OpenAPI.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="vhost"></param>
        /// <param name="queue"></param>
        /// <param name="body"> (optional)</param>
        /// <returns>ApiResponse of List&lt;ConsumeResponse&gt;</returns>
        public Thinkcode.RabbitMQ.OpenAPI.Client.ApiResponse <List <ConsumeResponse> > ConsumeMessageWithHttpInfo(string vhost, string queue, ConsumeRequest body = null)
        {
            // verify the required parameter 'vhost' is set
            if (vhost == null)
            {
                throw new Thinkcode.RabbitMQ.OpenAPI.Client.ApiException(400, "Missing required parameter 'vhost' when calling PubSubApi->ConsumeMessage");
            }

            // verify the required parameter 'queue' is set
            if (queue == null)
            {
                throw new Thinkcode.RabbitMQ.OpenAPI.Client.ApiException(400, "Missing required parameter 'queue' when calling PubSubApi->ConsumeMessage");
            }

            Thinkcode.RabbitMQ.OpenAPI.Client.RequestOptions requestOptions = new Thinkcode.RabbitMQ.OpenAPI.Client.RequestOptions();

            String[] @contentTypes = new String[] {
                "application/json"
            };

            // to determine the Accept header
            String[] @accepts = new String[] {
                "application/json"
            };

            var localVarContentType = Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.SelectHeaderContentType(@contentTypes);

            if (localVarContentType != null)
            {
                requestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.SelectHeaderAccept(@accepts);

            if (localVarAccept != null)
            {
                requestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            if (vhost != null)
            {
                requestOptions.PathParameters.Add("vhost", Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.ParameterToString(vhost)); // path parameter
            }
            if (queue != null)
            {
                requestOptions.PathParameters.Add("queue", Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.ParameterToString(queue)); // path parameter
            }
            requestOptions.Data = body;

            // authentication (basic_auth) required
            // http basic authentication required
            if (!String.IsNullOrEmpty(this.Configuration.Username) || !String.IsNullOrEmpty(this.Configuration.Password))
            {
                requestOptions.HeaderParameters.Add("Authorization", "Basic " + Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password));
                requestOptions.HeaderParameters.Add("X-Auth-Fallback", "Basic " + Thinkcode.RabbitMQ.OpenAPI.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password));
            }

            // make the HTTP request

            var response = this.Client.Post <List <ConsumeResponse> >("/queues/{vhost}/{queue}/get", requestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception exception = this.ExceptionFactory("ConsumeMessage", response);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(response);
        }