@tembo-io/sdk 0.0.2 → 0.0.5

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.
Files changed (127) hide show
  1. package/CHANGELOG.md +27 -1
  2. package/LICENSE +1 -1
  3. package/README.md +41 -36
  4. package/client.d.mts +18 -15
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +18 -15
  7. package/client.d.ts.map +1 -1
  8. package/client.js +41 -38
  9. package/client.js.map +1 -1
  10. package/client.mjs +40 -37
  11. package/client.mjs.map +1 -1
  12. package/core/api-promise.d.mts +2 -2
  13. package/core/api-promise.d.mts.map +1 -1
  14. package/core/api-promise.d.ts +2 -2
  15. package/core/api-promise.d.ts.map +1 -1
  16. package/core/api-promise.js.map +1 -1
  17. package/core/api-promise.mjs.map +1 -1
  18. package/core/error.d.mts +2 -2
  19. package/core/error.d.mts.map +1 -1
  20. package/core/error.d.ts +2 -2
  21. package/core/error.d.ts.map +1 -1
  22. package/core/error.js +4 -4
  23. package/core/error.js.map +1 -1
  24. package/core/error.mjs +2 -2
  25. package/core/error.mjs.map +1 -1
  26. package/core/resource.d.mts +3 -3
  27. package/core/resource.d.mts.map +1 -1
  28. package/core/resource.d.ts +3 -3
  29. package/core/resource.d.ts.map +1 -1
  30. package/core/resource.js.map +1 -1
  31. package/core/resource.mjs.map +1 -1
  32. package/index.d.mts +3 -3
  33. package/index.d.mts.map +1 -1
  34. package/index.d.ts +3 -3
  35. package/index.d.ts.map +1 -1
  36. package/index.js +4 -4
  37. package/index.js.map +1 -1
  38. package/index.mjs +3 -3
  39. package/index.mjs.map +1 -1
  40. package/internal/parse.d.mts +2 -2
  41. package/internal/parse.d.mts.map +1 -1
  42. package/internal/parse.d.ts +2 -2
  43. package/internal/parse.d.ts.map +1 -1
  44. package/internal/parse.js.map +1 -1
  45. package/internal/parse.mjs.map +1 -1
  46. package/internal/shims.js +1 -1
  47. package/internal/shims.js.map +1 -1
  48. package/internal/shims.mjs +1 -1
  49. package/internal/shims.mjs.map +1 -1
  50. package/internal/uploads.d.mts +4 -4
  51. package/internal/uploads.d.mts.map +1 -1
  52. package/internal/uploads.d.ts +4 -4
  53. package/internal/uploads.d.ts.map +1 -1
  54. package/internal/uploads.js.map +1 -1
  55. package/internal/uploads.mjs.map +1 -1
  56. package/internal/utils/base64.js +2 -2
  57. package/internal/utils/base64.js.map +1 -1
  58. package/internal/utils/base64.mjs +3 -3
  59. package/internal/utils/base64.mjs.map +1 -1
  60. package/internal/utils/log.d.mts +3 -3
  61. package/internal/utils/log.d.mts.map +1 -1
  62. package/internal/utils/log.d.ts +3 -3
  63. package/internal/utils/log.d.ts.map +1 -1
  64. package/internal/utils/log.js.map +1 -1
  65. package/internal/utils/log.mjs.map +1 -1
  66. package/internal/utils/path.js +1 -1
  67. package/internal/utils/path.js.map +1 -1
  68. package/internal/utils/path.mjs +2 -2
  69. package/internal/utils/path.mjs.map +1 -1
  70. package/internal/utils/values.js +5 -5
  71. package/internal/utils/values.js.map +1 -1
  72. package/internal/utils/values.mjs +6 -6
  73. package/internal/utils/values.mjs.map +1 -1
  74. package/package.json +3 -3
  75. package/resources/index.d.mts +3 -2
  76. package/resources/index.d.mts.map +1 -1
  77. package/resources/index.d.ts +3 -2
  78. package/resources/index.d.ts.map +1 -1
  79. package/resources/index.js +3 -1
  80. package/resources/index.js.map +1 -1
  81. package/resources/index.mjs +2 -1
  82. package/resources/index.mjs.map +1 -1
  83. package/resources/me.d.mts +23 -0
  84. package/resources/me.d.mts.map +1 -0
  85. package/resources/me.d.ts +23 -0
  86. package/resources/me.d.ts.map +1 -0
  87. package/resources/me.js +15 -0
  88. package/resources/me.js.map +1 -0
  89. package/resources/me.mjs +11 -0
  90. package/resources/me.mjs.map +1 -0
  91. package/resources/repository.d.mts +79 -1
  92. package/resources/repository.d.mts.map +1 -1
  93. package/resources/repository.d.ts +79 -1
  94. package/resources/repository.d.ts.map +1 -1
  95. package/resources/repository.js +1 -5
  96. package/resources/repository.js.map +1 -1
  97. package/resources/repository.mjs +1 -5
  98. package/resources/repository.mjs.map +1 -1
  99. package/resources/task.d.mts +107 -9
  100. package/resources/task.d.mts.map +1 -1
  101. package/resources/task.d.ts +107 -9
  102. package/resources/task.d.ts.map +1 -1
  103. package/resources/task.js +20 -16
  104. package/resources/task.js.map +1 -1
  105. package/resources/task.mjs +20 -16
  106. package/resources/task.mjs.map +1 -1
  107. package/src/client.ts +41 -25
  108. package/src/core/api-promise.ts +4 -4
  109. package/src/core/error.ts +2 -2
  110. package/src/core/resource.ts +3 -3
  111. package/src/index.ts +3 -3
  112. package/src/internal/parse.ts +2 -2
  113. package/src/internal/shims.ts +1 -1
  114. package/src/internal/uploads.ts +5 -5
  115. package/src/internal/utils/base64.ts +3 -3
  116. package/src/internal/utils/log.ts +3 -3
  117. package/src/internal/utils/path.ts +2 -2
  118. package/src/internal/utils/values.ts +6 -6
  119. package/src/resources/index.ts +11 -2
  120. package/src/resources/me.ts +30 -0
  121. package/src/resources/repository.ts +94 -6
  122. package/src/resources/task.ts +152 -26
  123. package/src/version.ts +1 -1
  124. package/version.d.mts +1 -1
  125. package/version.d.ts +1 -1
  126. package/version.js +1 -1
  127. package/version.mjs +1 -1
