Skip to content

Commit 5e774c9

Browse files
cgsimmonslukas-reineke
authored andcommitted
Add vendor login
1 parent 0f1ea8b commit 5e774c9

File tree

8 files changed

+244
-18
lines changed

8 files changed

+244
-18
lines changed

index.node.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.web.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/generated/fields.d.ts

Lines changed: 27 additions & 12 deletions
Large diffs are not rendered by default.

src/generated/fields.ts

Lines changed: 46 additions & 1 deletion
Large diffs are not rendered by default.

src/generated/graphql.d.ts

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,15 @@ export declare type EntitlementUpdateInput = {
653653
/** Set of permissions granted to the related user */
654654
permissions: Array<AuthPermission>;
655655
};
656+
/** Vendor login input data */
657+
export declare type LoginVendorInput = {
658+
/** Id of the marketplace associated with the vendor login */
659+
marketplaceId: Scalars['ObjectId'];
660+
/** Email associated with the vendor login */
661+
email: Scalars['NonEmptyString'];
662+
/** Password associated with the vendor login */
663+
password: Scalars['NonEmptyString'];
664+
};
656665
/** Marketing ad represents a specific ad on a platform belonging to a marketing campaign and associated with a single vendor */
657666
export declare type MarketingAd = ResultResource & {
658667
/** Unique identifier */
@@ -1147,6 +1156,10 @@ export declare type Mutation = {
11471156
deleteVendor: Deletion;
11481157
/** Creates a vendor token using input data */
11491158
createVendorToken: VendorToken;
1159+
/** Login as a vendor */
1160+
loginVendor: VendorToken;
1161+
/** Sets the password of a vendor token */
1162+
setVendorPassword: VendorToken;
11501163
/** Deletes a vendor token identified by a given id */
11511164
deleteVendorToken: Deletion;
11521165
};
@@ -1301,6 +1314,12 @@ export declare type MutationDeleteVendorArgs = {
13011314
export declare type MutationCreateVendorTokenArgs = {
13021315
input: VendorTokenInput;
13031316
};
1317+
export declare type MutationLoginVendorArgs = {
1318+
input: LoginVendorInput;
1319+
};
1320+
export declare type MutationSetVendorPasswordArgs = {
1321+
input: SetVendorPasswordInput;
1322+
};
13041323
export declare type MutationDeleteVendorTokenArgs = {
13051324
id: Scalars['ObjectId'];
13061325
};
@@ -1813,6 +1832,15 @@ export declare enum ResultResourceTypeEnum {
18131832
MarketingAd = "MarketingAd",
18141833
MarketingCampaign = "MarketingCampaign"
18151834
}
1835+
/** Vendor reset password input data */
1836+
export declare type SetVendorPasswordInput = {
1837+
/** Id of the marketplace associated with the vendor login */
1838+
marketplaceId: Scalars['ObjectId'];
1839+
/** Email associated with the vendor login */
1840+
email: Scalars['NonEmptyString'];
1841+
/** Password associated with the vendor login */
1842+
password: Scalars['NonEmptyString'];
1843+
};
18161844
/** Token used for a single user update */
18171845
export declare type SingleUseToken = {
18181846
/** Unique identifier */
@@ -2027,6 +2055,8 @@ export declare type VendorToken = {
20272055
vendor: Vendor;
20282056
/** Marketplace associated with the vendor token */
20292057
marketplace: Marketplace;
2058+
/** Email associated with the vendor token */
2059+
email?: Maybe<Scalars['NonEmptyString']>;
20302060
};
20312061
export declare type VendorTokenConnection = {
20322062
/** Collection of this object */
@@ -2044,8 +2074,12 @@ export declare type VendorTokenEdge = {
20442074
};
20452075
/** Vendor token creation input data */
20462076
export declare type VendorTokenInput = {
2047-
/** Id of the vendor */
2077+
/** Id of the vendor associated with the vendor login */
20482078
vendorId: Scalars['ObjectId'];
2079+
/** Email to associate with the vendor login */
2080+
email?: Maybe<Scalars['NonEmptyString']>;
2081+
/** Password to associate with the vendor login */
2082+
password?: Maybe<Scalars['NonEmptyString']>;
20492083
};
20502084
/** Vendor update input data */
20512085
export declare type VendorUpdateInput = {
@@ -2194,6 +2228,8 @@ export declare type ResolversTypes = {
21942228
VendorInput: VendorInput;
21952229
VendorUpdateInput: VendorUpdateInput;
21962230
VendorTokenInput: VendorTokenInput;
2231+
LoginVendorInput: LoginVendorInput;
2232+
SetVendorPasswordInput: SetVendorPasswordInput;
21972233
SingleUseToken: ResolverTypeWrapper<SingleUseToken>;
21982234
SingleUseTokenConnection: ResolverTypeWrapper<SingleUseTokenConnection>;
21992235
SingleUseTokenEdge: ResolverTypeWrapper<SingleUseTokenEdge>;
@@ -2314,6 +2350,8 @@ export declare type ResolversParentTypes = {
23142350
VendorInput: VendorInput;
23152351
VendorUpdateInput: VendorUpdateInput;
23162352
VendorTokenInput: VendorTokenInput;
2353+
LoginVendorInput: LoginVendorInput;
2354+
SetVendorPasswordInput: SetVendorPasswordInput;
23172355
SingleUseToken: SingleUseToken;
23182356
SingleUseTokenConnection: SingleUseTokenConnection;
23192357
SingleUseTokenEdge: SingleUseTokenEdge;
@@ -2641,6 +2679,8 @@ export declare type MutationResolvers<ContextType = any, ParentType extends Reso
26412679
updateVendor?: Resolver<ResolversTypes['Vendor'], ParentType, ContextType, RequireFields<MutationUpdateVendorArgs, 'input' | 'id'>>;
26422680
deleteVendor?: Resolver<ResolversTypes['Deletion'], ParentType, ContextType, RequireFields<MutationDeleteVendorArgs, 'id'>>;
26432681
createVendorToken?: Resolver<ResolversTypes['VendorToken'], ParentType, ContextType, RequireFields<MutationCreateVendorTokenArgs, 'input'>>;
2682+
loginVendor?: Resolver<ResolversTypes['VendorToken'], ParentType, ContextType, RequireFields<MutationLoginVendorArgs, 'input'>>;
2683+
setVendorPassword?: Resolver<ResolversTypes['VendorToken'], ParentType, ContextType, RequireFields<MutationSetVendorPasswordArgs, 'input'>>;
26442684
deleteVendorToken?: Resolver<ResolversTypes['Deletion'], ParentType, ContextType, RequireFields<MutationDeleteVendorTokenArgs, 'id'>>;
26452685
};
26462686
export interface NonEmptyStringScalarConfig extends GraphQLScalarTypeConfig<ResolversTypes['NonEmptyString'], any> {
@@ -2842,6 +2882,7 @@ export declare type VendorTokenResolvers<ContextType = any, ParentType extends R
28422882
token?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
28432883
vendor?: Resolver<ResolversTypes['Vendor'], ParentType, ContextType>;
28442884
marketplace?: Resolver<ResolversTypes['Marketplace'], ParentType, ContextType>;
2885+
email?: Resolver<Maybe<ResolversTypes['NonEmptyString']>, ParentType, ContextType>;
28452886
};
28462887
export declare type VendorTokenConnectionResolvers<ContextType = any, ParentType extends ResolversParentTypes['VendorTokenConnection'] = ResolversParentTypes['VendorTokenConnection']> = {
28472888
edges?: Resolver<Array<ResolversTypes['VendorTokenEdge']>, ParentType, ContextType>;

src/generated/graphql.ts

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,16 @@ export type EntitlementUpdateInput = {
700700
permissions: Array<AuthPermission>;
701701
};
702702

703+
/** Vendor login input data */
704+
export type LoginVendorInput = {
705+
/** Id of the marketplace associated with the vendor login */
706+
marketplaceId: Scalars['ObjectId'];
707+
/** Email associated with the vendor login */
708+
email: Scalars['NonEmptyString'];
709+
/** Password associated with the vendor login */
710+
password: Scalars['NonEmptyString'];
711+
};
712+
703713
/** Marketing ad represents a specific ad on a platform belonging to a marketing campaign and associated with a single vendor */
704714
export type MarketingAd = ResultResource & {
705715
/** Unique identifier */
@@ -1225,6 +1235,10 @@ export type Mutation = {
12251235
deleteVendor: Deletion;
12261236
/** Creates a vendor token using input data */
12271237
createVendorToken: VendorToken;
1238+
/** Login as a vendor */
1239+
loginVendor: VendorToken;
1240+
/** Sets the password of a vendor token */
1241+
setVendorPassword: VendorToken;
12281242
/** Deletes a vendor token identified by a given id */
12291243
deleteVendorToken: Deletion;
12301244
};
@@ -1426,6 +1440,14 @@ export type MutationCreateVendorTokenArgs = {
14261440
input: VendorTokenInput;
14271441
};
14281442

1443+
export type MutationLoginVendorArgs = {
1444+
input: LoginVendorInput;
1445+
};
1446+
1447+
export type MutationSetVendorPasswordArgs = {
1448+
input: SetVendorPasswordInput;
1449+
};
1450+
14291451
export type MutationDeleteVendorTokenArgs = {
14301452
id: Scalars['ObjectId'];
14311453
};
@@ -1998,6 +2020,16 @@ export enum ResultResourceTypeEnum {
19982020
MarketingCampaign = 'MarketingCampaign',
19992021
}
20002022

2023+
/** Vendor reset password input data */
2024+
export type SetVendorPasswordInput = {
2025+
/** Id of the marketplace associated with the vendor login */
2026+
marketplaceId: Scalars['ObjectId'];
2027+
/** Email associated with the vendor login */
2028+
email: Scalars['NonEmptyString'];
2029+
/** Password associated with the vendor login */
2030+
password: Scalars['NonEmptyString'];
2031+
};
2032+
20012033
/** Token used for a single user update */
20022034
export type SingleUseToken = {
20032035
/** Unique identifier */
@@ -2233,6 +2265,8 @@ export type VendorToken = {
22332265
vendor: Vendor;
22342266
/** Marketplace associated with the vendor token */
22352267
marketplace: Marketplace;
2268+
/** Email associated with the vendor token */
2269+
email?: Maybe<Scalars['NonEmptyString']>;
22362270
};
22372271

22382272
export type VendorTokenConnection = {
@@ -2253,8 +2287,12 @@ export type VendorTokenEdge = {
22532287

22542288
/** Vendor token creation input data */
22552289
export type VendorTokenInput = {
2256-
/** Id of the vendor */
2290+
/** Id of the vendor associated with the vendor login */
22572291
vendorId: Scalars['ObjectId'];
2292+
/** Email to associate with the vendor login */
2293+
email?: Maybe<Scalars['NonEmptyString']>;
2294+
/** Password to associate with the vendor login */
2295+
password?: Maybe<Scalars['NonEmptyString']>;
22582296
};
22592297

22602298
/** Vendor update input data */
@@ -2482,6 +2520,8 @@ export type ResolversTypes = {
24822520
VendorInput: VendorInput;
24832521
VendorUpdateInput: VendorUpdateInput;
24842522
VendorTokenInput: VendorTokenInput;
2523+
LoginVendorInput: LoginVendorInput;
2524+
SetVendorPasswordInput: SetVendorPasswordInput;
24852525
SingleUseToken: ResolverTypeWrapper<SingleUseToken>;
24862526
SingleUseTokenConnection: ResolverTypeWrapper<SingleUseTokenConnection>;
24872527
SingleUseTokenEdge: ResolverTypeWrapper<SingleUseTokenEdge>;
@@ -2603,6 +2643,8 @@ export type ResolversParentTypes = {
26032643
VendorInput: VendorInput;
26042644
VendorUpdateInput: VendorUpdateInput;
26052645
VendorTokenInput: VendorTokenInput;
2646+
LoginVendorInput: LoginVendorInput;
2647+
SetVendorPasswordInput: SetVendorPasswordInput;
26062648
SingleUseToken: SingleUseToken;
26072649
SingleUseTokenConnection: SingleUseTokenConnection;
26082650
SingleUseTokenEdge: SingleUseTokenEdge;
@@ -3718,6 +3760,18 @@ export type MutationResolvers<
37183760
ContextType,
37193761
RequireFields<MutationCreateVendorTokenArgs, 'input'>
37203762
>;
3763+
loginVendor?: Resolver<
3764+
ResolversTypes['VendorToken'],
3765+
ParentType,
3766+
ContextType,
3767+
RequireFields<MutationLoginVendorArgs, 'input'>
3768+
>;
3769+
setVendorPassword?: Resolver<
3770+
ResolversTypes['VendorToken'],
3771+
ParentType,
3772+
ContextType,
3773+
RequireFields<MutationSetVendorPasswordArgs, 'input'>
3774+
>;
37213775
deleteVendorToken?: Resolver<
37223776
ResolversTypes['Deletion'],
37233777
ParentType,
@@ -4379,6 +4433,11 @@ export type VendorTokenResolvers<
43794433
ParentType,
43804434
ContextType
43814435
>;
4436+
email?: Resolver<
4437+
Maybe<ResolversTypes['NonEmptyString']>,
4438+
ParentType,
4439+
ContextType
4440+
>;
43824441
};
43834442

43844443
export type VendorTokenConnectionResolvers<

src/index.d.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PageInfo, Scalars, Mutation, Query, SortInput, User, UserLoginInput, UserUpdateInput, RefreshTokenInput, Organization, OrganizationInput, OrganizationUpdateInput, Marketplace, MarketplaceInput, MarketplaceUpdateInput, MediaChannel, MediaChannelCreateInput, MediaChannelUpdateInput, MediaChannelImportInput, CampaignTemplate, Vendor, VendorInput, VendorUpdateInput, VendorToken, VendorTokenInput, Catalog, CatalogCreateInput, CatalogImportInput, CatalogUpdateInput, Product, ProductInput, ProductUpdateInput, MarketingCampaign, MarketingCampaignInput, MarketingCampaignUpdateInput, MarketingAd, Result, Entitlement, EntitlementInput, EntitlementUpdateInput, CreativeFont, CreativeFontCreateInput, CreativeFontUpdateInput, CreativeImage, CreativeImageCreateInput, CreativeImageUpdateInput, CreativeLayer, CreativeLayerCreateInput, CreativeLayerUpdateInput, CreativeTemplate, CreativeTemplateCreateInput, CreativeTemplateUpdateInput, RequestResetPasswordInput, ResetPasswordInput } from './generated/graphql';
1+
import { PageInfo, Scalars, Mutation, Query, SortInput, User, UserLoginInput, UserUpdateInput, RefreshTokenInput, Organization, OrganizationInput, OrganizationUpdateInput, Marketplace, MarketplaceInput, MarketplaceUpdateInput, MediaChannel, MediaChannelCreateInput, MediaChannelUpdateInput, MediaChannelImportInput, CampaignTemplate, Vendor, VendorInput, VendorUpdateInput, VendorToken, VendorTokenInput, SetVendorPasswordInput, LoginVendorInput, Catalog, CatalogCreateInput, CatalogImportInput, CatalogUpdateInput, Product, ProductInput, ProductUpdateInput, MarketingCampaign, MarketingCampaignInput, MarketingCampaignUpdateInput, MarketingAd, Result, Entitlement, EntitlementInput, EntitlementUpdateInput, CreativeFont, CreativeFontCreateInput, CreativeFontUpdateInput, CreativeImage, CreativeImageCreateInput, CreativeImageUpdateInput, CreativeLayer, CreativeLayerCreateInput, CreativeLayerUpdateInput, CreativeTemplate, CreativeTemplateCreateInput, CreativeTemplateUpdateInput, RequestResetPasswordInput, ResetPasswordInput } from './generated/graphql';
22
import { OrganizationField, UserField, RequestResultField, MarketplaceField, MediaChannelField, CampaignTemplateField, VendorField, VendorTokenField, CatalogField, ProductField, MarketingCampaignField, MarketingAdField, ResultField, EntitlementField, CreativeFontField, CreativeImageField, CreativeLayerField, CreativeTemplateField } from './generated/fields';
33
export interface Config {
44
url: string;
@@ -352,6 +352,18 @@ export declare class Cinnamon {
352352
headers?: Headers;
353353
token?: string;
354354
}): Promise<VendorToken>;
355+
loginVendor({ input, fields, headers, token, }: {
356+
input: LoginVendorInput;
357+
fields?: VendorTokenField[];
358+
headers?: Headers;
359+
token?: string;
360+
}): Promise<VendorToken>;
361+
setVendorPassword({ input, fields, headers, token, }: {
362+
input: SetVendorPasswordInput;
363+
fields?: VendorTokenField[];
364+
headers?: Headers;
365+
token?: string;
366+
}): Promise<VendorToken>;
355367
deleteVendorToken({ id, headers, token, }: {
356368
id: Scalars['ObjectId'];
357369
headers?: Headers;

src/index.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ import {
2828
VendorUpdateInput,
2929
VendorToken,
3030
VendorTokenInput,
31+
SetVendorPasswordInput,
32+
LoginVendorInput,
3133
Catalog,
3234
CatalogCreateInput,
3335
CatalogImportInput,
@@ -1566,6 +1568,58 @@ export class Cinnamon {
15661568
).data.createVendorToken;
15671569
}
15681570

1571+
@bind
1572+
async loginVendor({
1573+
input,
1574+
fields = this.defaultVendorTokenFields,
1575+
headers,
1576+
token,
1577+
}: {
1578+
input: LoginVendorInput;
1579+
fields?: VendorTokenField[];
1580+
headers?: Headers;
1581+
token?: string;
1582+
}) {
1583+
return (
1584+
await this.api<'loginVendor'>({
1585+
query: `mutation($input: LoginVendorInput!) {
1586+
loginVendor(input: $input) {
1587+
${fields.join(' ')}
1588+
}
1589+
}`,
1590+
variables: { input },
1591+
headers,
1592+
token,
1593+
})
1594+
).data.loginVendor;
1595+
}
1596+
1597+
@bind
1598+
async setVendorPassword({
1599+
input,
1600+
fields = this.defaultVendorTokenFields,
1601+
headers,
1602+
token,
1603+
}: {
1604+
input: SetVendorPasswordInput;
1605+
fields?: VendorTokenField[];
1606+
headers?: Headers;
1607+
token?: string;
1608+
}) {
1609+
return (
1610+
await this.api<'setVendorPassword'>({
1611+
query: `mutation($input: SetVendorPasswordInput!) {
1612+
setVendorPassword(input: $input) {
1613+
${fields.join(' ')}
1614+
}
1615+
}`,
1616+
variables: { input },
1617+
headers,
1618+
token,
1619+
})
1620+
).data.setVendorPassword;
1621+
}
1622+
15691623
@bind
15701624
async deleteVendorToken({
15711625
id,

0 commit comments

Comments
 (0)