private static void ContactKeywordSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <ContactKeyword>() .UriFormat("account/{accountId}/contact/{contactId}/keyword/{keywordId}") ; modelBuilder.Entity <ContactKeyword>() .Property(c => c.KeywordId) .OptionalUrlSegment() .PrimaryKey() .MapTo("keywordId") ; modelBuilder.Entity <ContactKeyword>() .Property(c => c.ContactId) .OptionalUrlSegment() .MapTo("contactId") ; modelBuilder.Entity <ContactKeyword>() .Property(c => c.AccountId) .UrlSegment() .MapTo("accountId") ; }
private static void CampaignQuestionAnswerDefinitionSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <CampaignQuestionAnswerDefinition>() .UriFormat("/account/{accountId}/campaign/{campaignId}/question/answer/{answerId}") ; modelBuilder.Entity <CampaignQuestionAnswerDefinition>() .Property(c => c.CampaignId) .OptionalUrlSegment() .PrimaryKey() .MapTo("campaignId") ; modelBuilder.Entity <CampaignQuestionAnswerDefinition>() .Property(c => c.AnswerId) .OptionalUrlSegment() .MapTo("answerId") ; modelBuilder.Entity <CampaignQuestionAnswerDefinition>() .Property(c => c.AccountId) .UrlSegment() .MapTo("accountId") ; }
private static void ContactAttributeSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <ContactAttribute>() .UriFormat("/account/{accountId}/contact/{contactId}/attribute/{name}") ; modelBuilder.Entity <ContactAttribute>() .Property(c => c.Name) .OptionalUrlSegment() .PrimaryKey() .MapTo("name") ; modelBuilder.Entity <ContactAttribute>() .Property(c => c.ContactId) .OptionalUrlSegment() .MapTo("contactId") ; modelBuilder.Entity <ContactAttribute>() .Property(c => c.AccountId) .UrlSegment() .MapTo("accountId") ; }
private static void KeywordSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <Keyword>() .UriFormat("/account/{accountId}/channel/{channelId}/keyword/{keywordId}") ; modelBuilder.Entity <Keyword>() .Property(k => k.Id) .OptionalUrlSegment() .PrimaryKey() .MapTo("keywordId") ; modelBuilder.Entity <Keyword>() .Property(k => k.ChannelId) .UrlSegment() .MapTo("channelId") ; modelBuilder.Entity <Keyword>() .Property(k => k.AccountId) .UrlSegment() .MapTo("accountId") ; }
private static void ActionExecuteSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <ActionExecute>() .UriFormat("/account/{accountId}/action/{actionId}/execute/{executeId}") ; modelBuilder.Entity <ActionExecute>() .Property(e => e.ActionId) .UrlSegment() .MapTo("actionId") ; modelBuilder.Entity <ActionExecute>() .Property(e => e.Id) .OptionalUrlSegment() .PrimaryKey() .MapTo("executeId") ; modelBuilder.Entity <ActionExecute>() .Property(e => e.AccountId) .UrlSegment() .MapTo("accountId") ; }
private static void ContactSubscriptionSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <ContactSubscription>() .UriFormat("/account/{accountId}/contact/{contactId}/subscription/{subscriptionId}") ; modelBuilder.Entity <ContactSubscription>() .Property(c => c.ContactId) .OptionalUrlSegment() .MapTo("contactId") ; modelBuilder.Entity <ContactSubscription>() .Property(c => c.SubscriptionId) .OptionalUrlSegment() .PrimaryKey() .MapTo("subscriptionId") ; modelBuilder.Entity <ContactSubscription>() .Property(c => c.AccountId) .UrlSegment() .MapTo("accountId") ; }
private static void ContactAttributeCategorySetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <ContactAttributeCategory>() .UriFormat("/reference/contact-attribute-category/{categoryId}") ; modelBuilder.Entity <ContactAttributeCategory>() .Property(c => c.Id) .OptionalUrlSegment() .PrimaryKey() .MapTo("categoryId") ; }
private static void AccountSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <Account>() .UriFormat("/account/{accountId}") ; modelBuilder.Entity <Account>() .Property(a => a.Id) .OptionalUrlSegment() .PrimaryKey() .MapTo("accountId") ; }
private void CreateModels() { if (m_modelBuilder != null) { return; } m_modelBuilder = new RestModelBuilder(); OnModelCreating(m_modelBuilder); // Make sure the registered models are valid. m_modelBuilder.CheckEntries(); }
private static void UserChatTokenSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <UserChatToken>() .UriFormat("/chattoken/{accountId}") ; modelBuilder.Entity <UserChatToken>() .Property(a => a.AccountId) .OptionalUrlSegment() .PrimaryKey() .MapTo("accountId") ; }
private static void CallHistorySetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <CallHistory>() .UriFormat("/account/{accountId}/chat/history") ; modelBuilder.Entity <CallHistory>() .Property(c => c.AccountId) .UrlSegment() .PrimaryKey() .MapTo("accountId") ; }
private static void CallForwardVerificationSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <CallForwardVerification>() .UriFormat("/account/{accountId}/long-code/{longCode}/callforwardingverification") ; modelBuilder.Entity <CallForwardVerification>() .Property(c => c.Code) .OptionalUrlSegment() .PrimaryKey() .MapTo("longCode") ; modelBuilder.Entity <CallForwardVerification>() .Property(c => c.AccountId) .UrlSegment() .MapTo("accountId") ; }
private static void ExternalCouponListSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <ExternalCouponList>() .UriFormat("/account/{accountId}/external-couponlist/{externalCouponListId}") ; modelBuilder.Entity <ExternalCouponList>() .Property(c => c.Id) .OptionalUrlSegment() .PrimaryKey() .MapTo("externalCouponListId") ; modelBuilder.Entity <ExternalCouponList>() .Property(c => c.AccountId) .UrlSegment() .MapTo("accountId") ; }
private static void SearchTnSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <SearchTn>() .UriFormat("/account/{accountId}/search-for-tn/{searchId}") ; modelBuilder.Entity <SearchTn>() .Property(c => c.Id) .OptionalUrlSegment() .PrimaryKey() .MapTo("searchId") ; modelBuilder.Entity <SearchTn>() .Property(c => c.AccountId) .UrlSegment() .MapTo("accountId") ; }
private static void ActionKeywordSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <ActionAttachKeyword>() .UriFormat("/account/{accountId}/action-attachKeyword/{actionId}") ; modelBuilder.Entity <ActionAttachKeyword>() .Property(e => e.Id) .OptionalUrlSegment() .PrimaryKey() .MapTo("actionId") ; modelBuilder.Entity <ActionAttachKeyword>() .Property(e => e.AccountId) .UrlSegment() .MapTo("accountId") ; }
private static void RequestTnSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <RequestTn>() .UriFormat("/account/{accountId}/request-tn/{requestId}") ; modelBuilder.Entity <RequestTn>() .Property(c => c.Id) .OptionalUrlSegment() .PrimaryKey() .MapTo("requestId") ; modelBuilder.Entity <RequestTn>() .Property(c => c.AccountId) .UrlSegment() .MapTo("accountId") ; }
private static void ChannelSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <Channel>() .UriFormat("/account/{accountId}/channel/{channel}") ; modelBuilder.Entity <Channel>() .Property(c => c.Id) .OptionalUrlSegment() .PrimaryKey() .MapTo("channel") ; modelBuilder.Entity <Channel>() .Property(c => c.AccountId) .UrlSegment() .MapTo("accountId") ; }
private static void UserPasswordSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <UserPassword>() .UriFormat("/account/{accountId}/user/{userName}/password") ; modelBuilder.Entity <UserPassword>() .Property(c => c.AccountId) .UrlSegment() .MapTo("accountId") ; modelBuilder.Entity <UserPassword>() .Property(c => c.UserName) .OptionalUrlSegment() .PrimaryKey() .MapTo("username") ; }
private static void CampaignDialogSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <CampaignDialog>() .UriFormat("/account/{accountId}/campaign/{campaignId}/dialog") ; modelBuilder.Entity <CampaignDialog>() .Property(c => c.CampaignId) .OptionalUrlSegment() .PrimaryKey() .MapTo("campaignId") ; modelBuilder.Entity <CampaignDialog>() .Property(c => c.AccountId) .UrlSegment() .MapTo("accountId") ; }
private static void ContactAttributeDefinitionSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <ContactAttributeDefinition>() .UriFormat("/account/{accountId}/contact-attributeDef/{attribDefId}") ; modelBuilder.Entity <ContactAttributeDefinition>() .Property(c => c.Id) .OptionalUrlSegment() .PrimaryKey() .MapTo("attribDefId") ; modelBuilder.Entity <ContactAttributeDefinition>() .Property(c => c.AccountId) .UrlSegment() .MapTo("accountId") ; }
private static void ActionSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <ThreeSeventy.Vector.Client.Models.Action>() .UriFormat("/account/{accountId}/action/{actionId}") ; modelBuilder.Entity <ThreeSeventy.Vector.Client.Models.Action>() .Property(e => e.Id) .OptionalUrlSegment() .PrimaryKey() .MapTo("actionId") ; modelBuilder.Entity <ThreeSeventy.Vector.Client.Models.Action>() .Property(e => e.AccountId) .UrlSegment() .MapTo("accountId") ; }
private static void EventSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <EventPushCampaign>() .UriFormat("/account/{accountId}/event-pushcampaign/{eventId}") ; modelBuilder.Entity <EventPushCampaign>() .Property(e => e.Id) .OptionalUrlSegment() .PrimaryKey() .MapTo("eventId") ; modelBuilder.Entity <EventPushCampaign>() .Property(e => e.AccountId) .UrlSegment() .MapTo("accountId") ; }
private static void CallbackSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <Callback>() .UriFormat("/account/{accountId}/callback/{callbackId}") ; modelBuilder.Entity <Callback>() .Property(c => c.Id) .OptionalUrlSegment() .PrimaryKey() .MapTo("callbackId") ; modelBuilder.Entity <Callback>() .Property(c => c.AccountId) .UrlSegment() .MapTo("accountId") ; }
private static void ApiKeySetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <ApiKey>() .UriFormat("/account/{accountId}/api-key/{keyId}") ; modelBuilder.Entity <ApiKey>() .Property(c => c.Id) .OptionalUrlSegment() .PrimaryKey() .MapTo("keyId") ; modelBuilder.Entity <ApiKey>() .Property(c => c.AccountId) .UrlSegment() .MapTo("accountId") ; }
private static void SubscriptionSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <Subscription>() .UriFormat("/account/{accountId}/subscription/{subscriptionId}") ; modelBuilder.Entity <Subscription>() .Property(s => s.Id) .OptionalUrlSegment() .PrimaryKey() .MapTo("subscriptionId") ; modelBuilder.Entity <Subscription>() .Property(s => s.AccountId) .UrlSegment() .MapTo("accountId") ; }
private static void ContentSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <Content>() .UriFormat("/account/{accountId}/content/{contentId}") ; modelBuilder.Entity <Content>() .Property(a => a.Id) .OptionalUrlSegment() .PrimaryKey() .MapTo("contentId") ; modelBuilder.Entity <Content>() .Property(a => a.AccountId) .UrlSegment() .MapTo("accountId") ; modelBuilder.Entity <ContentTemplate>() .UriFormat("/account/{accountId}/content/{contentId}/template/{templateId}") ; modelBuilder.Entity <ContentTemplate>() .Property(a => a.Id) .OptionalUrlSegment() .PrimaryKey() .MapTo("templateId") ; modelBuilder.Entity <ContentTemplate>() .Property(a => a.ContentId) .UrlSegment() .MapTo("contentId") ; modelBuilder.Entity <ContentTemplate>() .Property(a => a.AccountId) .UrlSegment() .MapTo("accountId") ; }
private static void ChatMessageLogSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <ChatMessageLog>() .UriFormat("/account/{accountId}/chat/conversation/{conversationId}") ; modelBuilder.Entity <ChatMessageLog>() .Property(c => c.ConversationId) .OptionalUrlSegment() .PrimaryKey() .MapTo("conversationId") ; modelBuilder.Entity <ChatMessageLog>() .Property(c => c.AccountId) .UrlSegment() .MapTo("accountId") ; }
/// <summary> /// Sets up the model for the 3Seventy REST clients. /// </summary> /// <param name="modelBuilder">The model building configuration object.</param> override protected void OnModelCreating(RestModelBuilder modelBuilder) { AccountSetup(modelBuilder); ContactSetup(modelBuilder); ContentSetup(modelBuilder); SubscriptionSetup(modelBuilder); CampaignSetup(modelBuilder); KeywordSetup(modelBuilder); EventSetup(modelBuilder); CallbackSetup(modelBuilder); m_log.Trace("Model setup"); }
private static void KeywordContactSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <KeywordContact>() .UriFormat("/account/{accountId}/keyword/{keywordId}/contact") ; modelBuilder.Entity <KeywordContact>() .Property(k => k.KeywordId) .OptionalUrlSegment() .PrimaryKey() .MapTo("keywordId") ; modelBuilder.Entity <KeywordContact>() .Property(k => k.AccountId) .UrlSegment() .MapTo("accountId") ; }
private static void ActionImportContactsSetup(RestModelBuilder modelBuilder) { modelBuilder.Entity <ActionImportContacts>() .UriFormat("/account/{accountId}/action-importContacts/{actionId}") ; modelBuilder.Entity <ActionImportContacts>() .Property(c => c.Id) .OptionalUrlSegment() .PrimaryKey() .MapTo("actionId") ; modelBuilder.Entity <ActionImportContacts>() .Property(c => c.AccountId) .UrlSegment() .MapTo("accountId") ; }