Code Monkey home page Code Monkey logo

Comments (4)

danesparza avatar danesparza commented on September 23, 2024

I'm thinking the current way Merge variables are implemented needs to change. Take a look at this previous conversation and tell me what you think: #5

It sounds like maybe they should be converted to have either a dictionary of name/value pairs or some other type of 'generic object' that can get passed in -- is that correct?

from mailchimp.net.

ramoo avatar ramoo commented on September 23, 2024

Hi, sorry for delayed reply. I have changed code this way, but i am not sure whether it is good idea or bad idea. Basically i have added generic methods, where you set type of merge variables container you wannt to use:

in mailchimp manager class from:
public MemberInfoResult GetMemberInfo
to:
public MemberInfoResult<MergeVarsType> GetMemberInfo<MergeVarsType>

in MemberInfoResult class from:
public class MemberInfoResult
to:
public class MemberInfoResult<MergeVarsType>

and property in that class:

[DataMember(Name = "data")]
public List<MemberInfo<MergeVarsType>> Data
{
get;
set;
}

class MemberInfo from:
public class MemberInfo
to:
public class MemberInfo<MergeVarsType>

and property in that class:

[DataMember(Name = "merges")]
public MergeVarsType MemberMergeInfo { get; set; }

there are more places, where are these changes needed, because memberinfo is used in other methods.

Then in my application I create my custom class which extends one provided by your api:

public class ListMergeVars : MergeVar
{
public string SIGNUP { get; set; }
}

which adds my additional merge variable.

and api call in my application code looks like this: var info = _api.GetMemberInfo<ListMergeVars>(

from mailchimp.net.

skironDotNet avatar skironDotNet commented on September 23, 2024

And how about getting List merge_vars

I took a look at raw JSON response from https://us3.api.mailchimp.com/2.0/lists/merge-vars.json
I would create an object that would hold all of this

class MergeVar
{
Default
FieldType
...and so on
}

Then just to return List

even whole response could be presented as

class MergeVarResponse
{
public Data {get; set;}
}

class Data
{
public string Id
public List
}

The thing is I'm always "rebuilding" object structure using NewtonJSON so not sure how it will work for you with ServiceStack...

Generally would be nice to be able to retrieve a list of merge_vars for given list in whatever form.

If I would like to code my own solution but contribute here, should I create my own fork ?

from mailchimp.net.

danesparza avatar danesparza commented on September 23, 2024

You should fork the repo, yes.

from mailchimp.net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.