public static async Task <Unit> Run(InfusioClient client) { /* * =============== * STEP 1 * =============== * Describe the Infusionsoft operation that want to execute. * InfusioOp objects are composable. You combine any number of InfusioOps together to form one InfusioOp. * You're not stuck with running one operation at a time like you're probably used to traditionally. * You can, however, use this library as a traditional API client as well. * See the Classic Api Client demo for more information. * =============== */ InfusioOp <FullContact> operation = CustomOperations.AddTagToContact( new Tag(name: "developers"), new EmailAddress("*****@*****.**") ); /* * =============== * STEP 2 * =============== * Execute your operation. * This returns a data type with two possible values. * Either<InfusioError, T> * =============== */ var result = await operation.RunWith(client); return(result.Match( Left: error => Console.WriteLine($"error: {error.Value}"), Right: contact => Console.WriteLine($"contact: {JsonConvert.SerializeObject(contact, Formatting.Indented)}") )); }
public static Show <InfusioOp <Opportunity> > AsShow <T>(this InfusioOp <T> .UpdatePropertiesOnOpportunity op) => () => { var uri = MakeUri($"/opportunities/{op.OpportunityId}"); var body = MakeBody(op.Opportunity); return(body.Fold($"Update an Opportunity. [PATCH: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <Unit> > AsShow <T>(this InfusioOp <T> .DeleteAppointment op) => () => { var uri = MakeUri($"/appointments/{op.AppointmentId}"); var body = MakeBody(); return(body.Fold($"Delete an Appointment. [DELETE: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <Transaction> > AsShow <T>(this InfusioOp <T> .GetTransaction op) => () => { var uri = MakeUri($"/transactions/{op.TransactionId}"); var body = MakeBody(); return(body.Fold($"Retrieve a Transaction. [GET: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <InfusionTask> > AsShow <T>(this InfusioOp <T> .UpdatePropertiesOnTask op) => () => { var uri = MakeUri($"/tasks/{op.TaskId}"); var body = MakeBody(op.Task); return(body.Fold($"Update a Task. [PATCH: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <Unit> > AsShow <T>(this InfusioOp <T> .DeleteTask op) => () => { var uri = MakeUri($"/tasks/{op.TaskId}"); var body = MakeBody(); return(body.Fold($"Delete a Task. [DELETE: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <TaskList> > AsShow <T>(this InfusioOp <T> .ListTasksForCurrentUser op) => () => { var uri = MakeUri($"/tasks/search", RequestParameter("order", op.Order), RequestParameter("offset", op.Offset), RequestParameter("limit", op.Limit), RequestParameter("completed", op.Completed), RequestParameter("until", op.Until), RequestParameter("since", op.Since), RequestParameter("userId", op.UserId), RequestParameter("hasDueDate", op.HasDueDate), RequestParameter("contactId", op.ContactId)); var body = MakeBody(); return(body.Fold($"Search Tasks. [GET: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <Unit> > AsShow <T>(this InfusioOp <T> .RemoveTagFromContactId op) => () => { var uri = MakeUri($"/tags/{op.TagId}/contacts/{op.ContactId}"); var body = MakeBody(); return(body.Fold($"Remove Tag from Contact. [DELETE: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <ProductSubscription> > AsShow <T>(this InfusioOp <T> .CreateProductSubscription op) => () => { var uri = MakeUri($"/products/{op.ProductId}/subscriptions"); var body = MakeBody(op.CreateProductSubscriptionModel); return(body.Fold($"Create a Product Subscription. [POST: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <ProductStatusList> > AsShow <T>(this InfusioOp <T> .ListProductsFromSyncToken op) => () => { var uri = MakeUri($"/products/sync", RequestParameter("offset", op.Offset), RequestParameter("limit", op.Limit), RequestParameter("syncToken", op.SyncToken)); var body = MakeBody(); return(body.Fold($"Retrieve Synced Products. [GET: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <Product> > AsShow <T>(this InfusioOp <T> .CreateProduct op) => () => { var uri = MakeUri($"/products"); var body = MakeBody(op.CreateProductModel); return(body.Fold($"Create a Product. [POST: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <ProductList> > AsShow <T>(this InfusioOp <T> .ListProducts op) => () => { var uri = MakeUri($"/products", RequestParameter("active", op.Active), RequestParameter("offset", op.Offset), RequestParameter("limit", op.Limit)); var body = MakeBody(); return(body.Fold($"List Products. [GET: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <Order> > AsShow <T>(this InfusioOp <T> .GetOrder op) => () => { var uri = MakeUri($"/orders/{op.OrderId}"); var body = MakeBody(); return(body.Fold($"Retrieve an Order. [GET: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <OrderList> > AsShow <T>(this InfusioOp <T> .ListOrders op) => () => { var uri = MakeUri($"/orders", RequestParameter("productId", op.ProductId), RequestParameter("contactId", op.ContactId), RequestParameter("order", op.Order), RequestParameter("paid", op.Paid), RequestParameter("offset", op.Offset), RequestParameter("limit", op.Limit), RequestParameter("until", op.Until), RequestParameter("since", op.Since)); var body = MakeBody(); return(body.Fold($"List Orders. [GET: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <Unit> > AsShow <T>(this InfusioOp <T> .ListOpportunityStagePipelines op) => () => { var uri = MakeUri($"/opportunity/stage_pipeline"); var body = MakeBody(); return(body.Fold($"List Opportunity Stage Pipeline. [GET: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <Appointment> > AsShow <T>(this InfusioOp <T> .CreateAppointment op) => () => { var uri = MakeUri($"/appointments"); var body = MakeBody(op.Appointment); return(body.Fold($"Create an Appointment. [POST: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <Unit> > AsShow <T>(this InfusioOp <T> .ApplyTagToContactIds op) => () => { var uri = MakeUri($"/tags/{op.TagId}/contacts"); var body = MakeBody(op.Ids); return(body.Fold($"Apply Tag to Contacts. [POST: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <ProductSubscription> > AsShow <T>(this InfusioOp <T> .RetrieveProductSubscription op) => () => { var uri = MakeUri($"/products/{op.ProductId}/subscriptions/{op.SubscriptionId}"); var body = MakeBody(); return(body.Fold($"Retrieve a Product Subscription. [GET: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <InfusionTask> > AsShow <T>(this InfusioOp <T> .CreateTask op) => () => { var uri = MakeUri($"/tasks"); var body = MakeBody(op.Task); return(body.Fold($"Create a Task. [POST: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <Unit> > AsShow <T>(this InfusioOp <T> .DeleteProductSubscription op) => () => { var uri = MakeUri($"/products/{op.ProductId}/subscriptions/{op.SubscriptionId}"); var body = MakeBody(); return(body.Fold($"Delete a Product Subscription. [DELETE: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <InfusionTask> > AsShow <T>(this InfusioOp <T> .GetTask op) => () => { var uri = MakeUri($"/tasks/{op.TaskId}"); var body = MakeBody(); return(body.Fold($"Retrieve a Task. [GET: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <Setting> > AsShow <T>(this InfusioOp <T> .GetApplicationEnabled op) => () => { var uri = MakeUri($"/setting/application/enabled"); var body = MakeBody(); return(body.Fold($"Retrieve application status. [GET: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <ObjectModel> > AsShow <T>(this InfusioOp <T> .RetrieveAppointmentModel op) => () => { var uri = MakeUri($"/appointments/model"); var body = MakeBody(); return(body.Fold($"Retrieve Appointment Model. [GET: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <Setting> > AsShow <T>(this InfusioOp <T> .GetContactOptionTypes op) => () => { var uri = MakeUri($"/setting/contact/optionTypes"); var body = MakeBody(); return(body.Fold($"List Contact types. [GET: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <TransactionList> > AsShow <T>(this InfusioOp <T> .ListTransactions op) => () => { var uri = MakeUri($"/transactions", RequestParameter("contactId", op.ContactId), RequestParameter("offset", op.Offset), RequestParameter("limit", op.Limit), RequestParameter("until", op.Until), RequestParameter("since", op.Since)); var body = MakeBody(); return(body.Fold($"List Transactions. [GET: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <Tags> > AsShow <T>(this InfusioOp <T> .ListTags op) => () => { var uri = MakeUri($"/tags", RequestParameter("category", op.Category), RequestParameter("offset", op.Offset), RequestParameter("limit", op.Limit)); var body = MakeBody(); return(body.Fold($"List Tags. [GET: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <Appointment> > AsShow <T>(this InfusioOp <T> .GetAppointment op) => () => { var uri = MakeUri($"/appointments/{op.AppointmentId}"); var body = MakeBody(); return(body.Fold($"Retrieve an Appointment. [GET: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <TagCategory> > AsShow <T>(this InfusioOp <T> .CreateTagCategory op) => () => { var uri = MakeUri($"/tags/categories"); var body = MakeBody(op.TagCategory); return(body.Fold($"Create Tag Category. [POST: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <Appointment> > AsShow <T>(this InfusioOp <T> .UpdatePropertiesOnAppointment op) => () => { var uri = MakeUri($"/appointments/{op.AppointmentId}"); var body = MakeBody(op.AppointmentDTO); return(body.Fold($"Update an Appointment. [PATCH: {uri}]", (msg, bd) => $"{msg}: {bd}")); };
public static Show <InfusioOp <TaggedContactList> > AsShow <T>(this InfusioOp <T> .ListContactsForTagId op) => () => { var uri = MakeUri($"/tags/{op.TagId}/contacts", RequestParameter("offset", op.Offset), RequestParameter("limit", op.Limit)); var body = MakeBody(); return(body.Fold($"List Tagged Contacts. [GET: {uri}]", (msg, bd) => $"{msg}: {bd}")); };