-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
GetLinkedInstagramAccountRequest.ts
46 lines (42 loc) · 1.35 KB
/
GetLinkedInstagramAccountRequest.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { AxiosResponse } from 'axios';
import { AbstractRequest } from '../../AbstractRequest';
import { GetLinkedInstagramAccountResponse } from './GetLinkedInstagramAccountResponse';
/**
* A Get request to obtain instagram_business_account information related with
* a Facebook page
*
* @author Andres Gutierrez <andres99@gmail.com>
* @since 2.0.0
*/
export class GetLinkedInstagramAccountRequest extends AbstractRequest<GetLinkedInstagramAccountResponse> {
/**
* The Facebook page id.
*
* A business Instagram account has to be linked to a Facebook page. To get the id
* of an Instagram account you need the id of their linked Facebook page.
*/
facebookPageId: string;
/**
* The constructor.
*
* @param accessToken the access token.
* @param facebookPageId the facebook page id.
*/
constructor(accessToken: string, facebookPageId: string) {
super(accessToken);
this.facebookPageId = facebookPageId;
this.params.fields = 'instagram_business_account';
}
/**
* @inheritdoc
*/
protected parseResponse(response: AxiosResponse<never>): GetLinkedInstagramAccountResponse {
return new GetLinkedInstagramAccountResponse(response.data);
}
/**
* @inheritdoc
*/
protected url(): string {
return `/${this.facebookPageId}`;
}
}