How to use the @webiny/commodo-graphql.resolveGetSettings function in @webiny/commodo-graphql

To help you get started, we’ve selected a few @webiny/commodo-graphql examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webiny / webiny-js / packages / api-mailchimp / src / index.js View on Github external
try {
                            const listsResponse = await mailchimp.get({
                                path: `/lists/`
                            });

                            const output = listsResponse.body.lists.map(item => ({
                                id: item.id,
                                name: item.name
                            }));

                            return new ListResponse(output);
                        } catch (e) {
                            return new ListErrorResponse(e);
                        }
                    },
                    getSettings: resolveGetSettings(({ models }) => models.MailchimpSettings)
                },
                MailchimpMutation: {
                    addToList: async (_: any, { list: listId, email }: Object, context: Object) => {
                        const { MailchimpSettings } = context.models;

                        const settings = await MailchimpSettings.load();
                        if (!get(settings, "data.apiKey")) {
                            throw Error("Mailchimp API key not set.");
                        }

                        const mailchimp = new MailchimpApi({ apiKey: settings.data.apiKey });

                        try {
                            const listResponse = await mailchimp.get({
                                path: `/lists/${listId}`
                            });
github webiny / webiny-js / packages / api-forms / src / plugins / graphql / formsSettings.js View on Github external
input FormsSettingsInput {
            reCaptcha: ReCaptchaSettingsInput
        }
    
        extend type FormsQuery {
            getSettings: FormsSettingsResponse
        }
    
        extend type FormsMutation {
            updateSettings(data: FormsSettingsInput): FormsSettingsResponse
        }
    `,
    resolvers: {
        FormsQuery: {
            getSettings: resolveGetSettings(getFormSettings)
        },
        FormsMutation: {
            updateSettings: resolveUpdateSettings(getFormSettings)
        }
    }
};
github webiny / webiny-js / packages / api-page-builder / src / plugins / graphql / Settings.js View on Github external
home: ID
            notFound: ID
            error: ID
        }

        extend type PbQuery {
            getSettings: PbSettingsResponse
        }

        extend type PbMutation {
            updateSettings(data: PbSettingsInput): PbSettingsResponse
        }
    `,
    resolvers: {
        PbQuery: {
            getSettings: resolveGetSettings(ctx => ctx.models.PbSettings)
        },
        PbMutation: {
            updateSettings: resolveUpdateSettings(ctx => ctx.models.PbSettings)
        },
        PbSocialMedia: {
            image({ image }) {
                return image ? { __typename: "File", id: image } : null;
            }
        },
        PbSettings: {
            favicon({ favicon }) {
                return favicon ? { __typename: "File", id: favicon } : null;
            },
            logo({ logo }) {
                return logo ? { __typename: "File", id: logo } : null;
            }
github webiny / webiny-js / packages / api-cookie-policy / src / index.js View on Github external
cookiePolicy: CookiePolicyQuery
                }

                extend type Mutation {
                    cookiePolicy: CookiePolicyMutation
                }
            `,
            resolvers: {
                Query: {
                    cookiePolicy: emptyResolver
                },
                Mutation: {
                    cookiePolicy: emptyResolver
                },
                CookiePolicyQuery: {
                    getSettings: resolveGetSettings(({ models }) => models.CookiePolicySettings)
                },
                CookiePolicyMutation: {
                    updateSettings: resolveUpdateSettings(
                        ({ models }) => models.CookiePolicySettings
                    )
                }
            }
        },
        security: {
            shield: {
                CookiePolicyMutation: {
                    updateSettings: hasScope("pb:settings")
                }
            }
        }
    },
github webiny / webiny-js / packages / api-google-tag-manager / src / index.js View on Github external
googleTagManager: GtmQuery
                }

                extend type Mutation {
                    googleTagManager: GtmMutation
                }
            `,
            resolvers: {
                Query: {
                    googleTagManager: emptyResolver
                },
                Mutation: {
                    googleTagManager: emptyResolver
                },
                GtmQuery: {
                    getSettings: resolveGetSettings(({ models }) => models.GoogleTagManagerSettings)
                },
                GtmMutation: {
                    updateSettings: resolveUpdateSettings(
                        ({ models }) => models.GoogleTagManagerSettings
                    )
                }
            }
        },
        security: {
            shield: {
                GtmMutation: {
                    updateSettings: hasScope("pb:settings")
                }
            }
        }
    },