@gigadrive/sdk 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -48,6 +48,8 @@ __export(src_exports, {
48
48
  GigadriveError: () => GigadriveError,
49
49
  OrganizationAiGatewayResource: () => OrganizationAiGatewayResource,
50
50
  OrganizationEnvVarsResource: () => OrganizationEnvVarsResource,
51
+ OrganizationMembersResource: () => OrganizationMembersResource,
52
+ OrganizationProductsResource: () => OrganizationProductsResource,
51
53
  OrganizationsResource: () => OrganizationsResource,
52
54
  StorageBucketsResource: () => StorageBucketsResource,
53
55
  StorageObjectsResource: () => StorageObjectsResource,
@@ -2088,6 +2090,83 @@ var OrganizationEnvVarsResource = class extends BaseResource {
2088
2090
  }
2089
2091
  };
2090
2092
 
2093
+ // src/resources/organization-members.ts
2094
+ var OrganizationMembersResource = class extends BaseResource {
2095
+ /**
2096
+ * List the users who belong to an organization.
2097
+ *
2098
+ * @param organizationId - Organization whose members should be listed.
2099
+ * @param query - Optional pagination.
2100
+ * @returns A paginated list of organization members.
2101
+ *
2102
+ * @example
2103
+ * ```ts
2104
+ * const { items, total } = await client.organizations.members.list('org-id');
2105
+ * console.log(`Found ${total} members`);
2106
+ * ```
2107
+ */
2108
+ async list(organizationId, query) {
2109
+ return this.httpClient.get(`/organizations/${organizationId}/members`, {
2110
+ query
2111
+ });
2112
+ }
2113
+ };
2114
+
2115
+ // src/resources/organization-products.ts
2116
+ var OrganizationProductsResource = class extends BaseResource {
2117
+ /**
2118
+ * List effective product access for every organization-scoped product.
2119
+ *
2120
+ * @param organizationId - Organization whose product access should be listed.
2121
+ * @param query - Optional pagination.
2122
+ * @returns A paginated list of product access summaries.
2123
+ *
2124
+ * @example
2125
+ * ```ts
2126
+ * const { items } = await client.organizations.products.list('org-id');
2127
+ * for (const item of items) {
2128
+ * console.log(item.product.slug, item.hasAccess);
2129
+ * }
2130
+ * ```
2131
+ */
2132
+ async list(organizationId, query) {
2133
+ return this.httpClient.get(`/organizations/${organizationId}/products`, {
2134
+ query
2135
+ });
2136
+ }
2137
+ /**
2138
+ * Get effective access for one organization-scoped product.
2139
+ *
2140
+ * @param organizationId - Organization to inspect.
2141
+ * @param product - Product slug from the product registry.
2142
+ * @returns Product access summary including entitlement and subscription state.
2143
+ *
2144
+ * @example
2145
+ * ```ts
2146
+ * const access = await client.organizations.products.get('org-id', 'office');
2147
+ * console.log(access.hasAccess, access.subscription?.plan);
2148
+ * ```
2149
+ */
2150
+ async get(organizationId, product) {
2151
+ return this.httpClient.get(`/organizations/${organizationId}/products/${product}`);
2152
+ }
2153
+ /**
2154
+ * Check whether an organization currently has access to a product.
2155
+ *
2156
+ * @param organizationId - Organization to check.
2157
+ * @param product - Product slug from the product registry.
2158
+ * @returns Compact entitlement check result.
2159
+ *
2160
+ * @example
2161
+ * ```ts
2162
+ * const { hasAccess } = await client.organizations.products.checkEntitlement('org-id', 'network');
2163
+ * ```
2164
+ */
2165
+ async checkEntitlement(organizationId, product) {
2166
+ return this.httpClient.get(`/organizations/${organizationId}/products/${product}/entitlement`);
2167
+ }
2168
+ };
2169
+
2091
2170
  // src/resources/organizations.ts
2092
2171
  var OrganizationsResource = class extends BaseResource {
2093
2172
  /**
@@ -2118,10 +2197,31 @@ var OrganizationsResource = class extends BaseResource {
2118
2197
  * ```
2119
2198
  */
2120
2199
  aiGateway;
2200
+ /**
2201
+ * List organization members and membership roles.
2202
+ *
2203
+ * @example
2204
+ * ```ts
2205
+ * const { items } = await client.organizations.members.list('org-id');
2206
+ * ```
2207
+ */
2208
+ members;
2209
+ /**
2210
+ * Inspect organization product entitlements. Read-only through the public
2211
+ * API — plan changes happen in Gigadrive product surfaces, not via the SDK.
2212
+ *
2213
+ * @example
2214
+ * ```ts
2215
+ * const check = await client.organizations.products.checkEntitlement('org-id', 'office');
2216
+ * ```
2217
+ */
2218
+ products;
2121
2219
  constructor(...args) {
2122
2220
  super(...args);
2123
2221
  this.envVars = new OrganizationEnvVarsResource(this.httpClient);
2124
2222
  this.aiGateway = new OrganizationAiGatewayResource(this.httpClient);
2223
+ this.members = new OrganizationMembersResource(this.httpClient);
2224
+ this.products = new OrganizationProductsResource(this.httpClient);
2125
2225
  }
2126
2226
  /**
2127
2227
  * List organizations the authenticated actor has access to.
@@ -2140,6 +2240,39 @@ var OrganizationsResource = class extends BaseResource {
2140
2240
  query
2141
2241
  });
2142
2242
  }
2243
+ /**
2244
+ * Get a single organization by ID.
2245
+ *
2246
+ * @param organizationId - Organization to retrieve.
2247
+ * @returns The organization.
2248
+ *
2249
+ * @example
2250
+ * ```ts
2251
+ * const org = await client.organizations.get('org-id');
2252
+ * console.log(org.name, org.slug);
2253
+ * ```
2254
+ */
2255
+ async get(organizationId) {
2256
+ return this.httpClient.get(`/organizations/${organizationId}`);
2257
+ }
2258
+ /**
2259
+ * Create a new organization.
2260
+ *
2261
+ * Requires a user-backed token with the `platform:organizations:write` scope.
2262
+ * The authenticated user becomes the organization owner.
2263
+ *
2264
+ * @param input - Organization creation input.
2265
+ * @returns The created organization.
2266
+ *
2267
+ * @example
2268
+ * ```ts
2269
+ * const org = await client.organizations.create({ name: 'Acme Corp' });
2270
+ * console.log(org.id, org.slug);
2271
+ * ```
2272
+ */
2273
+ async create(input) {
2274
+ return this.httpClient.post("/organizations", input);
2275
+ }
2143
2276
  };
2144
2277
 
2145
2278
  // src/client.ts
@@ -2200,6 +2333,8 @@ async function* paginate(fetchPage) {
2200
2333
  GigadriveError,
2201
2334
  OrganizationAiGatewayResource,
2202
2335
  OrganizationEnvVarsResource,
2336
+ OrganizationMembersResource,
2337
+ OrganizationProductsResource,
2203
2338
  OrganizationsResource,
2204
2339
  StorageBucketsResource,
2205
2340
  StorageObjectsResource,