/**
 * #utilities.ts
 *
 * Code generated by ts-proto. DO NOT EDIT.
 * @packageDocumentation
 */
/* eslint-disable */
import Long from "long";
import _m0 from "protobufjs/minimal.js";
import { messageTypeRegistry } from "../../../../typeRegistry.js";
import { globalListTypeFromJSON, globalListTypeToJSON, } from "../../../dev_portal/fetch_domain_request/fetch_domain_request.js";
export var CurationType;
(function (CurationType) {
    CurationType[CurationType["CURATION_TYPE_UNSPECIFIED"] = 0] = "CURATION_TYPE_UNSPECIFIED";
    CurationType[CurationType["CURATION_TYPE_NEW"] = 1] = "CURATION_TYPE_NEW";
    CurationType[CurationType["CURATION_TYPE_POPULAR"] = 2] = "CURATION_TYPE_POPULAR";
    CurationType[CurationType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(CurationType || (CurationType = {}));
export function curationTypeFromJSON(object) {
    switch (object) {
        case 0:
        case "CURATION_TYPE_UNSPECIFIED":
            return CurationType.CURATION_TYPE_UNSPECIFIED;
        case 1:
        case "CURATION_TYPE_NEW":
            return CurationType.CURATION_TYPE_NEW;
        case 2:
        case "CURATION_TYPE_POPULAR":
            return CurationType.CURATION_TYPE_POPULAR;
        case -1:
        case "UNRECOGNIZED":
        default:
            return CurationType.UNRECOGNIZED;
    }
}
export function curationTypeToJSON(object) {
    switch (object) {
        case CurationType.CURATION_TYPE_UNSPECIFIED:
            return 0;
        case CurationType.CURATION_TYPE_NEW:
            return 1;
        case CurationType.CURATION_TYPE_POPULAR:
            return 2;
        case CurationType.UNRECOGNIZED:
        default:
            return -1;
    }
}
/** Purge all cache entries of the specified type */
export var PurgeAllRequest_CacheType;
(function (PurgeAllRequest_CacheType) {
    PurgeAllRequest_CacheType[PurgeAllRequest_CacheType["UNSPECIFIED"] = 0] = "UNSPECIFIED";
    /** INSTALLATION - devvit-ecosystem cache types */
    PurgeAllRequest_CacheType[PurgeAllRequest_CacheType["INSTALLATION"] = 1] = "INSTALLATION";
    PurgeAllRequest_CacheType[PurgeAllRequest_CacheType["SUBREDDIT_APP_INSTALLS"] = 2] = "SUBREDDIT_APP_INSTALLS";
    PurgeAllRequest_CacheType[PurgeAllRequest_CacheType["APP"] = 3] = "APP";
    PurgeAllRequest_CacheType[PurgeAllRequest_CacheType["APP_BY_ID"] = 4] = "APP_BY_ID";
    PurgeAllRequest_CacheType[PurgeAllRequest_CacheType["APP_PUBLISH_REQUEST"] = 5] = "APP_PUBLISH_REQUEST";
    PurgeAllRequest_CacheType[PurgeAllRequest_CacheType["APP_DOMAINS"] = 6] = "APP_DOMAINS";
    PurgeAllRequest_CacheType[PurgeAllRequest_CacheType["GLOBAL_DOMAINS"] = 7] = "GLOBAL_DOMAINS";
    /** POST - devvit-runtime cache types */
    PurgeAllRequest_CacheType[PurgeAllRequest_CacheType["POST"] = 8] = "POST";
    PurgeAllRequest_CacheType[PurgeAllRequest_CacheType["POST_RENDER"] = 9] = "POST_RENDER";
    PurgeAllRequest_CacheType[PurgeAllRequest_CacheType["POSTS_BY_INSTALLATION"] = 10] = "POSTS_BY_INSTALLATION";
    PurgeAllRequest_CacheType[PurgeAllRequest_CacheType["CONTEXT_ACTIONS"] = 11] = "CONTEXT_ACTIONS";
    PurgeAllRequest_CacheType[PurgeAllRequest_CacheType["APP_PERMISSIONS"] = 12] = "APP_PERMISSIONS";
    /** DRAWER - other cache types */
    PurgeAllRequest_CacheType[PurgeAllRequest_CacheType["DRAWER"] = 13] = "DRAWER";
    PurgeAllRequest_CacheType[PurgeAllRequest_CacheType["TOP_CUSTOM_POSTS"] = 14] = "TOP_CUSTOM_POSTS";
    PurgeAllRequest_CacheType[PurgeAllRequest_CacheType["APP_HEALTH"] = 15] = "APP_HEALTH";
    PurgeAllRequest_CacheType[PurgeAllRequest_CacheType["APP_WITH_CATEGORIES"] = 16] = "APP_WITH_CATEGORIES";
    PurgeAllRequest_CacheType[PurgeAllRequest_CacheType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(PurgeAllRequest_CacheType || (PurgeAllRequest_CacheType = {}));
export function purgeAllRequest_CacheTypeFromJSON(object) {
    switch (object) {
        case 0:
        case "UNSPECIFIED":
            return PurgeAllRequest_CacheType.UNSPECIFIED;
        case 1:
        case "INSTALLATION":
            return PurgeAllRequest_CacheType.INSTALLATION;
        case 2:
        case "SUBREDDIT_APP_INSTALLS":
            return PurgeAllRequest_CacheType.SUBREDDIT_APP_INSTALLS;
        case 3:
        case "APP":
            return PurgeAllRequest_CacheType.APP;
        case 4:
        case "APP_BY_ID":
            return PurgeAllRequest_CacheType.APP_BY_ID;
        case 5:
        case "APP_PUBLISH_REQUEST":
            return PurgeAllRequest_CacheType.APP_PUBLISH_REQUEST;
        case 6:
        case "APP_DOMAINS":
            return PurgeAllRequest_CacheType.APP_DOMAINS;
        case 7:
        case "GLOBAL_DOMAINS":
            return PurgeAllRequest_CacheType.GLOBAL_DOMAINS;
        case 8:
        case "POST":
            return PurgeAllRequest_CacheType.POST;
        case 9:
        case "POST_RENDER":
            return PurgeAllRequest_CacheType.POST_RENDER;
        case 10:
        case "POSTS_BY_INSTALLATION":
            return PurgeAllRequest_CacheType.POSTS_BY_INSTALLATION;
        case 11:
        case "CONTEXT_ACTIONS":
            return PurgeAllRequest_CacheType.CONTEXT_ACTIONS;
        case 12:
        case "APP_PERMISSIONS":
            return PurgeAllRequest_CacheType.APP_PERMISSIONS;
        case 13:
        case "DRAWER":
            return PurgeAllRequest_CacheType.DRAWER;
        case 14:
        case "TOP_CUSTOM_POSTS":
            return PurgeAllRequest_CacheType.TOP_CUSTOM_POSTS;
        case 15:
        case "APP_HEALTH":
            return PurgeAllRequest_CacheType.APP_HEALTH;
        case 16:
        case "APP_WITH_CATEGORIES":
            return PurgeAllRequest_CacheType.APP_WITH_CATEGORIES;
        case -1:
        case "UNRECOGNIZED":
        default:
            return PurgeAllRequest_CacheType.UNRECOGNIZED;
    }
}
export function purgeAllRequest_CacheTypeToJSON(object) {
    switch (object) {
        case PurgeAllRequest_CacheType.UNSPECIFIED:
            return 0;
        case PurgeAllRequest_CacheType.INSTALLATION:
            return 1;
        case PurgeAllRequest_CacheType.SUBREDDIT_APP_INSTALLS:
            return 2;
        case PurgeAllRequest_CacheType.APP:
            return 3;
        case PurgeAllRequest_CacheType.APP_BY_ID:
            return 4;
        case PurgeAllRequest_CacheType.APP_PUBLISH_REQUEST:
            return 5;
        case PurgeAllRequest_CacheType.APP_DOMAINS:
            return 6;
        case PurgeAllRequest_CacheType.GLOBAL_DOMAINS:
            return 7;
        case PurgeAllRequest_CacheType.POST:
            return 8;
        case PurgeAllRequest_CacheType.POST_RENDER:
            return 9;
        case PurgeAllRequest_CacheType.POSTS_BY_INSTALLATION:
            return 10;
        case PurgeAllRequest_CacheType.CONTEXT_ACTIONS:
            return 11;
        case PurgeAllRequest_CacheType.APP_PERMISSIONS:
            return 12;
        case PurgeAllRequest_CacheType.DRAWER:
            return 13;
        case PurgeAllRequest_CacheType.TOP_CUSTOM_POSTS:
            return 14;
        case PurgeAllRequest_CacheType.APP_HEALTH:
            return 15;
        case PurgeAllRequest_CacheType.APP_WITH_CATEGORIES:
            return 16;
        case PurgeAllRequest_CacheType.UNRECOGNIZED:
        default:
            return -1;
    }
}
function createBaseAccessKeyPurgeRequest() {
    return { userId: "", includeRefresh: false };
}
export const AccessKeyPurgeRequest = {
    $type: "devvit.gateway.utils.v1alpha.AccessKeyPurgeRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.userId !== "") {
            writer.uint32(10).string(message.userId);
        }
        if (message.includeRefresh !== false) {
            writer.uint32(16).bool(message.includeRefresh);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseAccessKeyPurgeRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.userId = reader.string();
                    continue;
                case 2:
                    if (tag !== 16) {
                        break;
                    }
                    message.includeRefresh = reader.bool();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            userId: isSet(object.userId) ? globalThis.String(object.userId) : "",
            includeRefresh: isSet(object.includeRefresh) ? globalThis.Boolean(object.includeRefresh) : false,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.userId !== "") {
            obj.userId = message.userId;
        }
        if (message.includeRefresh !== false) {
            obj.includeRefresh = message.includeRefresh;
        }
        return obj;
    },
    create(base) {
        return AccessKeyPurgeRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseAccessKeyPurgeRequest();
        message.userId = object.userId ?? "";
        message.includeRefresh = object.includeRefresh ?? false;
        return message;
    },
};
messageTypeRegistry.set(AccessKeyPurgeRequest.$type, AccessKeyPurgeRequest);
function createBaseInstallationsPurgeRequest() {
    return { subreddit: "" };
}
export const InstallationsPurgeRequest = {
    $type: "devvit.gateway.utils.v1alpha.InstallationsPurgeRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.subreddit !== "") {
            writer.uint32(10).string(message.subreddit);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseInstallationsPurgeRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.subreddit = reader.string();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { subreddit: isSet(object.subreddit) ? globalThis.String(object.subreddit) : "" };
    },
    toJSON(message) {
        const obj = {};
        if (message.subreddit !== "") {
            obj.subreddit = message.subreddit;
        }
        return obj;
    },
    create(base) {
        return InstallationsPurgeRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseInstallationsPurgeRequest();
        message.subreddit = object.subreddit ?? "";
        return message;
    },
};
messageTypeRegistry.set(InstallationsPurgeRequest.$type, InstallationsPurgeRequest);
function createBaseInstallationPurgeRequest() {
    return { installationId: "" };
}
export const InstallationPurgeRequest = {
    $type: "devvit.gateway.utils.v1alpha.InstallationPurgeRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.installationId !== "") {
            writer.uint32(10).string(message.installationId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseInstallationPurgeRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.installationId = reader.string();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { installationId: isSet(object.installationId) ? globalThis.String(object.installationId) : "" };
    },
    toJSON(message) {
        const obj = {};
        if (message.installationId !== "") {
            obj.installationId = message.installationId;
        }
        return obj;
    },
    create(base) {
        return InstallationPurgeRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseInstallationPurgeRequest();
        message.installationId = object.installationId ?? "";
        return message;
    },
};
messageTypeRegistry.set(InstallationPurgeRequest.$type, InstallationPurgeRequest);
function createBaseAppVersionPurgeRequest() {
    return { appVersionId: "" };
}
export const AppVersionPurgeRequest = {
    $type: "devvit.gateway.utils.v1alpha.AppVersionPurgeRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.appVersionId !== "") {
            writer.uint32(10).string(message.appVersionId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseAppVersionPurgeRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.appVersionId = reader.string();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { appVersionId: isSet(object.appVersionId) ? globalThis.String(object.appVersionId) : "" };
    },
    toJSON(message) {
        const obj = {};
        if (message.appVersionId !== "") {
            obj.appVersionId = message.appVersionId;
        }
        return obj;
    },
    create(base) {
        return AppVersionPurgeRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseAppVersionPurgeRequest();
        message.appVersionId = object.appVersionId ?? "";
        return message;
    },
};
messageTypeRegistry.set(AppVersionPurgeRequest.$type, AppVersionPurgeRequest);
function createBaseAppPurgeRequest() {
    return { appId: "", appSlug: "" };
}
export const AppPurgeRequest = {
    $type: "devvit.gateway.utils.v1alpha.AppPurgeRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.appId !== "") {
            writer.uint32(10).string(message.appId);
        }
        if (message.appSlug !== "") {
            writer.uint32(18).string(message.appSlug);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseAppPurgeRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.appId = reader.string();
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.appSlug = reader.string();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            appId: isSet(object.appId) ? globalThis.String(object.appId) : "",
            appSlug: isSet(object.appSlug) ? globalThis.String(object.appSlug) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.appId !== "") {
            obj.appId = message.appId;
        }
        if (message.appSlug !== "") {
            obj.appSlug = message.appSlug;
        }
        return obj;
    },
    create(base) {
        return AppPurgeRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseAppPurgeRequest();
        message.appId = object.appId ?? "";
        message.appSlug = object.appSlug ?? "";
        return message;
    },
};
messageTypeRegistry.set(AppPurgeRequest.$type, AppPurgeRequest);
function createBaseAppVersionPublishStatusPurgeRequest() {
    return { appVersionId: "" };
}
export const AppVersionPublishStatusPurgeRequest = {
    $type: "devvit.gateway.utils.v1alpha.AppVersionPublishStatusPurgeRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.appVersionId !== "") {
            writer.uint32(10).string(message.appVersionId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseAppVersionPublishStatusPurgeRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.appVersionId = reader.string();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { appVersionId: isSet(object.appVersionId) ? globalThis.String(object.appVersionId) : "" };
    },
    toJSON(message) {
        const obj = {};
        if (message.appVersionId !== "") {
            obj.appVersionId = message.appVersionId;
        }
        return obj;
    },
    create(base) {
        return AppVersionPublishStatusPurgeRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseAppVersionPublishStatusPurgeRequest();
        message.appVersionId = object.appVersionId ?? "";
        return message;
    },
};
messageTypeRegistry.set(AppVersionPublishStatusPurgeRequest.$type, AppVersionPublishStatusPurgeRequest);
function createBaseCuratedGamesPurgeRequest() {
    return { curationType: 0 };
}
export const CuratedGamesPurgeRequest = {
    $type: "devvit.gateway.utils.v1alpha.CuratedGamesPurgeRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.curationType !== 0) {
            writer.uint32(8).int32(message.curationType);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseCuratedGamesPurgeRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 8) {
                        break;
                    }
                    message.curationType = reader.int32();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { curationType: isSet(object.curationType) ? curationTypeFromJSON(object.curationType) : 0 };
    },
    toJSON(message) {
        const obj = {};
        if (message.curationType !== 0) {
            obj.curationType = curationTypeToJSON(message.curationType);
        }
        return obj;
    },
    create(base) {
        return CuratedGamesPurgeRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseCuratedGamesPurgeRequest();
        message.curationType = object.curationType ?? 0;
        return message;
    },
};
messageTypeRegistry.set(CuratedGamesPurgeRequest.$type, CuratedGamesPurgeRequest);
function createBasePurgeAllRequest() {
    return { cacheType: 0 };
}
export const PurgeAllRequest = {
    $type: "devvit.gateway.utils.v1alpha.PurgeAllRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.cacheType !== 0) {
            writer.uint32(8).int32(message.cacheType);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBasePurgeAllRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 8) {
                        break;
                    }
                    message.cacheType = reader.int32();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { cacheType: isSet(object.cacheType) ? purgeAllRequest_CacheTypeFromJSON(object.cacheType) : 0 };
    },
    toJSON(message) {
        const obj = {};
        if (message.cacheType !== 0) {
            obj.cacheType = purgeAllRequest_CacheTypeToJSON(message.cacheType);
        }
        return obj;
    },
    create(base) {
        return PurgeAllRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBasePurgeAllRequest();
        message.cacheType = object.cacheType ?? 0;
        return message;
    },
};
messageTypeRegistry.set(PurgeAllRequest.$type, PurgeAllRequest);
function createBasePurgeResult() {
    return { count: 0 };
}
export const PurgeResult = {
    $type: "devvit.gateway.utils.v1alpha.PurgeResult",
    encode(message, writer = _m0.Writer.create()) {
        if (message.count !== 0) {
            writer.uint32(8).int64(message.count);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBasePurgeResult();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 8) {
                        break;
                    }
                    message.count = longToNumber(reader.int64());
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { count: isSet(object.count) ? globalThis.Number(object.count) : 0 };
    },
    toJSON(message) {
        const obj = {};
        if (message.count !== 0) {
            obj.count = Math.round(message.count);
        }
        return obj;
    },
    create(base) {
        return PurgeResult.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBasePurgeResult();
        message.count = object.count ?? 0;
        return message;
    },
};
messageTypeRegistry.set(PurgeResult.$type, PurgeResult);
function createBaseCacheContextActionsRequest() {
    return { installationId: "" };
}
export const CacheContextActionsRequest = {
    $type: "devvit.gateway.utils.v1alpha.CacheContextActionsRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.installationId !== "") {
            writer.uint32(10).string(message.installationId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseCacheContextActionsRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.installationId = reader.string();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { installationId: isSet(object.installationId) ? globalThis.String(object.installationId) : "" };
    },
    toJSON(message) {
        const obj = {};
        if (message.installationId !== "") {
            obj.installationId = message.installationId;
        }
        return obj;
    },
    create(base) {
        return CacheContextActionsRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseCacheContextActionsRequest();
        message.installationId = object.installationId ?? "";
        return message;
    },
};
messageTypeRegistry.set(CacheContextActionsRequest.$type, CacheContextActionsRequest);
function createBaseRefreshGlobalDomainsRequest() {
    return { globalListType: 0 };
}
export const RefreshGlobalDomainsRequest = {
    $type: "devvit.gateway.utils.v1alpha.RefreshGlobalDomainsRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.globalListType !== 0) {
            writer.uint32(8).int32(message.globalListType);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseRefreshGlobalDomainsRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 8) {
                        break;
                    }
                    message.globalListType = reader.int32();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { globalListType: isSet(object.globalListType) ? globalListTypeFromJSON(object.globalListType) : 0 };
    },
    toJSON(message) {
        const obj = {};
        if (message.globalListType !== 0) {
            obj.globalListType = globalListTypeToJSON(message.globalListType);
        }
        return obj;
    },
    create(base) {
        return RefreshGlobalDomainsRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseRefreshGlobalDomainsRequest();
        message.globalListType = object.globalListType ?? 0;
        return message;
    },
};
messageTypeRegistry.set(RefreshGlobalDomainsRequest.$type, RefreshGlobalDomainsRequest);
function createBaseAcceptInviteRequest() {
    return { subredditName: "", appAccountId: "" };
}
export const AcceptInviteRequest = {
    $type: "devvit.gateway.utils.v1alpha.AcceptInviteRequest",
    encode(message, writer = _m0.Writer.create()) {
        if (message.subredditName !== "") {
            writer.uint32(10).string(message.subredditName);
        }
        if (message.appAccountId !== "") {
            writer.uint32(18).string(message.appAccountId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseAcceptInviteRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    if (tag !== 10) {
                        break;
                    }
                    message.subredditName = reader.string();
                    continue;
                case 2:
                    if (tag !== 18) {
                        break;
                    }
                    message.appAccountId = reader.string();
                    continue;
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            subredditName: isSet(object.subredditName) ? globalThis.String(object.subredditName) : "",
            appAccountId: isSet(object.appAccountId) ? globalThis.String(object.appAccountId) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.subredditName !== "") {
            obj.subredditName = message.subredditName;
        }
        if (message.appAccountId !== "") {
            obj.appAccountId = message.appAccountId;
        }
        return obj;
    },
    create(base) {
        return AcceptInviteRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseAcceptInviteRequest();
        message.subredditName = object.subredditName ?? "";
        message.appAccountId = object.appAccountId ?? "";
        return message;
    },
};
messageTypeRegistry.set(AcceptInviteRequest.$type, AcceptInviteRequest);
function createBaseAcceptInviteResponse() {
    return {};
}
export const AcceptInviteResponse = {
    $type: "devvit.gateway.utils.v1alpha.AcceptInviteResponse",
    encode(_, writer = _m0.Writer.create()) {
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseAcceptInviteResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skipType(tag & 7);
        }
        return message;
    },
    fromJSON(_) {
        return {};
    },
    toJSON(_) {
        const obj = {};
        return obj;
    },
    create(base) {
        return AcceptInviteResponse.fromPartial(base ?? {});
    },
    fromPartial(_) {
        const message = createBaseAcceptInviteResponse();
        return message;
    },
};
messageTypeRegistry.set(AcceptInviteResponse.$type, AcceptInviteResponse);
export const CacheUtilsServiceName = "devvit.gateway.utils.v1alpha.CacheUtils";
export class CacheUtilsClientImpl {
    constructor(rpc, opts) {
        this.service = opts?.service || CacheUtilsServiceName;
        this.rpc = rpc;
        this.CacheContextActionsInRuntimeDb = this.CacheContextActionsInRuntimeDb.bind(this);
        this.PurgeAccessKey = this.PurgeAccessKey.bind(this);
        this.PurgeInstallations = this.PurgeInstallations.bind(this);
        this.PurgeInstallation = this.PurgeInstallation.bind(this);
        this.PurgeAppVersion = this.PurgeAppVersion.bind(this);
        this.PurgeApp = this.PurgeApp.bind(this);
        this.PurgeAppVersionPublishStatus = this.PurgeAppVersionPublishStatus.bind(this);
        this.PurgeCuratedGames = this.PurgeCuratedGames.bind(this);
        this.PurgeAll = this.PurgeAll.bind(this);
        this.RefreshGlobalDomains = this.RefreshGlobalDomains.bind(this);
    }
    CacheContextActionsInRuntimeDb(request, metadata) {
        const data = CacheContextActionsRequest.encode(request).finish();
        const promise = this.rpc.request(this.service, "CacheContextActionsInRuntimeDb", data, metadata);
        return promise.then((data) => PurgeResult.decode(_m0.Reader.create(data)));
    }
    PurgeAccessKey(request, metadata) {
        const data = AccessKeyPurgeRequest.encode(request).finish();
        const promise = this.rpc.request(this.service, "PurgeAccessKey", data, metadata);
        return promise.then((data) => PurgeResult.decode(_m0.Reader.create(data)));
    }
    PurgeInstallations(request, metadata) {
        const data = InstallationsPurgeRequest.encode(request).finish();
        const promise = this.rpc.request(this.service, "PurgeInstallations", data, metadata);
        return promise.then((data) => PurgeResult.decode(_m0.Reader.create(data)));
    }
    PurgeInstallation(request, metadata) {
        const data = InstallationPurgeRequest.encode(request).finish();
        const promise = this.rpc.request(this.service, "PurgeInstallation", data, metadata);
        return promise.then((data) => PurgeResult.decode(_m0.Reader.create(data)));
    }
    PurgeAppVersion(request, metadata) {
        const data = AppVersionPurgeRequest.encode(request).finish();
        const promise = this.rpc.request(this.service, "PurgeAppVersion", data, metadata);
        return promise.then((data) => PurgeResult.decode(_m0.Reader.create(data)));
    }
    PurgeApp(request, metadata) {
        const data = AppPurgeRequest.encode(request).finish();
        const promise = this.rpc.request(this.service, "PurgeApp", data, metadata);
        return promise.then((data) => PurgeResult.decode(_m0.Reader.create(data)));
    }
    PurgeAppVersionPublishStatus(request, metadata) {
        const data = AppVersionPublishStatusPurgeRequest.encode(request).finish();
        const promise = this.rpc.request(this.service, "PurgeAppVersionPublishStatus", data, metadata);
        return promise.then((data) => PurgeResult.decode(_m0.Reader.create(data)));
    }
    PurgeCuratedGames(request, metadata) {
        const data = CuratedGamesPurgeRequest.encode(request).finish();
        const promise = this.rpc.request(this.service, "PurgeCuratedGames", data, metadata);
        return promise.then((data) => PurgeResult.decode(_m0.Reader.create(data)));
    }
    PurgeAll(request, metadata) {
        const data = PurgeAllRequest.encode(request).finish();
        const promise = this.rpc.request(this.service, "PurgeAll", data, metadata);
        return promise.then((data) => PurgeResult.decode(_m0.Reader.create(data)));
    }
    RefreshGlobalDomains(request, metadata) {
        const data = RefreshGlobalDomainsRequest.encode(request).finish();
        const promise = this.rpc.request(this.service, "RefreshGlobalDomains", data, metadata);
        return promise.then((data) => PurgeResult.decode(_m0.Reader.create(data)));
    }
}
export const CacheUtilsDefinition = {
    name: "CacheUtils",
    fullName: "devvit.gateway.utils.v1alpha.CacheUtils",
    methods: {
        /**
         * Temporary method for fetching context actions and storing/caching them in the Runtime DB.
         * This is for a single-use backfill and can be removed afterwards.
         * TODO(gunsch): delete when finished.
         */
        cacheContextActionsInRuntimeDb: {
            name: "CacheContextActionsInRuntimeDb",
            requestType: CacheContextActionsRequest,
            requestStream: false,
            responseType: PurgeResult,
            responseStream: false,
            options: {},
        },
        purgeAccessKey: {
            name: "PurgeAccessKey",
            requestType: AccessKeyPurgeRequest,
            requestStream: false,
            responseType: PurgeResult,
            responseStream: false,
            options: {},
        },
        purgeInstallations: {
            name: "PurgeInstallations",
            requestType: InstallationsPurgeRequest,
            requestStream: false,
            responseType: PurgeResult,
            responseStream: false,
            options: {},
        },
        purgeInstallation: {
            name: "PurgeInstallation",
            requestType: InstallationPurgeRequest,
            requestStream: false,
            responseType: PurgeResult,
            responseStream: false,
            options: {},
        },
        purgeAppVersion: {
            name: "PurgeAppVersion",
            requestType: AppVersionPurgeRequest,
            requestStream: false,
            responseType: PurgeResult,
            responseStream: false,
            options: {},
        },
        purgeApp: {
            name: "PurgeApp",
            requestType: AppPurgeRequest,
            requestStream: false,
            responseType: PurgeResult,
            responseStream: false,
            options: {},
        },
        purgeAppVersionPublishStatus: {
            name: "PurgeAppVersionPublishStatus",
            requestType: AppVersionPublishStatusPurgeRequest,
            requestStream: false,
            responseType: PurgeResult,
            responseStream: false,
            options: {},
        },
        purgeCuratedGames: {
            name: "PurgeCuratedGames",
            requestType: CuratedGamesPurgeRequest,
            requestStream: false,
            responseType: PurgeResult,
            responseStream: false,
            options: {},
        },
        purgeAll: {
            name: "PurgeAll",
            requestType: PurgeAllRequest,
            requestStream: false,
            responseType: PurgeResult,
            responseStream: false,
            options: {},
        },
        /** Purges global domains cache then repopulates from DB. Use after adding or removing global domains. */
        refreshGlobalDomains: {
            name: "RefreshGlobalDomains",
            requestType: RefreshGlobalDomainsRequest,
            requestStream: false,
            responseType: PurgeResult,
            responseStream: false,
            options: {},
        },
    },
};
export const ModInviteUtilsServiceName = "devvit.gateway.utils.v1alpha.ModInviteUtils";
export class ModInviteUtilsClientImpl {
    constructor(rpc, opts) {
        this.service = opts?.service || ModInviteUtilsServiceName;
        this.rpc = rpc;
        this.AcceptInvite = this.AcceptInvite.bind(this);
    }
    AcceptInvite(request, metadata) {
        const data = AcceptInviteRequest.encode(request).finish();
        const promise = this.rpc.request(this.service, "AcceptInvite", data, metadata);
        return promise.then((data) => AcceptInviteResponse.decode(_m0.Reader.create(data)));
    }
}
export const ModInviteUtilsDefinition = {
    name: "ModInviteUtils",
    fullName: "devvit.gateway.utils.v1alpha.ModInviteUtils",
    methods: {
        acceptInvite: {
            name: "AcceptInvite",
            requestType: AcceptInviteRequest,
            requestStream: false,
            responseType: AcceptInviteResponse,
            responseStream: false,
            options: {},
        },
    },
};
function longToNumber(long) {
    if (long.gt(globalThis.Number.MAX_SAFE_INTEGER)) {
        throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
    }
    return long.toNumber();
}
if (_m0.util.Long !== Long) {
    _m0.util.Long = Long;
    _m0.configure();
}
function isSet(value) {
    return value !== null && value !== undefined;
}
