@@ -0,0 +1,3359 @@
+package org.ccci.gto.android.common.api;%0A%0Aimport android.content.Context;%0Aimport android.content.SharedPreferences;%0Aimport android.net.Uri;%0Aimport android.support.annotation.NonNull;%0Aimport android.support.annotation.Nullable;%0A%0Aimport java.util.Locale;%0A%0Aimport me.thekey.android.TheKey;%0A%0Apublic abstract class AbstractTheKeyApi%3CR extends AbstractTheKeyApi.Request%3CS%3E, S extends AbstractTheKeyApi.Session%3E%0A        extends AbstractApi%3CR, S%3E %7B%0A    protected final TheKey mTheKey;%0A    protected final String mGuid;%0A%0A    protected AbstractTheKeyApi(@NonNull final Context context, @NonNull final TheKey theKey,%0A                                @NonNull final String baseUri, @Nullable final String prefFile) %7B%0A        this(context, theKey, baseUri, prefFile, null);%0A    %7D%0A%0A    protected AbstractTheKeyApi(@NonNull final Context context, @NonNull final TheKey theKey,%0A                                @NonNull final String baseUri, @Nullable final String prefFile,%0A                                @Nullable final String guid) %7B%0A        super(context, baseUri, prefFile);%0A        mTheKey = theKey;%0A        mGuid = guid;%0A    %7D%0A%0A    protected AbstractTheKeyApi(@NonNull final Context context, @NonNull final TheKey theKey,%0A                                @NonNull final Uri baseUri) %7B%0A        this(context, theKey, baseUri, null, null);%0A    %7D%0A%0A    protected AbstractTheKeyApi(@NonNull final Context context, @NonNull final TheKey theKey,%0A                                @NonNull final Uri baseUri, @Nullable final String prefFile,%0A                                @Nullable final String guid) %7B%0A        super(context, baseUri, prefFile);%0A        mTheKey = theKey;%0A        mGuid = guid;%0A    %7D%0A%0A    @Nullable%0A    protected String getActiveGuid() %7B%0A        String guid = mGuid;%0A        if (guid == null) %7B%0A            guid = mTheKey.getGuid();%0A        %7D%0A%0A        return guid;%0A    %7D%0A%0A    @Override%0A    protected void onPrepareSession(@NonNull final R request) throws ApiException %7B%0A        super.onPrepareSession(request);%0A        request.guid = this.getActiveGuid();%0A    %7D%0A%0A    @Override%0A    protected void onCleanupRequest(@NonNull R request) %7B%0A        super.onCleanupRequest(request);%0A        request.guid = null;%0A    %7D%0A%0A    protected static class Session extends AbstractApi.Session %7B%0A        @Nullable%0A        private final String guid;%0A%0A        protected Session(@NonNull final SharedPreferences prefs, @NonNull final String baseAttrName,%0A                          @NonNull final String guid) %7B%0A            super(prefs, guid.toUpperCase(Locale.US) + %22.%22 + baseAttrName);%0A            this.guid = guid;%0A        %7D%0A%0A        @Override%0A        public boolean equals(final Object o) %7B%0A            if (this == o) %7B%0A                return true;%0A            %7D%0A            if (o == null %7C%7C getClass() != o.getClass()) %7B%0A                return false;%0A            %7D%0A%0A            final Session that = (Session) o;%0A            return super.equals(o) && !(guid != null ? !guid.equals(that.guid) : that.guid != null);%0A        %7D%0A    %7D%0A%0A    protected static class Request%3CS extends Session%3E extends AbstractApi.Request%3CS%3E %7B%0A        // session attributes%0A        public String guid = null;%0A%0A        public Request(@NonNull final String path) %7B%0A            super(path);%0A            // use sessions by default for The Key protected APIs%0A            this.useSession = true;%0A        %7D%0A    %7D%0A%7D%0A

create initial abstract The Key api