@@ -1,4 +1,4 @@
1
- import { TemboSDKError } from '../../core/error';
1
+ import { TemboError } from '../../core/error';
2
2
 
3
3
  /**
4
4
  * Percent-encode everything that isn't safe to have in a path without encoding safe chars.
@@ -72,7 +72,7 @@ export const createPathTagFunction = (pathEncoder = encodeURIPath) =>
72
72
  return acc + spaces + arrows;
73
73
  }, '');
74
74
 
75
- throw new TemboSDKError(
75
+ throw new TemboError(
76
76
  `Path parameters result in path with invalid segments:\n${invalidSegments
77
77
  .map((e) => e.error)
78
78
  .join('\n')}\n${path}\n${underline}`,
@@ -1,6 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { TemboSDKError } from '../../core/error';
3
+ import { TemboError } from '../../core/error';
4
4
 
5
5
  // https://url.spec.whatwg.org/#url-scheme-string
6
6
  const startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i;
@@ -39,7 +39,7 @@ export function isObj(obj: unknown): obj is Record<string, unknown> {
39
39
 
40
40
  export const ensurePresent = <T>(value: T | null | undefined): T => {
41
41
  if (value == null) {
42
- throw new TemboSDKError(`Expected a value to be given but received ${value} instead.`);
42
+ throw new TemboError(`Expected a value to be given but received ${value} instead.`);
43
43
  }
44
44
 
45
45
  return value;
@@ -47,10 +47,10 @@ export const ensurePresent = <T>(value: T | null | undefined): T => {
47
47
 
48
48
  export const validatePositiveInteger = (name: string, n: unknown): number => {
49
49
  if (typeof n !== 'number' || !Number.isInteger(n)) {
50
- throw new TemboSDKError(`${name} must be an integer`);
50
+ throw new TemboError(`${name} must be an integer`);
51
51
  }
52
52
  if (n < 0) {
53
- throw new TemboSDKError(`${name} must be a positive integer`);
53
+ throw new TemboError(`${name} must be a positive integer`);
54
54
  }
55
55
  return n;
56
56
  };
@@ -59,14 +59,14 @@ export const coerceInteger = (value: unknown): number => {
59
59
  if (typeof value === 'number') return Math.round(value);
60
60
  if (typeof value === 'string') return parseInt(value, 10);
61
61
 
62
- throw new TemboSDKError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
62
+ throw new TemboError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
63
63
  };
64
64
 
65
65
  export const coerceFloat = (value: unknown): number => {
66
66
  if (typeof value === 'number') return value;
67
67
  if (typeof value === 'string') return parseFloat(value);
68
68
 
69
- throw new TemboSDKError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
69
+ throw new TemboError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
70
70
  };
71
71
 
72
72
  export const coerceBoolean = (value: unknown): boolean => {
@@ -1,4 +1,13 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- export { Repository } from './repository';
4
- export { Task, type TaskCreateParams, type TaskListParams, type TaskSearchParams } from './task';
3
+ export { Me, type MeRetrieveResponse } from './me';
4
+ export { Repository, type RepositoryListResponse } from './repository';
5
+ export {
6
+ Task,
7
+ type TaskCreateResponse,
8
+ type TaskListResponse,
9
+ type TaskSearchResponse,
10
+ type TaskCreateParams,
11
+ type TaskListParams,
12
+ type TaskSearchParams,
13
+ } from './task';
@@ -0,0 +1,30 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { RequestOptions } from '../internal/request-options';
6
+
7
+ export class Me extends APIResource {
8
+ /**
9
+ * Get information about the current authenticated user
10
+ */
11
+ retrieve(options?: RequestOptions): APIPromise<MeRetrieveResponse> {
12
+ return this._client.get('/me', options);
13
+ }
14
+ }
15
+
16
+ export interface MeRetrieveResponse {
17
+ /**
18
+ * Organization ID for the authenticated user
19
+ */
20
+ orgId: string | null;
21
+
22
+ /**
23
+ * User ID for the authenticated user
24
+ */
25
+ userId: string | null;
26
+ }
27
+
28
+ export declare namespace Me {
29
+ export { type MeRetrieveResponse as MeRetrieveResponse };
30
+ }
@@ -2,17 +2,105 @@
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
4
  import { APIPromise } from '../core/api-promise';
