• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ArrowSphere / nodejs-api-client / #8427

29 Apr 2025 09:49AM UTC coverage: 95.172% (-0.1%) from 95.302%
#8427

push

pehupehu
chore(package): version 3.192.0

1353 of 1484 branches covered (91.17%)

Branch coverage included in aggregate %.

7006 of 7299 relevant lines covered (95.99%)

7.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.12
/src/subscriptions/subscriptionsClient.ts
1
/**
2
 * Class SubscriptionsClient
3
 */
4
import { AbstractRestfulClient } from '../abstractRestfulClient';
1✔
5
import { SubscriptionData } from './entities/subscription';
6
import { SubscriptionsListResult } from './entities/subscriptionsListResult';
1✔
7

8
export type SubscriptionsListPayload = {
9
  subscription?: string[];
10
  status?: string[];
11
  partnerTag?: string[];
12
  marketplace?: string[];
13
  company?: string[];
14
  startDate?: string;
15
  endingDate?: string;
16
  lastUpdate?: string;
17
  perPage?: string;
18
  page?: string;
19
  sortBy?: string;
20
  sortDirection?: 'ASC' | 'DESC';
21
};
22

23
export type SubscriptionsListData = {
24
  data: Array<SubscriptionData>;
25
  pagination: {
26
    perPage: number;
27
    currentPage: number;
28
    totalPage: number;
29
    total: number;
30
    next: string;
31
    previous: string;
32
  };
33
};
34

35
export type SubscriptionCreationData = {
36
  name: string;
37
  level: string;
38
  sku: string;
39
  extraInformation?: {
40
    programs: {
41
      [programName: string]: Record<string, string | boolean>;
42
    };
43
  };
44
};
45

46
export class SubscriptionsClient extends AbstractRestfulClient {
1✔
47
  /**
48
   * The base path of the API
49
   */
50
  protected basePath = '/subscriptions';
2✔
51

52
  /**
53
   * The path of the List endpoint
54
   */
55
  private LIST_PATH = '';
2✔
56

57
  /**
58
   * Pagination for these endpoints are camel cased (`&perPage=x` instead of `&per_page=x`)
59
   */
60
  protected isCamelPagination = true;
2✔
61

62
  /**
63
   * Calls the subscriptions API list endpoint
64
   *
65
   * @param data - List payload
66
   *
67
   * @returns Promise\<AxiosResponse\<{@link SubscriptionsListData}\>\>   */
68
  public async listRaw(
69
    data: SubscriptionsListPayload = {},
1✔
70
  ): Promise<SubscriptionsListData> {
71
    this.path = this.LIST_PATH;
8✔
72
    return this.get<SubscriptionsListData>(data, {}, { isAdmin: true });
8✔
73
  }
74

75
  /**
76
   * Lists subscriptions and returns a SubscriptionsListResult to manipulate the results.
77
   *
78
   * Note: This endpoint requires an admin token to be called
79
   *
80
   * @param postData - List payload
81
   * @param perPage - Number of results per page
82
   * @param page - Page number to fetch
83
   *
84
   * @returns Promise\<{@link SubscriptionsListResult}\>
85
   *
86
   */
87
  public async list(
88
    postData: SubscriptionsListPayload = {},
4✔
89
    perPage = 100,
3✔
90
    page = 1,
3✔
91
  ): Promise<SubscriptionsListResult> {
92
    this.setPerPage(perPage);
4✔
93
    this.setPage(page);
4✔
94

95
    const response = await this.listRaw(postData);
4✔
96

97
    return new SubscriptionsListResult(response, this, postData);
4✔
98
  }
99

100
  public async addSubscription(
101
    postData: SubscriptionCreationData,
102
  ): Promise<void> {
103
    return this.post(postData);
×
104
  }
105
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc