Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vendasta/account-group-sdk

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vendasta/account-group-sdk

Account Group Microservice typescript sdk.

  • 3.3.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

Account Group SDK

This provides a typescript implementation of the account group microservice

Requirements

To setup the sdk you will need to:

Install the sdk to your project

npm install @vendasta/account-group-sdk --save

Next, you will need to import and setup your navigation module (generally in app.module.ts)

import { AccountGroupModule } from "@vendasta/account-group-sdk";
…
@NgModule({
  …
  imports: [
    …, AccountGroupModule, …
  ]
})

External Requirements

The Account Group sdk requires the following vendasta packages to be implemented by the project:

Please follow their instructions on how to set those packages up.

Usage

Inject the AccountGroupService into your component and you will be able to start using it!

import {AccountGroupService} from '@vendasta/account-group-sdk';

@Component({
  selector: '…',
  template: '…',
  styles: '…'
})
export classComponent {
  constructor(private accountGroupService: AccountGroupService) {
  }
}

ProjectionFilters

Every call to the account group microservice requires a ProjectionFilter. A projection filter tells the microservice what data to return. By default all fields are false.

interface ProjectionFilterInterface {
  accounts?: boolean;
  listingDistribution?: boolean;
  listingSyncPro?: boolean;
  associations?: boolean;
  accountGroupExternalIdentifiers?: boolean;
  socialUrls?: boolean;
  hoursOfOperation?: boolean;
  contactDetails?: boolean;
  snapshotReports?: boolean;
  legacyProductDetails?: boolean;
  richData?: boolean;
}

During construction, you can pass in all of the properties you want the api call to return:

import {ProjectionFilter} from '@vendasta/account-group-sdk'

let pf = new ProjectionFilter({accounts: true, socialUrls: true, richData: true});

Or you can call enableAll to return all data.

import {ProjectionFilter} from '@vendasta/account-group-sdk'

let pf = new ProjectionFilter().enableAll();

Lookup

lookup(projectionFilter: ProjectionFilter, marketIds: string[] = null, searchTerm: string = null, filters: LookupFilter = null, pageSize: number = 10): Observable<AccountGroup[]>

Lookup returns many account groups matching the criteria specified. To fetch the next set of paged results from a lookup, call loadMore passing in the same criteria that was used in the original lookup.

loadMore(projectionFilter: ProjectionFilter, marketIds: string[], searchTerm: string, filters: LookupFilter, pageSize: number = 10): Observable<AccountGroup[]>

The list of account groups returned by loadMore will include the previous account groups fetched - there is no need to keep track of the list of account groups in your component.

Lookup provides some helper observables you can subscribe to:

get hasMore(): Observable<boolean> Whether or not there are more account groups to fetch

get accountGroups(): Observable<AccountGroup[]> The current list of account groups fetched

get totalResults(): Observable<number> How many results are there total to fetch

get loading(): Observable<boolean> Whether or not the service is currently talking to the microservice

Get

get(accountGroupId: string, projectionFilter: ProjectionFilter): Observable<AccountGroup>

Fetch a single account group by its ID

GetMulti

getMulti(accountGroupIds: string[], projectionFilter: ProjectionFilter): Observable<AccountGroup[]>

Fetch many account groups by their IDs

BulkUpdate

bulkUpdate(accountGroupId: string, updateOperations: UpdateOperations): Observable<Response>

To use the bulkUpdate function you will need to construct an UpdateOperations object and add the update operations you want to do to the account group.

There are 10 operations to choose from:

  • NapUpdateOperation
  • SnapshotsUpdateOperation
  • ListingDistributionDetailsUpdateOperation
  • ListingSyncProUpdateOperation
  • AccountGroupExternalIdentifiersUpdateOperation
  • SocialURLsUpdateOperation
  • HoursOfOperationUpdateOperation
  • ContactDetailsUpdateOperation
  • LegacyProductDetailsUpdateOperation
  • RichDataUpdateOperation
import {UpdateOperations} from '@vendasta/account-group-sdk'

let operations: UpdateOperations = new UpdateOperations();

operations.addUpdateOperation(new NapUpdateOperation({key: value...}));
operations.addUpdateOperation(new SnapshotsUpdateOperation({key: value...}));
operations.addUpdateOperation(new ListingDistributionDetailsUpdateOperation({key: value...}));
operations.addUpdateOperation(new ListingSyncProUpdateOperation({key: value...}));
operations.addUpdateOperation(new AccountGroupExternalIdentifiersUpdateOperation({key: value...}));
operations.addUpdateOperation(new SocialURLsUpdateOperation({key: value...}));
operations.addUpdateOperation(new HoursOfOperationUpdateOperation({key: value...}));
operations.addUpdateOperation(new ContactDetailsUpdateOperation({key: value...}));
operations.addUpdateOperation(new LegacyProductDetailsUpdateOperation({key: value...}));
operations.addUpdateOperation(new RichDataUpdateOperation({key: value...}));

Only fields specified will be altered on the account group.

FAQs

Package last updated on 21 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc