lincd-quora-ads
Version:
An API wrapper for Quora's Ads API.
86 lines (85 loc) • 3.63 kB
TypeScript
import { Account } from "lincd-ads/lib/shapes/Account";
import { Ad } from "lincd-ads/lib/shapes/Ad";
import { AdSet } from "lincd-ads/lib/shapes/AdSet";
import { Campaign } from "lincd-ads/lib/shapes/Campaign";
import { API } from "lincd-rest-api/lib/shapes/API";
import { NamedNode } from "lincd/lib/models";
import { QuoraOptions, ResolvedQuoraResponse } from "../interfaces";
export declare class QuoraAPI extends API {
/**
* indicates that instances of this shape need to have this rdf.type
*/
static targetClass: NamedNode;
processResponse: (r: Response) => void;
constructor(node?: any);
constructor(accessToken: string, refreshToken: string);
/**
* Helper method for generating URL-ready parameters from
* given options.
*
* This is unique to Quora, and may vary from API to API.
* To make this, I looked through the docs to see exactly
* what params can be used in the docs: https://t.ly/DJveM
*
* @param options
* @returns A URL-ready string with the provided `options`
*/
generateParamsFromOptions(options?: QuoraOptions): string;
/**
* Fetches an ad belonging to the authorised client.
* @param adId
* @param options
* @returns
*/
getAd(adId: number, options?: QuoraOptions): Promise<Ad>;
/**
* Retrieve a single ad set by its ID.
* @param adSetId The ID belonging to the ad set to fetch
* @param options Any extra options to add to the search
* @returns A shape of the request ad
*/
getAdSet(adSetId: number, options?: QuoraOptions): Promise<AdSet>;
/**
* Retrieve a single campaign by its ID
* @param campaignId The ID by which to search for the data
* @param options Any extra options to search by
* @returns The populated campaign shape
*/
getCampaign(campaignId: number, options?: QuoraOptions): Promise<Campaign>;
getAdSetsFromCampaign(campaignId: number, options?: QuoraOptions): Promise<AdSet[]>;
/**
* Default options for this method are ``{
* fields: ["adId"]
* level: "AD"
* }`` as these are the bare minimum required for the endpoint to
* return meaningful data and construct shapes.
*
* @param adSetId The ID of the Ad Set from which to collect ads
* @param options Any additional options to be applied to the defaults
* @returns An array of Ad shape instances
*/
getAdsFromAdSet(adSetId: number, options?: QuoraOptions): Promise<Ad[]>;
/**
* Default options for this method are ``{
* fields: ["adId"]
* level: "AD"
* }`` as these are the bare minimum required for the endpoint to
* return meaningful data and construct shapes.
*
* @param campaignId The ID of the campaign from which to collect ads
* @param options Any additional options to be applied to the defaults
* @returns An array of Ad shape instances
*/
getAdsFromCampaign(campaignId: number, options?: QuoraOptions): Promise<Ad[]>;
getAllAccounts(): Promise<Account[]>;
getCampaignsFromAccount(accountId: number, options?: QuoraOptions, returnOriginalJSON?: boolean): Promise<Campaign[] | [Campaign[], ResolvedQuoraResponse]>;
refreshAccessToken(): Promise<void>;
get accessToken(): string;
set accessToken(val: string);
get clientId(): string;
set clientId(val: string);
get clientSecret(): string;
set clientSecret(val: string);
get refreshToken(): string;
set refreshToken(val: string);
}