private void FetchScratch(object sender, DoWorkEventArgs args) { FirestoreService firestoreService = new FirestoreService(new BaseClientService.Initializer { ApplicationName = "Sipp-PC", ApiKey = "AIzaSyCpPmG-AYByk3hircLVnAY_MLcp5ytIsAI", } ); ProjectsResource.DatabasesResource.DocumentsResource.ListRequest req = firestoreService.Projects.Databases.Documents.List("projects/sipp-1f4c4/databases/(default)/documents/products/scratch", "projects"); try { ListDocumentsResponse rsp = req.Execute(); scratchProjects = new List <ScratchData>(); foreach (Document project in rsp.Documents) { string title = getStringValue(project, "name"); string coverUrl = getStringValue(project, "cover_url"); string description = getStringValue(project, "description"); string scratchUrl = getStringValue(project, "scratch_url"); string docUrl = getStringValue(project, "doc_url"); scratchProjects.Add(new ScratchData(title, coverUrl, description, scratchUrl, docUrl)); } } catch (Google.GoogleApiException e) { MessageBox.Show(e.ToString()); } }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonSimpleSystemsManagementConfig config = new AmazonSimpleSystemsManagementConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonSimpleSystemsManagementClient client = new AmazonSimpleSystemsManagementClient(creds, config); ListDocumentsResponse resp = new ListDocumentsResponse(); do { ListDocumentsRequest req = new ListDocumentsRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.ListDocuments(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.DocumentIdentifiers) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { ListDocumentsResponse response = new ListDocumentsResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("DocumentIdentifiers", targetDepth)) { var unmarshaller = new ListUnmarshaller <DocumentIdentifier, DocumentIdentifierUnmarshaller>(DocumentIdentifierUnmarshaller.Instance); response.DocumentIdentifiers = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("NextToken", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.NextToken = unmarshaller.Unmarshall(context); continue; } } return(response); }
static bool ListDocuments(string url, Credentials c) { Console.WriteLine("Listing documents..."); ArticulateOnline ao = new ArticulateOnline { Url = url }; ListDocumentsRequest request = new ListDocumentsRequest { Credentials = c }; ListDocumentsResponse response = ao.ListDocuments(request); if (response.Success) { foreach (DocumentSummary ds in response.Documents) { Console.WriteLine("{0} {1} {2}", ds.DocumentID, ds.Name, ds.Description); } } return(response.Success); }