1 // Copyright (c) 2020, Google Inc. 2 // All rights reserved. 3 // 4 // Redistribution and use in source and binary forms, with or without 5 // modification, are permitted provided that the following conditions are 6 // met: 7 // 8 // * Redistributions of source code must retain the above copyright 9 // notice, this list of conditions and the following disclaimer. 10 // * Redistributions in binary form must reproduce the above 11 // copyright notice, this list of conditions and the following disclaimer 12 // in the documentation and/or other materials provided with the 13 // distribution. 14 // * Neither the name of Google Inc. nor the names of its 15 // contributors may be used to endorse or promote products derived from 16 // this software without specific prior written permission. 17 // 18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 30 #import <Foundation/Foundation.h> 31 32 NS_ASSUME_NONNULL_BEGIN 33 34 /** 35 Represents a response from a sym-upload-v2 server to a createUploadURLOnServer 36 call. 37 */ 38 @interface UploadURLResponse : NSObject { 39 @protected 40 NSString* uploadURL_; 41 NSString* uploadKey_; 42 } 43 44 - (id)initWithUploadURL:(NSString*)uploadURL withUploadKey:(NSString*)uploadKey; 45 46 - (NSString*)uploadURL; 47 - (NSString*)uploadKey; 48 @end 49 50 /** 51 Possible return statuses from a sym-upload-v2 server to a 52 completeUploadOnServer call. 53 */ 54 typedef NS_ENUM(NSInteger, CompleteUploadResult) { 55 CompleteUploadResultOk, 56 CompleteUploadResultDuplicateData, 57 CompleteUploadResultError 58 }; 59 60 /** 61 Possible return statuses from a sym-upload-v2 server to a 62 checkSymbolStatusOnServer call. 63 */ 64 typedef NS_ENUM(NSInteger, SymbolStatus) { 65 SymbolStatusFound, 66 SymbolStatusMissing, 67 SymbolStatusUnknown 68 }; 69 70 /** 71 Interface to help a client interact with a sym-upload-v2 server, over HTTP. 72 For details of the API and protocol, see :/docs/sym_upload_v2_protocol.md. 73 */ 74 @interface SymbolCollectorClient : NSObject 75 ; 76 77 /** 78 Calls the /v1/symbols/{debug_file}/{debug_id}:checkStatus API on the server. 79 */ 80 + (SymbolStatus)checkSymbolStatusOnServer:(NSString*)APIURL 81 withAPIKey:(NSString*)APIKey 82 withDebugFile:(NSString*)debugFile 83 withDebugID:(NSString*)debugID; 84 85 /** 86 Calls the /v1/uploads:create API on the server. 87 */ 88 + (UploadURLResponse*)createUploadURLOnServer:(NSString*)APIURL 89 withAPIKey:(NSString*)APIKey; 90 91 /** 92 Calls the /v1/uploads/{key}:complete API on the server. 93 */ 94 + (CompleteUploadResult)completeUploadOnServer:(NSString*)APIURL 95 withAPIKey:(NSString*)APIKey 96 withUploadKey:(NSString*)uploadKey 97 withDebugFile:(NSString*)debugFile 98 withDebugID:(NSString*)debugID 99 withType:(NSString*)type; 100 101 @end 102 103 NS_ASSUME_NONNULL_END 104