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

ArrowSphere / nodejs-api-client / #8778

03 Jul 2025 08:53AM UTC coverage: 95.265% (+0.1%) from 95.168%
#8778

push

bdjonkamla
chore(package): version 3.204.0

1391 of 1523 branches covered (91.33%)

Branch coverage included in aggregate %.

7159 of 7452 relevant lines covered (96.07%)

7.63 hits per line

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

94.74
/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 AdminSubscriptionsListData = {
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 PartnerSubscriptionsListData = {
36
  data: Array<PartnerSubscription>;
37
  status: number;
38
};
39

40
export type PartnerSubscription = {
41
  reference: string;
42
  name: string;
43
  status: string;
44
  dateDemand: string;
45
  dateValidation: string | null;
46
  dateEnd: string | null;
47
  level: string | null;
48
  error_msg: string | null;
49
  details: {
50
    partnerId: string;
51
  };
52
  extraInformation: {
53
    programs: Record<
54
      string,
55
      {
56
        partnerId: string;
57
      }
58
    >;
59
  };
60
};
61

62
export type SubscriptionCreationData = {
63
  name: string;
64
  level: string;
65
  sku: string;
66
  extraInformation?: {
67
    programs: {
68
      [programName: string]: Record<string, string | boolean>;
69
    };
70
  };
71
};
72

73
export type CreateSubscriptionData = {
74
  reference: string;
75
  subscription: SubscriptionData;
76
};
77

78
export class SubscriptionsClient extends AbstractRestfulClient {
1✔
79
  /**
80
   * The base path of the API
81
   */
82
  protected basePath = '/subscriptions';
2✔
83

84
  /**
85
   * The path of the List endpoint
86
   */
87
  private LIST_PATH = '';
2✔
88

89
  /**
90
   * Pagination for these endpoints are camel cased (`&perPage=x` instead of `&per_page=x`)
91
   */
92
  protected isCamelPagination = true;
2✔
93

94
  /**
95
   * @deprecated use listAdmin instead
96
   * Calls the admin subscriptions API list endpoint
97
   *
98
   * @param data - List payload
99
   *
100
   * @returns Promise\<AxiosResponse\<{@link AdminSubscriptionsListData}\>\>   */
101
  public async listRaw(
102
    data: SubscriptionsListPayload = {},
1✔
103
  ): Promise<AdminSubscriptionsListData> {
104
    this.path = this.LIST_PATH;
8✔
105
    return this.get<AdminSubscriptionsListData>(data, {}, { isAdmin: true });
8✔
106
  }
107

108
  /**
109
   * Lists subscriptions and returns a SubscriptionsListResult to manipulate the results.
110
   *
111
   * Note: This endpoint requires an admin token to be called
112
   *
113
   * @param filters - List payload
114
   * @param perPage - Number of results per page
115
   * @param page - Page number to fetch
116
   *
117
   * @returns Promise\<{@link SubscriptionsListResult}\>
118
   *
119
   */
120
  public async list(
121
    filters: SubscriptionsListPayload = {},
1✔
122
  ): Promise<PartnerSubscriptionsListData> {
123
    return this.get<PartnerSubscriptionsListData>(
1✔
124
      filters,
125
      {},
126
      { isAdmin: false },
127
    );
128
  }
129

130
  public async listAdmin(
131
    filters: SubscriptionsListPayload = {},
4✔
132
    perPage = 100,
3✔
133
    page = 1,
3✔
134
  ) {
135
    this.setPerPage(perPage);
4✔
136
    this.setPage(page);
4✔
137

138
    const response = await this.listRaw(filters);
4✔
139

140
    return new SubscriptionsListResult(response, this, filters);
4✔
141
  }
142

143
  public async addSubscription(
144
    filters: SubscriptionCreationData,
145
  ): Promise<CreateSubscriptionData> {
146
    return this.post(filters);
×
147
  }
148
}
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