コード例 #1
0
 public LRClient()
 {
     _serializer           = LRUtils.GetSerializer();
     _encoder              = LRUtils.GetEncoder();
     _harvester            = new Harvester();
     SslValidationCallback = AcceptAllCertificates;
 }
コード例 #2
0
        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));
        }
コード例 #3
0
        private HarvestResult harvestFromDateRange(string action, DateTime fromDate, DateTime untilDate)
        {
            var args = new Dictionary <string, object>();

            args["from"]  = fromDate.ToString(LRUtils.ISO_8061_FORMAT);
            args["until"] = untilDate.ToString(LRUtils.ISO_8061_FORMAT);
            return(LRUtils.Harvest(_baseUri, action, args));
        }
コード例 #4
0
 private HarvestResult harvestFromDateBoundary(string action, string boundaryType, DateTime date)
 {
     return(LRUtils.Harvest(_baseUri, action,
                            new Dictionary <string, object>()
     {
         { boundaryType, date.ToString(LRUtils.ISO_8061_FORMAT) }
     }));
 }
コード例 #5
0
 public LRClient(string baseUri, string username, string password)
 {
     _baseUri              = new Uri(baseUri);
     _serializer           = LRUtils.GetSerializer();
     _encoder              = LRUtils.GetEncoder();
     _harvester            = new Harvester(_baseUri);
     Username              = username;
     Password              = password;
     SslValidationCallback = AcceptAllCertificates;
 }
コード例 #6
0
        public ObtainResult ObtainDocsByResourceLocator(string locator, bool ids_only = false)
        {
            Dictionary <string, object> args = new Dictionary <string, object>();

            if (ids_only)
            {
                args["ids_only"]  = "true";
                args["by_doc_ID"] = "true";                 //we only want doc ids
            }

            return(LRUtils.Obtain(_baseUri, locator, args));
        }
コード例 #7
0
        public lr_document ObtainDocByID(string docId)
        {
            Dictionary <string, object> args = new Dictionary <string, object>();

            args["by_doc_ID"] = true;

            var result = LRUtils.Obtain(_baseUri, docId, args, this.Username, this.Password);

            if (result.documents.Count < 1)
            {
                throw new Exception("Document with id " + docId + " does not exist.");
            }

            return(result.documents[0].document[0]);
        }
コード例 #8
0
        private GetRecordHarvestResult getRecord(string requestId, bool byDocId = false)
        {
            Console.WriteLine(_baseUri.AbsoluteUri);
            var args = new Dictionary <string, object>();

            args["request_ID"] = requestId;
            if (byDocId)
            {
                args["by_doc_ID"] = true.ToString();
            }

            var result = (GetRecordHarvestResult)LRUtils.Harvest(_baseUri, HarvesterActions.GetRecord, args);

            return(result);
        }
コード例 #9
0
 protected override ResumableResult getPage()
 {
     return(LRUtils.Slice(this.BaseUri, this._Args));
 }
コード例 #10
0
 protected override ResumableResult getPage()
 {
     return(LRUtils.Harvest(this.BaseUri, this.Action, _Args, this.HttpUsername, this.HttpPassword));
 }
コード例 #11
0
 public ListMetadataFormatsHarvestResult ListMetadataFormats()
 {
     return((ListMetadataFormatsHarvestResult)LRUtils.Harvest(_baseUri, HarvesterActions.ListMetadataFormats, null));
 }
コード例 #12
0
 public ListIdentifiersHarvestResult ListIdentifiers()
 {
     return((ListIdentifiersHarvestResult)LRUtils.Harvest(_baseUri, HarvesterActions.ListIdentifiers, null));
 }
コード例 #13
0
 public ListRecordsHarvestResult ListRecords()
 {
     return((ListRecordsHarvestResult)LRUtils.Harvest(_baseUri, HarvesterActions.ListRecords, null));
 }
コード例 #14
0
ファイル: ObtainResult.cs プロジェクト: grrizzly/LR.Net
 protected override ResumableResult getPage()
 {
     return(LRUtils.Obtain(BaseUri, new List <string>(), _Args, HttpUsername, HttpPassword));
 }