5
- import { buildHeaders } from '../internal/headers';
6
5
  import { RequestOptions } from '../internal/request-options';
7
6
 
8
7
  export class Repository extends APIResource {
9
8
  /**
10
9
  * Gets a list of enabled code repositories for the organization
11
10
  */
12
- list(options?: RequestOptions): APIPromise<void> {
13
- return this._client.get('/repository/list', {
14
- ...options,
15
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
16
- });
11
+ list(options?: RequestOptions): APIPromise<RepositoryListResponse> {
12
+ return this._client.get('/repository/list', options);
17
13
  }
18
14
  }
15
+
16
+ export interface RepositoryListResponse {
17
+ /**
18
+ * Array of enabled code repositories for the organization
19
+ */
20
+ codeRepositories: Array<RepositoryListResponse.CodeRepository>;
21
+ }
22
+
23
+ export namespace RepositoryListResponse {
24
+ export interface CodeRepository {
25
+ /**
26
+ * Unique identifier for the code repository
27
+ */
28
+ id: string;
29
+
30
+ /**
31
+ * Timestamp when the repository record was created
32
+ */
33
+ createdAt: string;
34
+
35
+ /**
36
+ * Timestamp when the repository was enabled
37
+ */
38
+ enabledAt: string;
39
+
40
+ /**
41
+ * Name of the repository
42
+ */
43
+ name: string;
44
+
45
+ /**
46
+ * Organization ID that owns this repository
47
+ */
48
+ organizationId: string;
49
+
50
+ /**
51
+ * Timestamp when the repository record was last updated
52
+ */
53
+ updatedAt: string;
54
+
55
+ /**
56
+ * Default branch name
57
+ */
58
+ branch?: string;
59
+
60
+ /**
61
+ * Repository description
62
+ */
63
+ description?: string;
64
+
65
+ /**
66
+ * Associated integration details
67
+ */
68
+ integration?: CodeRepository.Integration;
69
+
70
+ /**
71
+ * Repository URL
72
+ */
73
+ url?: string;
74
+ }
75
+
76
+ export namespace CodeRepository {
77
+ /**
78
+ * Associated integration details
79
+ */
80
+ export interface Integration {
81
+ /**
82
+ * Unique identifier for the integration
83
+ */
84
+ id: string;
85
+
86
+ /**
87
+ * Integration configuration settings
88
+ */
89
+ configuration: { [key: string]: unknown };
90
+
91
+ /**
92
+ * Name of the integration
93
+ */
94
+ name: string;
95
+
96
+ /**
97
+ * Type of integration (e.g., github, gitlab)
98
+ */
99
+ type: string;
100
+ }
101
+ }
102
+ }
103
+
104
+ export declare namespace Repository {
105
+ export { type RepositoryListResponse as RepositoryListResponse };
106
+ }
@@ -2,76 +2,202 @@
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
4
  import { APIPromise } from '../core/api-promise';
5
- import { buildHeaders } from '../internal/headers';
6
5
  import { RequestOptions } from '../internal/request-options';
7
6
 
8
7
  export class Task extends APIResource {
9
8
  /**
10
9
  * Create a user-supplied task
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const task = await client.task.create();
14
+ * ```
11
15
  */
12
- create(body: TaskCreateParams, options?: RequestOptions): APIPromise<void> {
13
- return this._client.post('/task/create', {
14
- body,
15
- ...options,
16
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
17
- });
16
+ create(body: TaskCreateParams, options?: RequestOptions): APIPromise<TaskCreateResponse> {
17
+ return this._client.post('/task/create', { body, ...options });
18
18
  }
19
19
 
20
20
  /**
21
21
  * Gets a paginated list of issues for the organization
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * const tasks = await client.task.list();
26
+ * ```
22
27
  */
23
- list(query: TaskListParams | null | undefined = {}, options?: RequestOptions): APIPromise<void> {
24
- return this._client.get('/task/list', {
25
- query,
26
- ...options,
27
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
28
- });
28
+ list(
29
+ query: TaskListParams | null | undefined = {},
30
+ options?: RequestOptions,
31
+ ): APIPromise<TaskListResponse> {
32
+ return this._client.get('/task/list', { query, ...options });
29
33
  }
30
34
 
31
35
  /**
32
36
  * Search issues for the organization with pagination
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const response = await client.task.search({
41
+ * q: 'authentication bug',
42
+ * });
43
+ * ```
33
44
  */
34
- search(query: TaskSearchParams, options?: RequestOptions): APIPromise<void> {
35
- return this._client.get('/task/search', {
36
- query,
37
- ...options,
38
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
39
- });
45
+ search(query: TaskSearchParams, options?: RequestOptions): APIPromise<TaskSearchResponse> {
46
+ return this._client.get('/task/search', { query, ...options });
40
47
  }
41
48
  }
42
49
 
43
- export interface TaskCreateParams {
44
- json: string;
50
+ export interface TaskCreateResponse {
51
+ id: string;
45
52
 
46
- agent?: string;
53
+ createdAt: string;
47
54
 
48
- branch?: string | null;
55
+ description: string;
56
+
57
+ organizationId: string;
58
+
59
+ status: string;
60
+
61
+ title: string;
62
+
63
+ updatedAt: string;
64
+ }
65
+
66
+ export interface TaskListResponse {
67
+ issues: Array<TaskListResponse.Issue>;
68
+
69
+ meta: TaskListResponse.Meta;
70
+ }
71
+
72
+ export namespace TaskListResponse {
73
+ export interface Issue {
74
+ id: string;
75
+
76
+ createdAt: string;
77
+
78
+ description: string;
79
+
80
+ organizationId: string;
81
+
82
+ status: string;
83
+
84
+ title: string;
85
+
86
+ updatedAt: string;
87
+ }
88
+
89
+ export interface Meta {
90
+ currentPage: number;
91
+
92
+ hasNext: boolean;
93
+
94
+ hasPrevious: boolean;
95
+
96
+ pageSize: number;
97
+
98
+ totalCount: number;
99
+
100
+ totalPages: number;
101
+ }
102
+ }
103
+
104
+ export interface TaskSearchResponse {
105
+ issues: Array<TaskSearchResponse.Issue>;
106
+
107
+ meta: TaskSearchResponse.Meta;
108
+
109
+ query: string;
110
+ }
111
+
112
+ export namespace TaskSearchResponse {
113
+ export interface Issue {
114
+ id: string;
115
+
116
+ createdAt: string;
117
+
118
+ description: string;
49
119
 
50
- codeRepoIds?: Array<string>;
120
+ organizationId: string;
51
121
 
52
- description?: string;
122
+ status: string;
53
123
 
124
+ title: string;
125
+
126
+ updatedAt: string;
127
+ }
128
+
129
+ export interface Meta {
130
+ currentPage: number;
131
+
132
+ hasNext: boolean;
133
+
134
+ hasPrevious: boolean;
135
+
136
+ pageSize: number;
137
+
138
+ totalCount: number;
139
+
140
+ totalPages: number;
141
+ }
142
+ }
143
+
144
+ export interface TaskCreateParams {
145
+ /**
146
+ * Specific git branch to target for this task
147
+ */
148
+ branch?: string | null;
149
+
150
+ /**
151
+ * Brief description of the task to be performed
152
+ */
54
153
  prompt?: string;
55
154
 
56
- queueRightAway?: boolean;
155
+ /**
156
+ * Whether to immediately queue the task for processing (optional, defaults to
157
+ * true)
158
+ */
159
+ queueRightAway?: boolean | null;
160
+
161
+ /**
162
+ * Array of code repository IDs that this task relates to
163
+ */
164
+ repositories?: Array<string>;
57
165
  }
58
166
 
59
167
  export interface TaskListParams {
168
+ /**
169
+ * Number of items to return per page (max 100)
170
+ */
60
171
  limit?: number;
61
172
 
173
+ /**
174
+ * Page number to retrieve (starts from 1)
175
+ */
62
176
  page?: number;
63
177
  }
64
178
 
65
179
  export interface TaskSearchParams {
180
+ /**
181
+ * Search query to find issues by title or description
182
+ */
66
183
  q: string;
67
184
 
185
+ /**
186
+ * Number of items to return per page (max 100)
187
+ */
68
188
  limit?: number;
69
189
 
190
+ /**
191
+ * Page number to retrieve (starts from 1)
192
+ */
70
193
  page?: number;
71
194
  }
72
195
 
73
196
  export declare namespace Task {
74
197
  export {
198
+ type TaskCreateResponse as TaskCreateResponse,
199
+ type TaskListResponse as TaskListResponse,
200
+ type TaskSearchResponse as TaskSearchResponse,
75
201
  type TaskCreateParams as TaskCreateParams,
76
202
  type TaskListParams as TaskListParams,
77
203
  type TaskSearchParams as TaskSearchParams,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.0.2'; // x-release-please-version
1
+ export const VERSION = '0.0.5'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.0.2";
1
+ export declare const VERSION = "0.0.5";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.0.2";
1
+ export declare const VERSION = "0.0.5";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.0.2'; // x-release-please-version
4
+ exports.VERSION = '0.0.5'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.0.2'; // x-release-please-version
1
+ export const VERSION = '0.0.5'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map