feat: Passwordless cross-device authentication

- Arkitektur: docs/auth/passwordless-architecture.md
- Backend: iom/quixzoom-auth-service/ (FastAPI + Redis)
- Webb: quixzoom-market-pages/se/login/ (QR-kod + polling)
- App: iom/quixzoom-app/src/features/auth/ (push + deep links)

Flöde: QR-kod → app-godkännande → webb-inloggad
This commit is contained in:
Bernt
2026-07-07 07:11:50 +00:00
parent 4aa984ad74
commit 6989a98d75
61843 changed files with 5491611 additions and 872231 deletions
+3
View File
@@ -0,0 +1,3 @@
export { Parts, type UploadPart, type PartCreateParams } from "./parts.mjs";
export { Uploads, type Upload, type UploadCreateParams, type UploadCompleteParams } from "./uploads.mjs";
//# sourceMappingURL=index.d.mts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/resources/uploads/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,KAAK,gBAAgB,EAAE,oBAAgB;AACxE,OAAO,EAAE,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,kBAAkB,EAAE,KAAK,oBAAoB,EAAE,sBAAkB"}
+3
View File
@@ -0,0 +1,3 @@
export { Parts, type UploadPart, type PartCreateParams } from "./parts.js";
export { Uploads, type Upload, type UploadCreateParams, type UploadCompleteParams } from "./uploads.js";
//# sourceMappingURL=index.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/uploads/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,KAAK,gBAAgB,EAAE,mBAAgB;AACxE,OAAO,EAAE,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,kBAAkB,EAAE,KAAK,oBAAoB,EAAE,qBAAkB"}
+9
View File
@@ -0,0 +1,9 @@
"use strict";
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Uploads = exports.Parts = void 0;
var parts_1 = require("./parts.js");
Object.defineProperty(exports, "Parts", { enumerable: true, get: function () { return parts_1.Parts; } });
var uploads_1 = require("./uploads.js");
Object.defineProperty(exports, "Uploads", { enumerable: true, get: function () { return uploads_1.Uploads; } });
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/uploads/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,oCAAwE;AAA/D,8FAAA,KAAK,OAAA;AACd,wCAAqG;AAA5F,kGAAA,OAAO,OAAA"}
+4
View File
@@ -0,0 +1,4 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
export { Parts } from "./parts.mjs";
export { Uploads } from "./uploads.mjs";
//# sourceMappingURL=index.mjs.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/uploads/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,KAAK,EAA0C,oBAAgB;AACxE,OAAO,EAAE,OAAO,EAAmE,sBAAkB"}
+54
View File
@@ -0,0 +1,54 @@
import { APIResource } from "../../core/resource.mjs";
import { APIPromise } from "../../core/api-promise.mjs";
import { type Uploadable } from "../../core/uploads.mjs";
import { RequestOptions } from "../../internal/request-options.mjs";
/**
* Use Uploads to upload large files in multiple parts.
*/
export declare class Parts extends APIResource {
/**
* Adds a
* [Part](https://platform.openai.com/docs/api-reference/uploads/part-object) to an
* [Upload](https://platform.openai.com/docs/api-reference/uploads/object) object.
* A Part represents a chunk of bytes from the file you are trying to upload.
*
* Each Part can be at most 64 MB, and you can add Parts until you hit the Upload
* maximum of 8 GB.
*
* It is possible to add multiple Parts in parallel. You can decide the intended
* order of the Parts when you
* [complete the Upload](https://platform.openai.com/docs/api-reference/uploads/complete).
*/
create(uploadID: string, body: PartCreateParams, options?: RequestOptions): APIPromise<UploadPart>;
}
/**
* The upload Part represents a chunk of bytes we can add to an Upload object.
*/
export interface UploadPart {
/**
* The upload Part unique identifier, which can be referenced in API endpoints.
*/
id: string;
/**
* The Unix timestamp (in seconds) for when the Part was created.
*/
created_at: number;
/**
* The object type, which is always `upload.part`.
*/
object: 'upload.part';
/**
* The ID of the Upload object that this Part was added to.
*/
upload_id: string;
}
export interface PartCreateParams {
/**
* The chunk of bytes for this Part.
*/
data: Uploadable;
}
export declare namespace Parts {
export { type UploadPart as UploadPart, type PartCreateParams as PartCreateParams };
}
//# sourceMappingURL=parts.d.mts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"parts.d.mts","sourceRoot":"","sources":["../../src/resources/uploads/parts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAClD,OAAO,EAAE,UAAU,EAAE,mCAA+B;AACpD,OAAO,EAAE,KAAK,UAAU,EAAE,+BAA2B;AACrD,OAAO,EAAE,cAAc,EAAE,2CAAuC;AAIhE;;GAEG;AACH,qBAAa,KAAM,SAAQ,WAAW;IACpC;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,UAAU,CAAC;CAMnG;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,EAAE,aAAa,CAAC;IAEtB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EAAE,KAAK,UAAU,IAAI,UAAU,EAAE,KAAK,gBAAgB,IAAI,gBAAgB,EAAE,CAAC;CACrF"}
+54
View File
@@ -0,0 +1,54 @@
import { APIResource } from "../../core/resource.js";
import { APIPromise } from "../../core/api-promise.js";
import { type Uploadable } from "../../core/uploads.js";
import { RequestOptions } from "../../internal/request-options.js";
/**
* Use Uploads to upload large files in multiple parts.
*/
export declare class Parts extends APIResource {
/**
* Adds a
* [Part](https://platform.openai.com/docs/api-reference/uploads/part-object) to an
* [Upload](https://platform.openai.com/docs/api-reference/uploads/object) object.
* A Part represents a chunk of bytes from the file you are trying to upload.
*
* Each Part can be at most 64 MB, and you can add Parts until you hit the Upload
* maximum of 8 GB.
*
* It is possible to add multiple Parts in parallel. You can decide the intended
* order of the Parts when you
* [complete the Upload](https://platform.openai.com/docs/api-reference/uploads/complete).
*/
create(uploadID: string, body: PartCreateParams, options?: RequestOptions): APIPromise<UploadPart>;
}
/**
* The upload Part represents a chunk of bytes we can add to an Upload object.
*/
export interface UploadPart {
/**
* The upload Part unique identifier, which can be referenced in API endpoints.
*/
id: string;
/**
* The Unix timestamp (in seconds) for when the Part was created.
*/
created_at: number;
/**
* The object type, which is always `upload.part`.
*/
object: 'upload.part';
/**
* The ID of the Upload object that this Part was added to.
*/
upload_id: string;
}
export interface PartCreateParams {
/**
* The chunk of bytes for this Part.
*/
data: Uploadable;
}
export declare namespace Parts {
export { type UploadPart as UploadPart, type PartCreateParams as PartCreateParams };
}
//# sourceMappingURL=parts.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"parts.d.ts","sourceRoot":"","sources":["../../src/resources/uploads/parts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,+BAA4B;AAClD,OAAO,EAAE,UAAU,EAAE,kCAA+B;AACpD,OAAO,EAAE,KAAK,UAAU,EAAE,8BAA2B;AACrD,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAIhE;;GAEG;AACH,qBAAa,KAAM,SAAQ,WAAW;IACpC;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,UAAU,CAAC;CAMnG;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,EAAE,aAAa,CAAC;IAEtB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EAAE,KAAK,UAAU,IAAI,UAAU,EAAE,KAAK,gBAAgB,IAAI,gBAAgB,EAAE,CAAC;CACrF"}
+30
View File
@@ -0,0 +1,30 @@
"use strict";
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Parts = void 0;
const resource_1 = require("../../core/resource.js");
const uploads_1 = require("../../internal/uploads.js");
const path_1 = require("../../internal/utils/path.js");
/**
* Use Uploads to upload large files in multiple parts.
*/
class Parts extends resource_1.APIResource {
/**
* Adds a
* [Part](https://platform.openai.com/docs/api-reference/uploads/part-object) to an
* [Upload](https://platform.openai.com/docs/api-reference/uploads/object) object.
* A Part represents a chunk of bytes from the file you are trying to upload.
*
* Each Part can be at most 64 MB, and you can add Parts until you hit the Upload
* maximum of 8 GB.
*
* It is possible to add multiple Parts in parallel. You can decide the intended
* order of the Parts when you
* [complete the Upload](https://platform.openai.com/docs/api-reference/uploads/complete).
*/
create(uploadID, body, options) {
return this._client.post((0, path_1.path) `/uploads/${uploadID}/parts`, (0, uploads_1.multipartFormRequestOptions)({ body, ...options, __security: { bearerAuth: true } }, this._client));
}
}
exports.Parts = Parts;
//# sourceMappingURL=parts.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"parts.js","sourceRoot":"","sources":["../../src/resources/uploads/parts.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAIlD,uDAAqE;AACrE,uDAAiD;AAEjD;;GAEG;AACH,MAAa,KAAM,SAAQ,sBAAW;IACpC;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,QAAgB,EAAE,IAAsB,EAAE,OAAwB;QACvE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,IAAA,WAAI,EAAA,YAAY,QAAQ,QAAQ,EAChC,IAAA,qCAA2B,EAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAClG,CAAC;IACJ,CAAC;CACF;AApBD,sBAoBC"}
+26
View File
@@ -0,0 +1,26 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import { multipartFormRequestOptions } from "../../internal/uploads.mjs";
import { path } from "../../internal/utils/path.mjs";
/**
* Use Uploads to upload large files in multiple parts.
*/
export class Parts extends APIResource {
/**
* Adds a
* [Part](https://platform.openai.com/docs/api-reference/uploads/part-object) to an
* [Upload](https://platform.openai.com/docs/api-reference/uploads/object) object.
* A Part represents a chunk of bytes from the file you are trying to upload.
*
* Each Part can be at most 64 MB, and you can add Parts until you hit the Upload
* maximum of 8 GB.
*
* It is possible to add multiple Parts in parallel. You can decide the intended
* order of the Parts when you
* [complete the Upload](https://platform.openai.com/docs/api-reference/uploads/complete).
*/
create(uploadID, body, options) {
return this._client.post(path `/uploads/${uploadID}/parts`, multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
}
}
//# sourceMappingURL=parts.mjs.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"parts.mjs","sourceRoot":"","sources":["../../src/resources/uploads/parts.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAIlD,OAAO,EAAE,2BAA2B,EAAE,mCAA+B;AACrE,OAAO,EAAE,IAAI,EAAE,sCAAkC;AAEjD;;GAEG;AACH,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,QAAgB,EAAE,IAAsB,EAAE,OAAwB;QACvE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,IAAI,CAAA,YAAY,QAAQ,QAAQ,EAChC,2BAA2B,CAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAClG,CAAC;IACJ,CAAC;CACF"}
+166
View File
@@ -0,0 +1,166 @@
import { APIResource } from "../../core/resource.mjs";
import * as FilesAPI from "../files.mjs";
import * as PartsAPI from "./parts.mjs";
import { PartCreateParams, Parts, UploadPart } from "./parts.mjs";
import { APIPromise } from "../../core/api-promise.mjs";
import { RequestOptions } from "../../internal/request-options.mjs";
/**
* Use Uploads to upload large files in multiple parts.
*/
export declare class Uploads extends APIResource {
parts: PartsAPI.Parts;
/**
* Creates an intermediate
* [Upload](https://platform.openai.com/docs/api-reference/uploads/object) object
* that you can add
* [Parts](https://platform.openai.com/docs/api-reference/uploads/part-object) to.
* Currently, an Upload can accept at most 8 GB in total and expires after an hour
* after you create it.
*
* Once you complete the Upload, we will create a
* [File](https://platform.openai.com/docs/api-reference/files/object) object that
* contains all the parts you uploaded. This File is usable in the rest of our
* platform as a regular File object.
*
* For certain `purpose` values, the correct `mime_type` must be specified. Please
* refer to documentation for the
* [supported MIME types for your use case](https://platform.openai.com/docs/assistants/tools/file-search#supported-files).
*
* For guidance on the proper filename extensions for each purpose, please follow
* the documentation on
* [creating a File](https://platform.openai.com/docs/api-reference/files/create).
*
* Returns the Upload object with status `pending`.
*/
create(body: UploadCreateParams, options?: RequestOptions): APIPromise<Upload>;
/**
* Cancels the Upload. No Parts may be added after an Upload is cancelled.
*
* Returns the Upload object with status `cancelled`.
*/
cancel(uploadID: string, options?: RequestOptions): APIPromise<Upload>;
/**
* Completes the
* [Upload](https://platform.openai.com/docs/api-reference/uploads/object).
*
* Within the returned Upload object, there is a nested
* [File](https://platform.openai.com/docs/api-reference/files/object) object that
* is ready to use in the rest of the platform.
*
* You can specify the order of the Parts by passing in an ordered list of the Part
* IDs.
*
* The number of bytes uploaded upon completion must match the number of bytes
* initially specified when creating the Upload object. No Parts may be added after
* an Upload is completed. Returns the Upload object with status `completed`,
* including an additional `file` property containing the created usable File
* object.
*/
complete(uploadID: string, body: UploadCompleteParams, options?: RequestOptions): APIPromise<Upload>;
}
/**
* The Upload object can accept byte chunks in the form of Parts.
*/
export interface Upload {
/**
* The Upload unique identifier, which can be referenced in API endpoints.
*/
id: string;
/**
* The intended number of bytes to be uploaded.
*/
bytes: number;
/**
* The Unix timestamp (in seconds) for when the Upload was created.
*/
created_at: number;
/**
* The Unix timestamp (in seconds) for when the Upload will expire.
*/
expires_at: number;
/**
* The name of the file to be uploaded.
*/
filename: string;
/**
* The object type, which is always "upload".
*/
object: 'upload';
/**
* The intended purpose of the file.
* [Please refer here](https://platform.openai.com/docs/api-reference/files/object#files/object-purpose)
* for acceptable values.
*/
purpose: string;
/**
* The status of the Upload.
*/
status: 'pending' | 'completed' | 'cancelled' | 'expired';
/**
* The `File` object represents a document that has been uploaded to OpenAI.
*/
file?: FilesAPI.FileObject | null;
}
export interface UploadCreateParams {
/**
* The number of bytes in the file you are uploading.
*/
bytes: number;
/**
* The name of the file to upload.
*/
filename: string;
/**
* The MIME type of the file.
*
* This must fall within the supported MIME types for your file purpose. See the
* supported MIME types for assistants and vision.
*/
mime_type: string;
/**
* The intended purpose of the uploaded file.
*
* See the
* [documentation on File purposes](https://platform.openai.com/docs/api-reference/files/create#files-create-purpose).
*/
purpose: FilesAPI.FilePurpose;
/**
* The expiration policy for a file. By default, files with `purpose=batch` expire
* after 30 days and all other files are persisted until they are manually deleted.
*/
expires_after?: UploadCreateParams.ExpiresAfter;
}
export declare namespace UploadCreateParams {
/**
* The expiration policy for a file. By default, files with `purpose=batch` expire
* after 30 days and all other files are persisted until they are manually deleted.
*/
interface ExpiresAfter {
/**
* Anchor timestamp after which the expiration policy applies. Supported anchors:
* `created_at`.
*/
anchor: 'created_at';
/**
* The number of seconds after the anchor time that the file will expire. Must be
* between 3600 (1 hour) and 2592000 (30 days).
*/
seconds: number;
}
}
export interface UploadCompleteParams {
/**
* The ordered list of Part IDs.
*/
part_ids: Array<string>;
/**
* The optional md5 checksum for the file contents to verify if the bytes uploaded
* matches what you expect.
*/
md5?: string;
}
export declare namespace Uploads {
export { type Upload as Upload, type UploadCreateParams as UploadCreateParams, type UploadCompleteParams as UploadCompleteParams, };
export { Parts as Parts, type UploadPart as UploadPart, type PartCreateParams as PartCreateParams };
}
//# sourceMappingURL=uploads.d.mts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"uploads.d.mts","sourceRoot":"","sources":["../../src/resources/uploads/uploads.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAClD,OAAO,KAAK,QAAQ,qBAAiB;AACrC,OAAO,KAAK,QAAQ,oBAAgB;AACpC,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,UAAU,EAAE,oBAAgB;AAC9D,OAAO,EAAE,UAAU,EAAE,mCAA+B;AACpD,OAAO,EAAE,cAAc,EAAE,2CAAuC;AAGhE;;GAEG;AACH,qBAAa,OAAQ,SAAQ,WAAW;IACtC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAoC;IAEzD;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,MAAM,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC;IAI9E;;;;OAIG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC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E,MAAM,CAAC;CACd;AAID,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EACL,KAAK,MAAM,IAAI,MAAM,EACrB,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,oBAAoB,IAAI,oBAAoB,GAClD,CAAC;IAEF,OAAO,EAAE,KAAK,IAAI,KAAK,EAAE,KAAK,UAAU,IAAI,UAAU,EAAE,KAAK,gBAAgB,IAAI,gBAAgB,EAAE,CAAC;CACrG"}
+166
View File
@@ -0,0 +1,166 @@
import { APIResource } from "../../core/resource.js";
import * as FilesAPI from "../files.js";
import * as PartsAPI from "./parts.js";
import { PartCreateParams, Parts, UploadPart } from "./parts.js";
import { APIPromise } from "../../core/api-promise.js";
import { RequestOptions } from "../../internal/request-options.js";
/**
* Use Uploads to upload large files in multiple parts.
*/
export declare class Uploads extends APIResource {
parts: PartsAPI.Parts;
/**
* Creates an intermediate
* [Upload](https://platform.openai.com/docs/api-reference/uploads/object) object
* that you can add
* [Parts](https://platform.openai.com/docs/api-reference/uploads/part-object) to.
* Currently, an Upload can accept at most 8 GB in total and expires after an hour
* after you create it.
*
* Once you complete the Upload, we will create a
* [File](https://platform.openai.com/docs/api-reference/files/object) object that
* contains all the parts you uploaded. This File is usable in the rest of our
* platform as a regular File object.
*
* For certain `purpose` values, the correct `mime_type` must be specified. Please
* refer to documentation for the
* [supported MIME types for your use case](https://platform.openai.com/docs/assistants/tools/file-search#supported-files).
*
* For guidance on the proper filename extensions for each purpose, please follow
* the documentation on
* [creating a File](https://platform.openai.com/docs/api-reference/files/create).
*
* Returns the Upload object with status `pending`.
*/
create(body: UploadCreateParams, options?: RequestOptions): APIPromise<Upload>;
/**
* Cancels the Upload. No Parts may be added after an Upload is cancelled.
*
* Returns the Upload object with status `cancelled`.
*/
cancel(uploadID: string, options?: RequestOptions): APIPromise<Upload>;
/**
* Completes the
* [Upload](https://platform.openai.com/docs/api-reference/uploads/object).
*
* Within the returned Upload object, there is a nested
* [File](https://platform.openai.com/docs/api-reference/files/object) object that
* is ready to use in the rest of the platform.
*
* You can specify the order of the Parts by passing in an ordered list of the Part
* IDs.
*
* The number of bytes uploaded upon completion must match the number of bytes
* initially specified when creating the Upload object. No Parts may be added after
* an Upload is completed. Returns the Upload object with status `completed`,
* including an additional `file` property containing the created usable File
* object.
*/
complete(uploadID: string, body: UploadCompleteParams, options?: RequestOptions): APIPromise<Upload>;
}
/**
* The Upload object can accept byte chunks in the form of Parts.
*/
export interface Upload {
/**
* The Upload unique identifier, which can be referenced in API endpoints.
*/
id: string;
/**
* The intended number of bytes to be uploaded.
*/
bytes: number;
/**
* The Unix timestamp (in seconds) for when the Upload was created.
*/
created_at: number;
/**
* The Unix timestamp (in seconds) for when the Upload will expire.
*/
expires_at: number;
/**
* The name of the file to be uploaded.
*/
filename: string;
/**
* The object type, which is always "upload".
*/
object: 'upload';
/**
* The intended purpose of the file.
* [Please refer here](https://platform.openai.com/docs/api-reference/files/object#files/object-purpose)
* for acceptable values.
*/
purpose: string;
/**
* The status of the Upload.
*/
status: 'pending' | 'completed' | 'cancelled' | 'expired';
/**
* The `File` object represents a document that has been uploaded to OpenAI.
*/
file?: FilesAPI.FileObject | null;
}
export interface UploadCreateParams {
/**
* The number of bytes in the file you are uploading.
*/
bytes: number;
/**
* The name of the file to upload.
*/
filename: string;
/**
* The MIME type of the file.
*
* This must fall within the supported MIME types for your file purpose. See the
* supported MIME types for assistants and vision.
*/
mime_type: string;
/**
* The intended purpose of the uploaded file.
*
* See the
* [documentation on File purposes](https://platform.openai.com/docs/api-reference/files/create#files-create-purpose).
*/
purpose: FilesAPI.FilePurpose;
/**
* The expiration policy for a file. By default, files with `purpose=batch` expire
* after 30 days and all other files are persisted until they are manually deleted.
*/
expires_after?: UploadCreateParams.ExpiresAfter;
}
export declare namespace UploadCreateParams {
/**
* The expiration policy for a file. By default, files with `purpose=batch` expire
* after 30 days and all other files are persisted until they are manually deleted.
*/
interface ExpiresAfter {
/**
* Anchor timestamp after which the expiration policy applies. Supported anchors:
* `created_at`.
*/
anchor: 'created_at';
/**
* The number of seconds after the anchor time that the file will expire. Must be
* between 3600 (1 hour) and 2592000 (30 days).
*/
seconds: number;
}
}
export interface UploadCompleteParams {
/**
* The ordered list of Part IDs.
*/
part_ids: Array<string>;
/**
* The optional md5 checksum for the file contents to verify if the bytes uploaded
* matches what you expect.
*/
md5?: string;
}
export declare namespace Uploads {
export { type Upload as Upload, type UploadCreateParams as UploadCreateParams, type UploadCompleteParams as UploadCompleteParams, };
export { Parts as Parts, type UploadPart as UploadPart, type PartCreateParams as PartCreateParams };
}
//# sourceMappingURL=uploads.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["../../src/resources/uploads/uploads.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,+BAA4B;AAClD,OAAO,KAAK,QAAQ,oBAAiB;AACrC,OAAO,KAAK,QAAQ,mBAAgB;AACpC,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,UAAU,EAAE,mBAAgB;AAC9D,OAAO,EAAE,UAAU,EAAE,kCAA+B;AACpD,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAGhE;;GAEG;AACH,qBAAa,OAAQ,SAAQ,WAAW;IACtC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAoC;IAEzD;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,MAAM,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC;IAI9E;;;;OAIG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC;IAOtE;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,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AAK,oBAAoB,IAAI,oBAAoB,GAClD,CAAC;IAEF,OAAO,EAAE,KAAK,IAAI,KAAK,EAAE,KAAK,UAAU,IAAI,UAAU,EAAE,KAAK,gBAAgB,IAAI,gBAAgB,EAAE,CAAC;CACrG"}
+82
View File
@@ -0,0 +1,82 @@
"use strict";
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Uploads = void 0;
const tslib_1 = require("../../internal/tslib.js");
const resource_1 = require("../../core/resource.js");
const PartsAPI = tslib_1.__importStar(require("./parts.js"));
const parts_1 = require("./parts.js");
const path_1 = require("../../internal/utils/path.js");
/**
* Use Uploads to upload large files in multiple parts.
*/
class Uploads extends resource_1.APIResource {
constructor() {
super(...arguments);
this.parts = new PartsAPI.Parts(this._client);
}
/**
* Creates an intermediate
* [Upload](https://platform.openai.com/docs/api-reference/uploads/object) object
* that you can add
* [Parts](https://platform.openai.com/docs/api-reference/uploads/part-object) to.
* Currently, an Upload can accept at most 8 GB in total and expires after an hour
* after you create it.
*
* Once you complete the Upload, we will create a
* [File](https://platform.openai.com/docs/api-reference/files/object) object that
* contains all the parts you uploaded. This File is usable in the rest of our
* platform as a regular File object.
*
* For certain `purpose` values, the correct `mime_type` must be specified. Please
* refer to documentation for the
* [supported MIME types for your use case](https://platform.openai.com/docs/assistants/tools/file-search#supported-files).
*
* For guidance on the proper filename extensions for each purpose, please follow
* the documentation on
* [creating a File](https://platform.openai.com/docs/api-reference/files/create).
*
* Returns the Upload object with status `pending`.
*/
create(body, options) {
return this._client.post('/uploads', { body, ...options, __security: { bearerAuth: true } });
}
/**
* Cancels the Upload. No Parts may be added after an Upload is cancelled.
*
* Returns the Upload object with status `cancelled`.
*/
cancel(uploadID, options) {
return this._client.post((0, path_1.path) `/uploads/${uploadID}/cancel`, {
...options,
__security: { bearerAuth: true },
});
}
/**
* Completes the
* [Upload](https://platform.openai.com/docs/api-reference/uploads/object).
*
* Within the returned Upload object, there is a nested
* [File](https://platform.openai.com/docs/api-reference/files/object) object that
* is ready to use in the rest of the platform.
*
* You can specify the order of the Parts by passing in an ordered list of the Part
* IDs.
*
* The number of bytes uploaded upon completion must match the number of bytes
* initially specified when creating the Upload object. No Parts may be added after
* an Upload is completed. Returns the Upload object with status `completed`,
* including an additional `file` property containing the created usable File
* object.
*/
complete(uploadID, body, options) {
return this._client.post((0, path_1.path) `/uploads/${uploadID}/complete`, {
body,
...options,
__security: { bearerAuth: true },
});
}
}
exports.Uploads = Uploads;
Uploads.Parts = parts_1.Parts;
//# sourceMappingURL=uploads.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"uploads.js","sourceRoot":"","sources":["../../src/resources/uploads/uploads.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,qDAAkD;AAElD,6DAAoC;AACpC,sCAA8D;AAG9D,uDAAiD;AAEjD;;GAEG;AACH,MAAa,OAAQ,SAAQ,sBAAW;IAAxC;;QACE,UAAK,GAAmB,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAiE3D,CAAC;IA/DC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,MAAM,CAAC,IAAwB,EAAE,OAAwB;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;IAC/F,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,QAAgB,EAAE,OAAwB;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,YAAY,QAAQ,SAAS,EAAE;YAC1D,GAAG,OAAO;YACV,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;SACjC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,QAAgB,EAAE,IAA0B,EAAE,OAAwB;QAC7E,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,YAAY,QAAQ,WAAW,EAAE;YAC5D,IAAI;YACJ,GAAG,OAAO;YACV,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;SACjC,CAAC,CAAC;IACL,CAAC;CACF;AAlED,0BAkEC;AAyHD,OAAO,CAAC,KAAK,GAAG,aAAK,CAAC"}
+77
View File
@@ -0,0 +1,77 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import * as PartsAPI from "./parts.mjs";
import { Parts } from "./parts.mjs";
import { path } from "../../internal/utils/path.mjs";
/**
* Use Uploads to upload large files in multiple parts.
*/
export class Uploads extends APIResource {
constructor() {
super(...arguments);
this.parts = new PartsAPI.Parts(this._client);
}
/**
* Creates an intermediate
* [Upload](https://platform.openai.com/docs/api-reference/uploads/object) object
* that you can add
* [Parts](https://platform.openai.com/docs/api-reference/uploads/part-object) to.
* Currently, an Upload can accept at most 8 GB in total and expires after an hour
* after you create it.
*
* Once you complete the Upload, we will create a
* [File](https://platform.openai.com/docs/api-reference/files/object) object that
* contains all the parts you uploaded. This File is usable in the rest of our
* platform as a regular File object.
*
* For certain `purpose` values, the correct `mime_type` must be specified. Please
* refer to documentation for the
* [supported MIME types for your use case](https://platform.openai.com/docs/assistants/tools/file-search#supported-files).
*
* For guidance on the proper filename extensions for each purpose, please follow
* the documentation on
* [creating a File](https://platform.openai.com/docs/api-reference/files/create).
*
* Returns the Upload object with status `pending`.
*/
create(body, options) {
return this._client.post('/uploads', { body, ...options, __security: { bearerAuth: true } });
}
/**
* Cancels the Upload. No Parts may be added after an Upload is cancelled.
*
* Returns the Upload object with status `cancelled`.
*/
cancel(uploadID, options) {
return this._client.post(path `/uploads/${uploadID}/cancel`, {
...options,
__security: { bearerAuth: true },
});
}
/**
* Completes the
* [Upload](https://platform.openai.com/docs/api-reference/uploads/object).
*
* Within the returned Upload object, there is a nested
* [File](https://platform.openai.com/docs/api-reference/files/object) object that
* is ready to use in the rest of the platform.
*
* You can specify the order of the Parts by passing in an ordered list of the Part
* IDs.
*
* The number of bytes uploaded upon completion must match the number of bytes
* initially specified when creating the Upload object. No Parts may be added after
* an Upload is completed. Returns the Upload object with status `completed`,
* including an additional `file` property containing the created usable File
* object.
*/
complete(uploadID, body, options) {
return this._client.post(path `/uploads/${uploadID}/complete`, {
body,
...options,
__security: { bearerAuth: true },
});
}
}
Uploads.Parts = Parts;
//# sourceMappingURL=uploads.mjs.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"uploads.mjs","sourceRoot":"","sources":["../../src/resources/uploads/uploads.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAElD,OAAO,KAAK,QAAQ,oBAAgB;AACpC,OAAO,EAAoB,KAAK,EAAc,oBAAgB;AAG9D,OAAO,EAAE,IAAI,EAAE,sCAAkC;AAEjD;;GAEG;AACH,MAAM,OAAO,OAAQ,SAAQ,WAAW;IAAxC;;QACE,UAAK,GAAmB,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAiE3D,CAAC;IA/DC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,MAAM,CAAC,IAAwB,EAAE,OAAwB;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;IAC/F,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,QAAgB,EAAE,OAAwB;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,YAAY,QAAQ,SAAS,EAAE;YAC1D,GAAG,OAAO;YACV,UAAU,EAAE,EAAE,UAAU,EAAE,IAA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