LearningRegistry.LRClient.Publish C# (CSharp) Method

Publish() public method

public Publish ( lr_Envelope docs ) : PublishResponse
docs lr_Envelope
return PublishResponse
        public PublishResponse Publish(lr_Envelope docs)
        {
            string rawData = LRUtils.HttpPostRequest(_baseUri, LRUtils.Routes.Publish,
                                                     docs.Serialize(), "application/json", 
                                                     this.Username, this.Password);
            return _serializer.Deserialize<PublishResponse>(rawData);
        }
		

Usage Example

Ejemplo n.º 1
0
    protected void PublishDocuments(object sender, EventArgs e)
    {
        bool validated = ValidateRequiredFields();
        if(validated)
        {
            lr_Envelope envelope = buildEnvelopeFromMapping();

            LRClient client = new LRClient(this.ServerInfoWidget.NodeUrl);
            if (!String.IsNullOrEmpty(this.ServerInfoWidget.HttpUsername))
            {
                client.Username = ServerInfoWidget.HttpUsername;
                client.Password = ServerInfoWidget.HttpPassword;
            }
            PublishResponse res = client.Publish(envelope);
            buildAndShowNotification(res);
        }
        else
            ShowMissingFields();
    }