Subversion Repository Public Repository

insightly-api

Diff Revisions 10 vs 13 for /trunk/Insightly/InsightlyAPI.cs

Diff revisions: vs.
  @@ -315,5 +315,39 @@
315 315
316 316 #endregion Organisations
317 317
318 + #region Projects
319 +
320 + /// <summary>
321 + /// Gets the project for the unique organisation ID.
322 + /// Note that the Id is not the Id shown for the project in the web browser, but
323 + /// the project Id that is unique to insightly.
324 + /// </summary>
325 + /// <param name="projectId">The project unique identifier.</param>
326 + /// <returns>The project for the given id.</returns>
327 + public Project GetProject(int projectId)
328 + {
329 + var request = new RestRequest(Method.GET);
330 + request.RequestFormat = DataFormat.Json;
331 + request.Resource = String.Format("projects/{0}", projectId);
332 +
333 + return Execute<Project>(request);
334 + }
335 +
336 + /// <summary>
337 + /// Gets projects.
338 + /// </summary>
339 + /// <param name="fullDetails">if set to <c>true</c> return full details.</param>
340 + /// <returns>All projects.</returns>
341 + public List<Project> GetProjects(bool fullDetails)
342 + {
343 + var request = new RestRequest(Method.GET);
344 + request.RequestFormat = DataFormat.Json;
345 + request.Resource = fullDetails ? "projects" : "projects?brief=true";
346 +
347 + return Execute<List<Project>>(request);
348 + }
349 +
350 + #endregion Projects
351 +
318 352 }
319 353 }