@proca/api
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -1,4 +0,5 @@ | ||
import { getSdk as getWidgetSdk } from './sdk/widget'; | ||
import { getSdk as getAdminSdk } from './sdk/admin'; | ||
import { getSdk as widgetSdk } from './sdk/widget'; | ||
import { getSdk as adminSdk } from './sdk/admin'; | ||
import { authBasic, authToken } from './auth'; | ||
export { getWidgetSdk, getAdminSdk, authBasic, authToken }; | ||
import { client } from './client'; | ||
export { widgetSdk, adminSdk, client, authBasic, authToken, }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.authToken = exports.authBasic = exports.getAdminSdk = exports.getWidgetSdk = void 0; | ||
exports.authToken = exports.authBasic = exports.client = exports.adminSdk = exports.widgetSdk = void 0; | ||
const widget_1 = require("./sdk/widget"); | ||
Object.defineProperty(exports, "getWidgetSdk", { enumerable: true, get: function () { return widget_1.getSdk; } }); | ||
Object.defineProperty(exports, "widgetSdk", { enumerable: true, get: function () { return widget_1.getSdk; } }); | ||
const admin_1 = require("./sdk/admin"); | ||
Object.defineProperty(exports, "getAdminSdk", { enumerable: true, get: function () { return admin_1.getSdk; } }); | ||
Object.defineProperty(exports, "adminSdk", { enumerable: true, get: function () { return admin_1.getSdk; } }); | ||
const auth_1 = require("./auth"); | ||
Object.defineProperty(exports, "authBasic", { enumerable: true, get: function () { return auth_1.authBasic; } }); | ||
Object.defineProperty(exports, "authToken", { enumerable: true, get: function () { return auth_1.authToken; } }); | ||
const client_1 = require("./client"); | ||
Object.defineProperty(exports, "client", { enumerable: true, get: function () { return client_1.client; } }); | ||
//# sourceMappingURL=index.js.map |
import * as Types from 'types'; | ||
import { GraphQLClient } from 'graphql-request'; | ||
export declare const ListCampaignsDocument: import("graphql").DocumentNode; | ||
export declare const GetCampaignDocument: import("graphql").DocumentNode; | ||
export declare const GetActionPageDocument: import("graphql").DocumentNode; | ||
export declare const ListActionPagesDocument: import("graphql").DocumentNode; | ||
export declare const ExportCampaignActionsDocument: import("graphql").DocumentNode; | ||
export declare const UpdateActionPageDocument: import("graphql").DocumentNode; | ||
export declare const UpsertCampaignDocument: import("graphql").DocumentNode; | ||
export declare type SdkFunctionWrapper = <T>(action: () => Promise<T>) => Promise<T>; | ||
export declare function getSdk(client: GraphQLClient, withWrapper?: SdkFunctionWrapper): { | ||
ListCampaigns(variables: ListCampaignsQueryVariables): Promise<ListCampaignsQuery>; | ||
GetCampaign(variables: GetCampaignQueryVariables): Promise<GetCampaignQuery>; | ||
GetActionPage(variables: GetActionPageQueryVariables): Promise<GetActionPageQuery>; | ||
ListActionPages(variables: ListActionPagesQueryVariables): Promise<ListActionPagesQuery>; | ||
ExportCampaignActions(variables: ExportCampaignActionsQueryVariables): Promise<ExportCampaignActionsQuery>; | ||
UpdateActionPage(variables: UpdateActionPageMutationVariables): Promise<UpdateActionPageMutation>; | ||
UpsertCampaign(variables: UpsertCampaignMutationVariables): Promise<UpsertCampaignMutation>; | ||
}; | ||
@@ -27,1 +39,115 @@ export declare type Sdk = ReturnType<typeof getSdk>; | ||
}); | ||
export declare type GetCampaignQueryVariables = Types.Exact<{ | ||
org: Types.Scalars['String']; | ||
id: Types.Scalars['Int']; | ||
}>; | ||
export declare type GetCampaignQuery = ({ | ||
__typename?: 'RootQueryType'; | ||
} & { | ||
org?: Types.Maybe<({ | ||
__typename?: 'Org'; | ||
} & { | ||
campaign?: Types.Maybe<({ | ||
__typename?: 'Campaign'; | ||
} & Pick<Types.Campaign, 'id' | 'externalId' | 'name' | 'title'> & { | ||
stats?: Types.Maybe<({ | ||
__typename?: 'CampaignStats'; | ||
} & Pick<Types.CampaignStats, 'supporterCount'> & { | ||
actionCount?: Types.Maybe<Array<({ | ||
__typename?: 'ActionTypeCount'; | ||
} & Pick<Types.ActionTypeCount, 'actionType' | 'count'>)>>; | ||
})>; | ||
})>; | ||
})>; | ||
}); | ||
export declare type GetActionPageQueryVariables = Types.Exact<{ | ||
org: Types.Scalars['String']; | ||
id: Types.Scalars['Int']; | ||
}>; | ||
export declare type GetActionPageQuery = ({ | ||
__typename?: 'RootQueryType'; | ||
} & { | ||
actionPage?: Types.Maybe<({ | ||
__typename?: 'ActionPage'; | ||
} & Pick<Types.ActionPage, 'id' | 'name' | 'locale' | 'config'>)>; | ||
}); | ||
export declare type ListActionPagesQueryVariables = Types.Exact<{ | ||
org: Types.Scalars['String']; | ||
}>; | ||
export declare type ListActionPagesQuery = ({ | ||
__typename?: 'RootQueryType'; | ||
} & { | ||
org?: Types.Maybe<({ | ||
__typename?: 'Org'; | ||
} & { | ||
actionPages?: Types.Maybe<Array<Types.Maybe<({ | ||
__typename?: 'ActionPage'; | ||
} & Pick<Types.ActionPage, 'id' | 'name' | 'locale'>)>>>; | ||
})>; | ||
}); | ||
export declare type ExportCampaignActionsQueryVariables = Types.Exact<{ | ||
org: Types.Scalars['String']; | ||
campaignId: Types.Scalars['Int']; | ||
start?: Types.Maybe<Types.Scalars['Int']>; | ||
after?: Types.Maybe<Types.Scalars['Datetime']>; | ||
limit?: Types.Maybe<Types.Scalars['Int']>; | ||
}>; | ||
export declare type ExportCampaignActionsQuery = ({ | ||
__typename?: 'RootQueryType'; | ||
} & { | ||
exportActions?: Types.Maybe<Array<Types.Maybe<({ | ||
__typename?: 'Action'; | ||
} & Pick<Types.Action, 'actionId' | 'actionType'> & { | ||
contact: ({ | ||
__typename?: 'Contact'; | ||
} & Pick<Types.Contact, 'contactRef' | 'payload' | 'nonce'> & { | ||
publicKey?: Types.Maybe<({ | ||
__typename?: 'Key'; | ||
} & Pick<Types.Key, 'id' | 'key'>)>; | ||
signKey?: Types.Maybe<({ | ||
__typename?: 'Key'; | ||
} & Pick<Types.Key, 'id' | 'key'>)>; | ||
}); | ||
fields: Array<({ | ||
__typename?: 'CustomField'; | ||
} & Pick<Types.CustomField, 'key' | 'value'>)>; | ||
tracking?: Types.Maybe<({ | ||
__typename?: 'Tracking'; | ||
} & Pick<Types.Tracking, 'source' | 'medium' | 'campaign' | 'content'>)>; | ||
actionPage: ({ | ||
__typename?: 'ActionActionPage'; | ||
} & Pick<Types.ActionActionPage, 'id' | 'name'>); | ||
privacy: ({ | ||
__typename?: 'Consent'; | ||
} & Pick<Types.Consent, 'optIn'>); | ||
})>>>; | ||
}); | ||
export declare type UpdateActionPageMutationVariables = Types.Exact<{ | ||
id: Types.Scalars['Int']; | ||
name?: Types.Maybe<Types.Scalars['String']>; | ||
locale?: Types.Maybe<Types.Scalars['String']>; | ||
thankYouTemplateRef?: Types.Maybe<Types.Scalars['String']>; | ||
extraSupporters?: Types.Maybe<Types.Scalars['Int']>; | ||
config?: Types.Maybe<Types.Scalars['String']>; | ||
}>; | ||
export declare type UpdateActionPageMutation = ({ | ||
__typename?: 'RootMutationType'; | ||
} & { | ||
updateActionPage?: Types.Maybe<({ | ||
__typename?: 'ActionPage'; | ||
} & Pick<Types.ActionPage, 'id'>)>; | ||
}); | ||
export declare type UpsertCampaignMutationVariables = Types.Exact<{ | ||
org: Types.Scalars['String']; | ||
name: Types.Scalars['String']; | ||
externalId?: Types.Maybe<Types.Scalars['Int']>; | ||
title?: Types.Maybe<Types.Scalars['String']>; | ||
actionPages: Array<Types.Maybe<Types.ActionPageInput>>; | ||
}>; | ||
export declare type UpsertCampaignMutation = ({ | ||
__typename?: 'RootMutationType'; | ||
} & { | ||
upsertCampaign?: Types.Maybe<({ | ||
__typename?: 'Campaign'; | ||
} & Pick<Types.Campaign, 'id'>)>; | ||
}); |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getSdk = exports.ListCampaignsDocument = void 0; | ||
exports.getSdk = exports.UpsertCampaignDocument = exports.UpdateActionPageDocument = exports.ExportCampaignActionsDocument = exports.ListActionPagesDocument = exports.GetActionPageDocument = exports.GetCampaignDocument = exports.ListCampaignsDocument = void 0; | ||
const graphql_1 = require("graphql"); | ||
@@ -26,2 +26,94 @@ const graphql_tag_1 = __importDefault(require("graphql-tag")); | ||
`; | ||
exports.GetCampaignDocument = graphql_tag_1.default ` | ||
query GetCampaign($org: String!, $id: Int!) { | ||
org(name: $org) { | ||
campaign(id: $id) { | ||
id | ||
externalId | ||
name | ||
title | ||
stats { | ||
supporterCount | ||
actionCount { | ||
actionType | ||
count | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`; | ||
exports.GetActionPageDocument = graphql_tag_1.default ` | ||
query GetActionPage($org: String!, $id: Int!) { | ||
actionPage(id: $id) { | ||
id | ||
name | ||
locale | ||
config | ||
} | ||
} | ||
`; | ||
exports.ListActionPagesDocument = graphql_tag_1.default ` | ||
query ListActionPages($org: String!) { | ||
org(name: $org) { | ||
actionPages { | ||
id | ||
name | ||
locale | ||
} | ||
} | ||
} | ||
`; | ||
exports.ExportCampaignActionsDocument = graphql_tag_1.default ` | ||
query ExportCampaignActions($org: String!, $campaignId: Int!, $start: Int, $after: Datetime, $limit: Int) { | ||
exportActions(orgName: $org, campaignId: $campaignId, start: $start, after: $after, limit: $limit) { | ||
actionId | ||
actionType | ||
contact { | ||
contactRef | ||
payload | ||
nonce | ||
publicKey { | ||
id | ||
key | ||
} | ||
signKey { | ||
id | ||
key | ||
} | ||
} | ||
fields { | ||
key | ||
value | ||
} | ||
tracking { | ||
source | ||
medium | ||
campaign | ||
content | ||
} | ||
actionPage { | ||
id | ||
name | ||
} | ||
privacy { | ||
optIn | ||
} | ||
} | ||
} | ||
`; | ||
exports.UpdateActionPageDocument = graphql_tag_1.default ` | ||
mutation UpdateActionPage($id: Int!, $name: String, $locale: String, $thankYouTemplateRef: String, $extraSupporters: Int, $config: String) { | ||
updateActionPage(id: $id, name: $name, locale: $locale, thankYouTemplateRef: $thankYouTemplateRef, extraSupporters: $extraSupporters, config: $config) { | ||
id | ||
} | ||
} | ||
`; | ||
exports.UpsertCampaignDocument = graphql_tag_1.default ` | ||
mutation UpsertCampaign($org: String!, $name: String!, $externalId: Int, $title: String, $actionPages: [ActionPageInput]!) { | ||
upsertCampaign(orgName: $org, name: $name, externalId: $externalId, title: $title, actionPages: $actionPages) { | ||
id | ||
} | ||
} | ||
`; | ||
const defaultWrapper = sdkFunction => sdkFunction(); | ||
@@ -32,2 +124,20 @@ function getSdk(client, withWrapper = defaultWrapper) { | ||
return withWrapper(() => client.request(graphql_1.print(exports.ListCampaignsDocument), variables)); | ||
}, | ||
GetCampaign(variables) { | ||
return withWrapper(() => client.request(graphql_1.print(exports.GetCampaignDocument), variables)); | ||
}, | ||
GetActionPage(variables) { | ||
return withWrapper(() => client.request(graphql_1.print(exports.GetActionPageDocument), variables)); | ||
}, | ||
ListActionPages(variables) { | ||
return withWrapper(() => client.request(graphql_1.print(exports.ListActionPagesDocument), variables)); | ||
}, | ||
ExportCampaignActions(variables) { | ||
return withWrapper(() => client.request(graphql_1.print(exports.ExportCampaignActionsDocument), variables)); | ||
}, | ||
UpdateActionPage(variables) { | ||
return withWrapper(() => client.request(graphql_1.print(exports.UpdateActionPageDocument), variables)); | ||
}, | ||
UpsertCampaign(variables) { | ||
return withWrapper(() => client.request(graphql_1.print(exports.UpsertCampaignDocument), variables)); | ||
} | ||
@@ -34,0 +144,0 @@ }; |
import * as Types from 'types'; | ||
import { GraphQLClient } from 'graphql-request'; | ||
export declare const GetActionPageDocument: import("graphql").DocumentNode; | ||
export declare const GetActionPagePublicResultDocument: import("graphql").DocumentNode; | ||
export declare const GetStatsDocument: import("graphql").DocumentNode; | ||
export declare const GetPublicResultDocument: import("graphql").DocumentNode; | ||
export declare const AddContactActionDocument: import("graphql").DocumentNode; | ||
export declare const AddActionDocument: import("graphql").DocumentNode; | ||
export declare type SdkFunctionWrapper = <T>(action: () => Promise<T>) => Promise<T>; | ||
export declare function getSdk(client: GraphQLClient, withWrapper?: SdkFunctionWrapper): { | ||
GetActionPage(variables?: GetActionPageQueryVariables): Promise<GetActionPageQuery>; | ||
GetActionPagePublicResult(variables: GetActionPagePublicResultQueryVariables): Promise<GetActionPagePublicResultQuery>; | ||
GetStats(variables?: GetStatsQueryVariables): Promise<GetStatsQuery>; | ||
GetPublicResult(variables: GetPublicResultQueryVariables): Promise<GetPublicResultQuery>; | ||
AddContactAction(variables: AddContactActionMutationVariables): Promise<AddContactActionMutation>; | ||
AddAction(variables: AddActionMutationVariables): Promise<AddActionMutation>; | ||
}; | ||
@@ -39,8 +43,31 @@ export declare type Sdk = ReturnType<typeof getSdk>; | ||
}); | ||
export declare type GetActionPagePublicResultQueryVariables = Types.Exact<{ | ||
export declare type GetStatsQueryVariables = Types.Exact<{ | ||
name?: Types.Maybe<Types.Scalars['String']>; | ||
id?: Types.Maybe<Types.Scalars['Int']>; | ||
}>; | ||
export declare type GetStatsQuery = ({ | ||
__typename?: 'RootQueryType'; | ||
} & { | ||
actionPage?: Types.Maybe<({ | ||
__typename?: 'ActionPage'; | ||
} & { | ||
campaign?: Types.Maybe<({ | ||
__typename?: 'Campaign'; | ||
} & { | ||
stats?: Types.Maybe<({ | ||
__typename?: 'CampaignStats'; | ||
} & Pick<Types.CampaignStats, 'supporterCount'> & { | ||
actionCount?: Types.Maybe<Array<({ | ||
__typename?: 'ActionTypeCount'; | ||
} & Pick<Types.ActionTypeCount, 'actionType' | 'count'>)>>; | ||
})>; | ||
})>; | ||
})>; | ||
}); | ||
export declare type GetPublicResultQueryVariables = Types.Exact<{ | ||
name?: Types.Maybe<Types.Scalars['String']>; | ||
id?: Types.Maybe<Types.Scalars['Int']>; | ||
actionType: Types.Scalars['String']; | ||
}>; | ||
export declare type GetActionPagePublicResultQuery = ({ | ||
export declare type GetPublicResultQuery = ({ | ||
__typename?: 'RootQueryType'; | ||
@@ -93,1 +120,15 @@ } & { | ||
}); | ||
export declare type AddActionMutationVariables = Types.Exact<{ | ||
id: Types.Scalars['Int']; | ||
contactRef: Types.Scalars['ID']; | ||
actionType: Types.Scalars['String']; | ||
fields?: Types.Maybe<Array<Types.CustomFieldInput>>; | ||
tracking?: Types.Maybe<Types.TrackingInput>; | ||
}>; | ||
export declare type AddActionMutation = ({ | ||
__typename?: 'RootMutationType'; | ||
} & { | ||
addAction?: Types.Maybe<({ | ||
__typename?: 'ContactReference'; | ||
} & Pick<Types.ContactReference, 'contactRef' | 'firstName'>)>; | ||
}); |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getSdk = exports.AddContactActionDocument = exports.GetActionPagePublicResultDocument = exports.GetActionPageDocument = void 0; | ||
exports.getSdk = exports.AddActionDocument = exports.AddContactActionDocument = exports.GetPublicResultDocument = exports.GetStatsDocument = exports.GetActionPageDocument = void 0; | ||
const graphql_1 = require("graphql"); | ||
@@ -35,4 +35,19 @@ const graphql_tag_1 = __importDefault(require("graphql-tag")); | ||
`; | ||
exports.GetActionPagePublicResultDocument = graphql_tag_1.default ` | ||
query GetActionPagePublicResult($name: String, $id: Int, $actionType: String!) { | ||
exports.GetStatsDocument = graphql_tag_1.default ` | ||
query GetStats($name: String, $id: Int) { | ||
actionPage(id: $id, name: $name) { | ||
campaign { | ||
stats { | ||
supporterCount | ||
actionCount { | ||
actionType | ||
count | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`; | ||
exports.GetPublicResultDocument = graphql_tag_1.default ` | ||
query GetPublicResult($name: String, $id: Int, $actionType: String!) { | ||
actionPage(name: $name, id: $id) { | ||
@@ -80,2 +95,10 @@ config | ||
`; | ||
exports.AddActionDocument = graphql_tag_1.default ` | ||
mutation AddAction($id: Int!, $contactRef: ID!, $actionType: String!, $fields: [CustomFieldInput!], $tracking: TrackingInput) { | ||
addAction(actionPageId: $id, contactRef: $contactRef, action: {actionType: $actionType, fields: $fields}, tracking: $tracking) { | ||
contactRef | ||
firstName | ||
} | ||
} | ||
`; | ||
const defaultWrapper = sdkFunction => sdkFunction(); | ||
@@ -87,7 +110,13 @@ function getSdk(client, withWrapper = defaultWrapper) { | ||
}, | ||
GetActionPagePublicResult(variables) { | ||
return withWrapper(() => client.request(graphql_1.print(exports.GetActionPagePublicResultDocument), variables)); | ||
GetStats(variables) { | ||
return withWrapper(() => client.request(graphql_1.print(exports.GetStatsDocument), variables)); | ||
}, | ||
GetPublicResult(variables) { | ||
return withWrapper(() => client.request(graphql_1.print(exports.GetPublicResultDocument), variables)); | ||
}, | ||
AddContactAction(variables) { | ||
return withWrapper(() => client.request(graphql_1.print(exports.AddContactActionDocument), variables)); | ||
}, | ||
AddAction(variables) { | ||
return withWrapper(() => client.request(graphql_1.print(exports.AddActionDocument), variables)); | ||
} | ||
@@ -94,0 +123,0 @@ }; |
@@ -43,2 +43,3 @@ export declare type Maybe<T> = T | null; | ||
__typename?: 'ActionActionPage'; | ||
id: Scalars['Int']; | ||
name: Scalars['String']; | ||
@@ -163,3 +164,3 @@ locale: Scalars['String']; | ||
actionPages: Array<Maybe<ActionPageInput>>; | ||
title: Scalars['String']; | ||
title?: Maybe<Scalars['String']>; | ||
externalId?: Maybe<Scalars['Int']>; | ||
@@ -218,3 +219,3 @@ name: Scalars['String']; | ||
tracking?: Maybe<TrackingInput>; | ||
contactRef?: Maybe<Scalars['ID']>; | ||
contactRef: Scalars['ID']; | ||
action: ActionInput; | ||
@@ -271,3 +272,3 @@ actionPageId: Scalars['Int']; | ||
actionPages: Array<Maybe<ActionPageInput>>; | ||
title: Scalars['String']; | ||
title?: Maybe<Scalars['String']>; | ||
externalId?: Maybe<Scalars['Int']>; | ||
@@ -295,3 +296,3 @@ name: Scalars['String']; | ||
tracking?: Maybe<TrackingInput>; | ||
contactRef?: Maybe<Scalars['ID']>; | ||
contactRef: Scalars['ID']; | ||
action: ActionInput; | ||
@@ -497,3 +498,2 @@ actionPageId: Scalars['Int']; | ||
signKey?: Maybe<Key>; | ||
optIn: Scalars['Boolean']; | ||
}; | ||
@@ -500,0 +500,0 @@ /** Custom field with a key and value. Both are strings. */ |
{ | ||
"name": "@proca/api", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Client library for Proca API", | ||
@@ -25,2 +25,3 @@ "main": "dist/index.js", | ||
"cross-fetch": "^3.0.6", | ||
"graphql-request": "^3.1.0", | ||
"js-base64": "^3.5.2" | ||
@@ -27,0 +28,0 @@ }, |
@@ -17,8 +17,8 @@ | ||
```js | ||
import {getWidgetSdk, getAdminSdk} from '@proca/api' | ||
import {client, getWidgetSdk, getAdminSdk} from '@proca/api' | ||
// create a new GraphQL client | ||
const client = new GraphQLClient("https://api-stg.proca.app/api") | ||
const client = new client"https://api-stg.proca.app/api") | ||
const sdk = getWidgetSdk(client) | ||
const sdk = widgetSdk(client) | ||
@@ -45,3 +45,3 @@ try { | ||
client = authBasic(client, "user@domain.com", "password123") | ||
sdk = getAdminSdk(client) | ||
sdk = adminSdk(client) | ||
``` | ||
@@ -48,0 +48,0 @@ |
@@ -1,10 +0,12 @@ | ||
import {getSdk as getWidgetSdk} from './sdk/widget' | ||
import {getSdk as getAdminSdk} from './sdk/admin' | ||
import {getSdk as widgetSdk} from './sdk/widget' | ||
import {getSdk as adminSdk} from './sdk/admin' | ||
import {authBasic, authToken} from './auth' | ||
import {client} from './client' | ||
export { | ||
getWidgetSdk, | ||
getAdminSdk, | ||
widgetSdk, | ||
adminSdk, | ||
client, | ||
authBasic, | ||
authToken | ||
authToken, | ||
} |
@@ -23,2 +23,94 @@ import * as Types from 'types'; | ||
`; | ||
export const GetCampaignDocument = gql` | ||
query GetCampaign($org: String!, $id: Int!) { | ||
org(name: $org) { | ||
campaign(id: $id) { | ||
id | ||
externalId | ||
name | ||
title | ||
stats { | ||
supporterCount | ||
actionCount { | ||
actionType | ||
count | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`; | ||
export const GetActionPageDocument = gql` | ||
query GetActionPage($org: String!, $id: Int!) { | ||
actionPage(id: $id) { | ||
id | ||
name | ||
locale | ||
config | ||
} | ||
} | ||
`; | ||
export const ListActionPagesDocument = gql` | ||
query ListActionPages($org: String!) { | ||
org(name: $org) { | ||
actionPages { | ||
id | ||
name | ||
locale | ||
} | ||
} | ||
} | ||
`; | ||
export const ExportCampaignActionsDocument = gql` | ||
query ExportCampaignActions($org: String!, $campaignId: Int!, $start: Int, $after: Datetime, $limit: Int) { | ||
exportActions(orgName: $org, campaignId: $campaignId, start: $start, after: $after, limit: $limit) { | ||
actionId | ||
actionType | ||
contact { | ||
contactRef | ||
payload | ||
nonce | ||
publicKey { | ||
id | ||
key | ||
} | ||
signKey { | ||
id | ||
key | ||
} | ||
} | ||
fields { | ||
key | ||
value | ||
} | ||
tracking { | ||
source | ||
medium | ||
campaign | ||
content | ||
} | ||
actionPage { | ||
id | ||
name | ||
} | ||
privacy { | ||
optIn | ||
} | ||
} | ||
} | ||
`; | ||
export const UpdateActionPageDocument = gql` | ||
mutation UpdateActionPage($id: Int!, $name: String, $locale: String, $thankYouTemplateRef: String, $extraSupporters: Int, $config: String) { | ||
updateActionPage(id: $id, name: $name, locale: $locale, thankYouTemplateRef: $thankYouTemplateRef, extraSupporters: $extraSupporters, config: $config) { | ||
id | ||
} | ||
} | ||
`; | ||
export const UpsertCampaignDocument = gql` | ||
mutation UpsertCampaign($org: String!, $name: String!, $externalId: Int, $title: String, $actionPages: [ActionPageInput]!) { | ||
upsertCampaign(orgName: $org, name: $name, externalId: $externalId, title: $title, actionPages: $actionPages) { | ||
id | ||
} | ||
} | ||
`; | ||
@@ -33,2 +125,20 @@ export type SdkFunctionWrapper = <T>(action: () => Promise<T>) => Promise<T>; | ||
return withWrapper(() => client.request<ListCampaignsQuery>(print(ListCampaignsDocument), variables)); | ||
}, | ||
GetCampaign(variables: GetCampaignQueryVariables): Promise<GetCampaignQuery> { | ||
return withWrapper(() => client.request<GetCampaignQuery>(print(GetCampaignDocument), variables)); | ||
}, | ||
GetActionPage(variables: GetActionPageQueryVariables): Promise<GetActionPageQuery> { | ||
return withWrapper(() => client.request<GetActionPageQuery>(print(GetActionPageDocument), variables)); | ||
}, | ||
ListActionPages(variables: ListActionPagesQueryVariables): Promise<ListActionPagesQuery> { | ||
return withWrapper(() => client.request<ListActionPagesQuery>(print(ListActionPagesDocument), variables)); | ||
}, | ||
ExportCampaignActions(variables: ExportCampaignActionsQueryVariables): Promise<ExportCampaignActionsQuery> { | ||
return withWrapper(() => client.request<ExportCampaignActionsQuery>(print(ExportCampaignActionsDocument), variables)); | ||
}, | ||
UpdateActionPage(variables: UpdateActionPageMutationVariables): Promise<UpdateActionPageMutation> { | ||
return withWrapper(() => client.request<UpdateActionPageMutation>(print(UpdateActionPageDocument), variables)); | ||
}, | ||
UpsertCampaign(variables: UpsertCampaignMutationVariables): Promise<UpsertCampaignMutation> { | ||
return withWrapper(() => client.request<UpsertCampaignMutation>(print(UpsertCampaignDocument), variables)); | ||
} | ||
@@ -57,1 +167,131 @@ }; | ||
); | ||
export type GetCampaignQueryVariables = Types.Exact<{ | ||
org: Types.Scalars['String']; | ||
id: Types.Scalars['Int']; | ||
}>; | ||
export type GetCampaignQuery = ( | ||
{ __typename?: 'RootQueryType' } | ||
& { org?: Types.Maybe<( | ||
{ __typename?: 'Org' } | ||
& { campaign?: Types.Maybe<( | ||
{ __typename?: 'Campaign' } | ||
& Pick<Types.Campaign, 'id' | 'externalId' | 'name' | 'title'> | ||
& { stats?: Types.Maybe<( | ||
{ __typename?: 'CampaignStats' } | ||
& Pick<Types.CampaignStats, 'supporterCount'> | ||
& { actionCount?: Types.Maybe<Array<( | ||
{ __typename?: 'ActionTypeCount' } | ||
& Pick<Types.ActionTypeCount, 'actionType' | 'count'> | ||
)>> } | ||
)> } | ||
)> } | ||
)> } | ||
); | ||
export type GetActionPageQueryVariables = Types.Exact<{ | ||
org: Types.Scalars['String']; | ||
id: Types.Scalars['Int']; | ||
}>; | ||
export type GetActionPageQuery = ( | ||
{ __typename?: 'RootQueryType' } | ||
& { actionPage?: Types.Maybe<( | ||
{ __typename?: 'ActionPage' } | ||
& Pick<Types.ActionPage, 'id' | 'name' | 'locale' | 'config'> | ||
)> } | ||
); | ||
export type ListActionPagesQueryVariables = Types.Exact<{ | ||
org: Types.Scalars['String']; | ||
}>; | ||
export type ListActionPagesQuery = ( | ||
{ __typename?: 'RootQueryType' } | ||
& { org?: Types.Maybe<( | ||
{ __typename?: 'Org' } | ||
& { actionPages?: Types.Maybe<Array<Types.Maybe<( | ||
{ __typename?: 'ActionPage' } | ||
& Pick<Types.ActionPage, 'id' | 'name' | 'locale'> | ||
)>>> } | ||
)> } | ||
); | ||
export type ExportCampaignActionsQueryVariables = Types.Exact<{ | ||
org: Types.Scalars['String']; | ||
campaignId: Types.Scalars['Int']; | ||
start?: Types.Maybe<Types.Scalars['Int']>; | ||
after?: Types.Maybe<Types.Scalars['Datetime']>; | ||
limit?: Types.Maybe<Types.Scalars['Int']>; | ||
}>; | ||
export type ExportCampaignActionsQuery = ( | ||
{ __typename?: 'RootQueryType' } | ||
& { exportActions?: Types.Maybe<Array<Types.Maybe<( | ||
{ __typename?: 'Action' } | ||
& Pick<Types.Action, 'actionId' | 'actionType'> | ||
& { contact: ( | ||
{ __typename?: 'Contact' } | ||
& Pick<Types.Contact, 'contactRef' | 'payload' | 'nonce'> | ||
& { publicKey?: Types.Maybe<( | ||
{ __typename?: 'Key' } | ||
& Pick<Types.Key, 'id' | 'key'> | ||
)>, signKey?: Types.Maybe<( | ||
{ __typename?: 'Key' } | ||
& Pick<Types.Key, 'id' | 'key'> | ||
)> } | ||
), fields: Array<( | ||
{ __typename?: 'CustomField' } | ||
& Pick<Types.CustomField, 'key' | 'value'> | ||
)>, tracking?: Types.Maybe<( | ||
{ __typename?: 'Tracking' } | ||
& Pick<Types.Tracking, 'source' | 'medium' | 'campaign' | 'content'> | ||
)>, actionPage: ( | ||
{ __typename?: 'ActionActionPage' } | ||
& Pick<Types.ActionActionPage, 'id' | 'name'> | ||
), privacy: ( | ||
{ __typename?: 'Consent' } | ||
& Pick<Types.Consent, 'optIn'> | ||
) } | ||
)>>> } | ||
); | ||
export type UpdateActionPageMutationVariables = Types.Exact<{ | ||
id: Types.Scalars['Int']; | ||
name?: Types.Maybe<Types.Scalars['String']>; | ||
locale?: Types.Maybe<Types.Scalars['String']>; | ||
thankYouTemplateRef?: Types.Maybe<Types.Scalars['String']>; | ||
extraSupporters?: Types.Maybe<Types.Scalars['Int']>; | ||
config?: Types.Maybe<Types.Scalars['String']>; | ||
}>; | ||
export type UpdateActionPageMutation = ( | ||
{ __typename?: 'RootMutationType' } | ||
& { updateActionPage?: Types.Maybe<( | ||
{ __typename?: 'ActionPage' } | ||
& Pick<Types.ActionPage, 'id'> | ||
)> } | ||
); | ||
export type UpsertCampaignMutationVariables = Types.Exact<{ | ||
org: Types.Scalars['String']; | ||
name: Types.Scalars['String']; | ||
externalId?: Types.Maybe<Types.Scalars['Int']>; | ||
title?: Types.Maybe<Types.Scalars['String']>; | ||
actionPages: Array<Types.Maybe<Types.ActionPageInput>>; | ||
}>; | ||
export type UpsertCampaignMutation = ( | ||
{ __typename?: 'RootMutationType' } | ||
& { upsertCampaign?: Types.Maybe<( | ||
{ __typename?: 'Campaign' } | ||
& Pick<Types.Campaign, 'id'> | ||
)> } | ||
); |
@@ -32,8 +32,12 @@ import * as Types from 'types'; | ||
`; | ||
export const GetCountDocument = gql` | ||
query GetCount($id: Int!) { | ||
actionPage(id: $id) { | ||
export const GetStatsDocument = gql` | ||
query GetStats($name: String, $id: Int) { | ||
actionPage(id: $id, name: $name) { | ||
campaign { | ||
stats { | ||
supporterCount | ||
actionCount { | ||
actionType | ||
count | ||
} | ||
} | ||
@@ -44,19 +48,4 @@ } | ||
`; | ||
export const GetCountByNameDocument = gql` | ||
query GetCountByName($name: String!) { | ||
actionPage(name: $name) { | ||
id | ||
campaign { | ||
name | ||
title | ||
externalId | ||
stats { | ||
supporterCount | ||
} | ||
} | ||
} | ||
} | ||
`; | ||
export const GetActionPagePublicResultDocument = gql` | ||
query GetActionPagePublicResult($name: String, $id: Int, $actionType: String!) { | ||
export const GetPublicResultDocument = gql` | ||
query GetPublicResult($name: String, $id: Int, $actionType: String!) { | ||
actionPage(name: $name, id: $id) { | ||
@@ -105,3 +94,3 @@ config | ||
export const AddActionDocument = gql` | ||
mutation AddAction($id: Int!, $contactRef: ID, $actionType: String!, $fields: [CustomFieldInput!], $tracking: TrackingInput) { | ||
mutation AddAction($id: Int!, $contactRef: ID!, $actionType: String!, $fields: [CustomFieldInput!], $tracking: TrackingInput) { | ||
addAction(actionPageId: $id, contactRef: $contactRef, action: {actionType: $actionType, fields: $fields}, tracking: $tracking) { | ||
@@ -123,11 +112,8 @@ contactRef | ||
}, | ||
GetCount(variables: GetCountQueryVariables): Promise<GetCountQuery> { | ||
return withWrapper(() => client.request<GetCountQuery>(print(GetCountDocument), variables)); | ||
GetStats(variables?: GetStatsQueryVariables): Promise<GetStatsQuery> { | ||
return withWrapper(() => client.request<GetStatsQuery>(print(GetStatsDocument), variables)); | ||
}, | ||
GetCountByName(variables: GetCountByNameQueryVariables): Promise<GetCountByNameQuery> { | ||
return withWrapper(() => client.request<GetCountByNameQuery>(print(GetCountByNameDocument), variables)); | ||
GetPublicResult(variables: GetPublicResultQueryVariables): Promise<GetPublicResultQuery> { | ||
return withWrapper(() => client.request<GetPublicResultQuery>(print(GetPublicResultDocument), variables)); | ||
}, | ||
GetActionPagePublicResult(variables: GetActionPagePublicResultQueryVariables): Promise<GetActionPagePublicResultQuery> { | ||
return withWrapper(() => client.request<GetActionPagePublicResultQuery>(print(GetActionPagePublicResultDocument), variables)); | ||
}, | ||
AddContactAction(variables: AddContactActionMutationVariables): Promise<AddContactActionMutation> { | ||
@@ -171,8 +157,9 @@ return withWrapper(() => client.request<AddContactActionMutation>(print(AddContactActionDocument), variables)); | ||
export type GetCountQueryVariables = Types.Exact<{ | ||
id: Types.Scalars['Int']; | ||
export type GetStatsQueryVariables = Types.Exact<{ | ||
name?: Types.Maybe<Types.Scalars['String']>; | ||
id?: Types.Maybe<Types.Scalars['Int']>; | ||
}>; | ||
export type GetCountQuery = ( | ||
export type GetStatsQuery = ( | ||
{ __typename?: 'RootQueryType' } | ||
@@ -186,2 +173,6 @@ & { actionPage?: Types.Maybe<( | ||
& Pick<Types.CampaignStats, 'supporterCount'> | ||
& { actionCount?: Types.Maybe<Array<( | ||
{ __typename?: 'ActionTypeCount' } | ||
& Pick<Types.ActionTypeCount, 'actionType' | 'count'> | ||
)>> } | ||
)> } | ||
@@ -192,24 +183,3 @@ )> } | ||
export type GetCountByNameQueryVariables = Types.Exact<{ | ||
name: Types.Scalars['String']; | ||
}>; | ||
export type GetCountByNameQuery = ( | ||
{ __typename?: 'RootQueryType' } | ||
& { actionPage?: Types.Maybe<( | ||
{ __typename?: 'ActionPage' } | ||
& Pick<Types.ActionPage, 'id'> | ||
& { campaign?: Types.Maybe<( | ||
{ __typename?: 'Campaign' } | ||
& Pick<Types.Campaign, 'name' | 'title' | 'externalId'> | ||
& { stats?: Types.Maybe<( | ||
{ __typename?: 'CampaignStats' } | ||
& Pick<Types.CampaignStats, 'supporterCount'> | ||
)> } | ||
)> } | ||
)> } | ||
); | ||
export type GetActionPagePublicResultQueryVariables = Types.Exact<{ | ||
export type GetPublicResultQueryVariables = Types.Exact<{ | ||
name?: Types.Maybe<Types.Scalars['String']>; | ||
@@ -221,3 +191,3 @@ id?: Types.Maybe<Types.Scalars['Int']>; | ||
export type GetActionPagePublicResultQuery = ( | ||
export type GetPublicResultQuery = ( | ||
{ __typename?: 'RootQueryType' } | ||
@@ -276,3 +246,3 @@ & { actionPage?: Types.Maybe<( | ||
id: Types.Scalars['Int']; | ||
contactRef?: Types.Maybe<Types.Scalars['ID']>; | ||
contactRef: Types.Scalars['ID']; | ||
actionType: Types.Scalars['String']; | ||
@@ -279,0 +249,0 @@ fields?: Types.Maybe<Array<Types.CustomFieldInput>>; |
@@ -42,2 +42,3 @@ export type Maybe<T> = T | null; | ||
__typename?: 'ActionActionPage'; | ||
id: Scalars['Int']; | ||
name: Scalars['String']; | ||
@@ -184,3 +185,3 @@ locale: Scalars['String']; | ||
actionPages: Array<Maybe<ActionPageInput>>; | ||
title: Scalars['String']; | ||
title?: Maybe<Scalars['String']>; | ||
externalId?: Maybe<Scalars['Int']>; | ||
@@ -251,3 +252,3 @@ name: Scalars['String']; | ||
tracking?: Maybe<TrackingInput>; | ||
contactRef?: Maybe<Scalars['ID']>; | ||
contactRef: Scalars['ID']; | ||
action: ActionInput; | ||
@@ -312,3 +313,3 @@ actionPageId: Scalars['Int']; | ||
actionPages: Array<Maybe<ActionPageInput>>; | ||
title: Scalars['String']; | ||
title?: Maybe<Scalars['String']>; | ||
externalId?: Maybe<Scalars['Int']>; | ||
@@ -342,3 +343,3 @@ name: Scalars['String']; | ||
tracking?: Maybe<TrackingInput>; | ||
contactRef?: Maybe<Scalars['ID']>; | ||
contactRef: Scalars['ID']; | ||
action: ActionInput; | ||
@@ -579,3 +580,2 @@ actionPageId: Scalars['Int']; | ||
signKey?: Maybe<Key>; | ||
optIn: Scalars['Boolean']; | ||
}; | ||
@@ -582,0 +582,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
235308
6622
3
+ Addedgraphql-request@^3.1.0
+ Addedasynckit@0.4.0(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedextract-files@9.0.0(transitive)
+ Addedform-data@3.0.2(transitive)
+ Addedgraphql@16.9.0(transitive)
+ Addedgraphql-request@3.7.0(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)